Posts: 430
Threads: 57
Joined: Nov 2023
Reputation:
3
04-11-2026, 07:27 AM
(This post was last modified: 04-11-2026, 07:29 AM by 1micha.elok.)
I’ve noticed an interesting quirk in my application: the card suit symbols (♥, ♦, ♣, ♠) render perfectly in the console, but they appear as empty spaces when running in windowed mode. Is there a way to correctly display these symbols using the chr() function for a windowed environment ?
Code: '--------------
' CONSOLE MODE
'--------------
randomize time()
values = ["A ", "2 ", "3 ", "4 ", "5 ", "6 ", "7 ", "8 ", "9 ", "10", "J ", "Q ", "K "]
v = values[rnd(0,12)]
s = rnd(3,6) 'ASCII code 3=heart, 4=diamond, 5=club, 6=spade
card(5,4,v,s)
pln chr(7) 'bell sound
wait 1000
'--------------
' WINDOW MODE
'--------------
set window "cards",300,300,false
do
wln "My card is the "+v+" of "+chr(s)
'ASCII code 3=heart, 4=diamond, 5=club, 6=spade
do;wait 1;until keydown(KEY_ESCAPE,true)
end
loop
'----------
' FUNCTION
'----------
function card(w,h,value,suit)
'top border
write chr(218) ; for i = 1 to w write chr(196) ; wln chr(191)
'vertical border
write chr(179)+value ; for i = 3 to w write chr(32) ; wln chr(179)
for i = 1 to h-2
write chr(179) ; for j = 1 to w write chr(32); wln chr(179)
next
write chr(179); for i = 1 to w-2 write chr(32) ; write chr(suit)+chr(32);wln chr(179)
'bottom border
write chr(192); for i = 1 to w write chr(196) ; wln chr(217)
endfunc
Posts: 665
Threads: 83
Joined: Nov 2023
Reputation:
7
(04-11-2026, 07:27 AM)1micha.elok Wrote: I’ve noticed an interesting quirk in my application: the card suit symbols (♥, ♦, ♣, ♠) render perfectly in the console, but they appear as empty spaces when running in windowed mode. Is there a way to correctly display these symbols using the chr() function for a windowed environment ?
Code: '--------------
' CONSOLE MODE
'--------------
randomize time()
values = ["A ", "2 ", "3 ", "4 ", "5 ", "6 ", "7 ", "8 ", "9 ", "10", "J ", "Q ", "K "]
v = values[rnd(0,12)]
s = rnd(3,6) 'ASCII code 3=heart, 4=diamond, 5=club, 6=spade
card(5,4,v,s)
pln chr(7) 'bell sound
wait 1000
'--------------
' WINDOW MODE
'--------------
set window "cards",300,300,false
do
wln "My card is the "+v+" of "+chr(s)
'ASCII code 3=heart, 4=diamond, 5=club, 6=spade
do;wait 1;until keydown(KEY_ESCAPE,true)
end
loop
'----------
' FUNCTION
'----------
function card(w,h,value,suit)
'top border
write chr(218) ; for i = 1 to w write chr(196) ; wln chr(191)
'vertical border
write chr(179)+value ; for i = 3 to w write chr(32) ; wln chr(179)
for i = 1 to h-2
write chr(179) ; for j = 1 to w write chr(32); wln chr(179)
next
write chr(179); for i = 1 to w-2 write chr(32) ; write chr(suit)+chr(32);wln chr(179)
'bottom border
write chr(192); for i = 1 to w write chr(196) ; wln chr(217)
endfunc
No, sorry, naalaa only supports ascii.
Posts: 430
Threads: 57
Joined: Nov 2023
Reputation:
3
Posts: 187
Threads: 14
Joined: Dec 2023
Reputation:
8
Very good - it's nice to see some console games. Thanks for sharing.....
Posts: 721
Threads: 76
Joined: Nov 2023
Reputation:
7
Ahh... Gotta love the old ASCII games... Memories...
Logic is the beginning of wisdom.
|