The default design is number one, which is the spheres. You can change the design easily with SetCurrentBack. The argument to pass is simply the number of the design you want, 1 - 6. There is no return, so the return type is void. All cards dealt after this call is made display the selected card design. You can change the design as the program runs, and all six designs can be displayed at the same time, if desired.
'nV can be 1,2,3,4,5,6 for 6 possible designscalldll#qc,"SetCurrentBack",_ 'function name
nV aslong,_ 'number of design desired
r asvoid'no return
DEMO
'cards2.bas, shows how to change card back design.'Cards are dealt in lines across the screen.[varSetup]
i=0'i will be our counter var in for/next loops
design=1'default design is circlesnomainwinWindowWidth=640:WindowHeight=480UpperLeftX=1:UpperLeftY=1menu#1,"&File","E&xit",[quit]menu#1,"&Card Back Design","&Circles",[circles],"&Blue",[blue],_
"&Red",[red],"&Mountain",[mountain],"&Purple",[purple],"M&usic",[music]graphicbox#1.g,0,0,640,440open"Card Game"for window_nf as#1#1"trapclose [quit]"'get graphicbox handle
hBox=hwnd(#1.g)'open the dllopen"qcard32.dll"fordllas#qc
'initialize the deckCall InitializeDeck hBox
[new]'draw a nice background#1.g "down; fill 10 190 225"playwave"shuffle.wav",sync
Call SetCurrentBack design
'design can be 1,2,3,4,5,6 for 6 possible designs'The DLL allows for two decks.'The first deck includes cards 1 - 52.'By default, cards are face up.'Deal first deck face up, across the screen,'incrementing x position for each card.for i =1to52'window handle, card index number, x, yCall DealCard hBox,i,i*12,10playwave"card.wav",sync
'pause 100 milliseconds between cardscall Pause 100scannextplaywave"shuffle.wav",sync
'Cards 53 to 104 are in the second deck.'Deal second deck face down, lower on screen than first deck.'Set status of all cards to 0, which is face down.for i =53to104call SetCardStatus i,0Call DealCard hBox,i,(i-52)*6,67+i
playwave"card.wav",sync
'pause 100 milliseconds between cardscall Pause 100scannextwait[quit]close#qc:close#1:end[circles] design=1:goto[new][blue] design=2:goto[new][red] design=3:goto[new][mountain] design=4:goto[new][purple] design=5:goto[new][music] design=6:goto[new]'''''''''''''''''''''subs and functions:Sub Pause ms
'pause ms number of millisecondscalldll#kernel32,"Sleep",_
ms aslong, re asvoidEndSubSub InitializeDeck hndle
calldll#qc,"InitializeDeck",_
hndle aslong,r aslongEndSubSub SetCardStatus nC,face
'nC is number of card - 1-52 in first deck and'53-104 in second deck, if used'face: 0=facedown,1=faceupcalldll#qc,"SetCardStatus",nC aslong,_
face aslong,r asvoidEndSubSub 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'53-104 in second deck, if usedcalldll#qc,"DealCard",hndle aslong,nC aslong,_
x aslong,y aslong,r asvoidEndSubSub SetCurrentBack nV
'nV can be 1,2,3,4,5,6 for 6 possible designscalldll#qc,"SetCurrentBack",nV aslong,r asvoidEndSub
QCard DLL Lesson Two
Changing the Carl Back Design-
See Lesson 1 for QCard DLL and WAV files needed for the demo code.
QCard DLL Lesson Two | Changing the Card Back Design | DEMO
Changing the Card Back Design
Six designs are available for the card backs:
The default design is number one, which is the spheres. You can change the design easily with SetCurrentBack. The argument to pass is simply the number of the design you want, 1 - 6. There is no return, so the return type is void. All cards dealt after this call is made display the selected card design. You can change the design as the program runs, and all six designs can be displayed at the same time, if desired.
DEMO
QCard DLL Lesson Two | Changing the Card Back Design | DEMO
Lesson 1 Lesson 3