News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Unicode card game

Started by daydreamer, June 15, 2024, 05:26:30 AM

Previous topic - Next topic

daydreamer

"10" string small enough for 260 char limit of winapi control?

Started to work on Unicode card game,started with researched card shuffle code and  created lots of cards in text editor with help of Unicode symbols
Because its strings ,shuffle pointers that points to each card data would be more efficient than shuffle numbers between 0-51
Because ace has least numbers if chars ,'10' most chars
CodeSelect
;♠ ♣ ♥ ♦ unicode cards characters
A
       ♥


2 ♥


3 ♥



4♥        ♥

   ♥         ♥
5♥          ♥
♥          ♥
   ♥          ♥
6 ♥           ♥
♥  ♥          ♥
      ♥           ♥
7 ♥             ♥
             ♥     
♥  ♥             ♥
       ♥             ♥


8 ♥              ♥
             ♥
♥ ♥              ♥
             ♥
    ♥              ♥

9 ♥                ♥
              ♥
♥ ♥                ♥
      ♥                ♥
       ♥                ♥
10 ♥                ♥
                ♥
♥    ♥                ♥
         ♥                ♥
                 ♥
          ♥                ♥




Array []={2♠, 2♣, 2♥, 2♦,3♠, 3♣, 3♥, 3♦,4♠,4 ♣, 4♥,4 ♦,5♠, 5♣, 5♥,5 ♦,6,♠, 6,♣,6 ♥, 6♦,7♠, 7♣, 7♥,7 ♦,8♠,8 ♣,8 ♥,8 ♦,9♠, 9♣,9 ♥, 9♦,10♠,10 ♣, 10♥, 10♦,
Kn♠,kn ♣,kn ♥,kn ♦,Q♠, Q♣, Q♥,Q ♦,K♠, K♣, K ♥, K♦,A♠ A♣, A ♥,A ♦}
proc diamond
; copy to new arrays and replace ♥,with ♦,♠ ♣ in card data

Proc rand2
;generate two different random, based on pi and sqrt (2)
Mov rnd1, rand(Pi)
Mov rnd2,rand(1.42...)

Proc Shuffle cards
Mov ecx,52
L1:
Ebx = array +rnd 1
Edx = array+ rnd 2
Exchange [ebx],[edx] ; bytesize? no dword pointers ,pointing to string
Dec ecx
Jne l1
my none asm creations
https://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding

daydreamer

I dont know what I do wrong, all unicode sendmessageW displays ? afterwards
the last one written directly with L'♥' causes an exception
is buttons set to ascii instead of unicode or something?
I have 5 buttons 100,400 in size side by side to show cards on hand+ push buttons to manipulate cards code come later
 and one big 800,90 above them for text messages to player


WCHAR wans1[] = {'♠',0,0,0,0 };
WCHAR wans2[] = {'♣',0,0,0,0 };
WCHAR wans3[] = {'♥',0,0,0,0 };
WCHAR wans4[] = {'♦',0,0,0,0 };
WCHAR wquest[] = {'X',0,0,0,0 };

/*SendMessageW(hwndButton, WM_SETTEXT, NULL, (LPARAM)wans1);
    SendMessageW(hwndButton2, WM_SETTEXT, NULL, (LPARAM)wans2);
    SendMessageW(hwndButton3, WM_SETTEXT, NULL, (LPARAM)wans3);
    SendMessageW(hwndButton4, WM_SETTEXT, NULL, (LPARAM)wans4);
    */
    //SendMessageW(hwndButtonQ, WM_SETTEXT, NULL, (LPARAM)wquest);
    SendMessageW(hwndButton5, WM_SETTEXT, NULL, (LPARAM)wans1);
    //SendMessageW(hwndButton5, WM_SETTEXT, NULL, (LPARAM)L'♥');
my none asm creations
https://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding

zedd151

#2
Post your full source code, we may be able to help you better.

Are you declaring "__UNICODE__ equ 1" in your source anywhere?
Some masm32 macros (& libraries that might use those macros) will use ascii, otherwise. (conditional upon whether or not "__UNICODE__ equ 1" is declared).

Not sure if this is the case here, as there is not enough code presented to determine this.
:azn:

daydreamer

Thanks but
Decided to start with new version,concentrate on code working card game without Unicode card symbols, only ASCII
Solve Unicode symbols or workaround drawing .ICO files instead later
 ;♠ ♣ ♥ ♦ unicode cards characters
use catstring (strength,color) and sendmessage(cardx,set text
strength          db "2","3"," 4", "5"," 6", "7"," 8", "9"," 10", "knight"," queen","king","ace"
color             db "heart   " diamond ","clubs   ","spades  "; 8 char strings
; lowest 2 bits = colors,higher bits strength ,only strength comparisions
sar ebx,2 ; divide by 4 ,first card
sar edx,2 ; second card
my none asm creations
https://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding

zedd151

#4
Can't wait to see what you come up with!  :thumbsup:
:azn:

fearless

Came across the latest release of promptfont today, and sort of recalled a post relating to a card game. After some searching I came across this thread, so figured I would post this here:

https://github.com/Shinmera/promptfont

https://shinmera.github.io/promptfont/

Has glyphs for playing card suits in the font, hence why I thought it could be useful.