Post by tsh73 on Aug 3, 2022 15:35:37 GMT -5
Two lines marked ('!!!!!) fixes that program for me.
EDIT: actually three
Have a look.
EDIT: actually three
Have a look.
'Timer Demo Aug. 03, 2022
nomainwin
WindowWidth=1160:WindowHeight=480
UpperLeftX=1:UpperLeftY=1
button #main.start "SHUFFLE",[shuffle], UL, 15, 200, 70, 30
graphicbox #main.shuffleind, 15, 230, 70, 5
graphicbox #main.g, 0, 30, 1150, 440
open "Timer Demo" for window_nf as #main
#main "trapclose [quit]"
'graphicbox handle
hBox=hwnd(#main.g)
'open the cards dll
open "qcard32.dll" for dll as #qc
'background
#main.g "down; fill 15 190 225"
numcards = 52
dim num(numcards)
dim cards (100)
gosub [shuffle]
wait
[shuffleindclear]
#main.shuffleind, "down; fill white"
timer 0
goto [afterScan] '!!!!!
'wait
[shuffle]
#main.shuffleind, "down; fill red" 'turns on LED
timer 100, [shuffleindclear] 'should turn off LED after 100 ms
Call InitializeDeck hBox
FOR j = 1 to 52
num(j) = j
NEXT j
[randomize]
FOR j = 1 to numcards
r = int(rnd(1)* numcards + 1)
temp = num(j)
num(j) = num(r)
num(r) = temp
NEXT
'draw cards
FOR j = 1 to numcards
scan '!!!!!
[afterScan] '!!!!!
i = i + 1
cards(i) = num(j)
print "Cards = ";i; " "; cards(i)
nc = cards(i)
face = 1
Call SetCardStatus nC,face
Call DealCard hBox,nc,i * 20,50
call Pause 10 'normally zero delay
NEXT
i = 0
wait
[quit] close #qc:close #main:end
'subs and functions:
Sub Pause ms
'pause ms number of milliseconds
calldll #kernel32,"Sleep",_
ms as long, re as void
End Sub
Sub InitializeDeck hndle
calldll #qc, "InitializeDeck",_
hndle as long,r as long
End Sub
Sub DealCard hndle,nC,x,y
'places card on window whose handle is hndle at x,y
'nC is number of card - 1-52 in first deck and
calldll #qc, "DealCard",hndle as long,nC as long,_
x as long,y as long,r as void
End Sub
Sub SetCardStatus nC,face
'nC is number of card: 1-52
'face: 0=facedown,1=faceup
calldll #qc, "SetCardStatus",nC as long,_
face as long,r as void
End Sub