Skit3000 Admin Team

Joined: 11 May 2002 Posts: 2166 Location: The Netherlands
|
Posted: Tue Apr 20, 2004 6:26 pm Post subject: Cards.dll |
|
|
I just found a website explaining how to draw cards on a dialog. I put this together, but I think there must be some more functions, because right now I'm not able to move or delete a card from the dialog. Maybe somebody else knows how to do it?
| Code: | #define command,cards
# http://www.codeproject.com/csharp/drawcardscp1.asp
# http://delphipage.free.fr/cards.html
DIALOG CREATE,MyCardGame,-1,0,600,350
DIALOG ADD,GRADIENT,GRADIENT1,0,0,600,350,WHITE,SILVER,,TOPTOBOTTOM
DIALOG SHOW
Cards Init
Cards Drawback,8,4,10
Cards Drawback,12,6,10
Cards Drawback,16,8,10
Cards Drawback,20,10,10
Cards Draw,24,12,clover,J
Cards Draw,150,4,clover,A
Cards Draw,150,20,clover,2
Cards Draw,150,36,clover,3
Cards Draw,150,52,clover,4
Cards Draw,250,4,diamonds,A
Cards Draw,350,4,hearts,A
Cards Draw,450,4,spade,A
wait 5
Cards Destroy
wait event
exit
:Cards
if @equal(%1,init)
# Cards Init
loadlib cards.dll
loadlib user32.dll
%%hdc = @lib(user32,GetDC,INT:,@strdel(@winexists(@dlgtext()),1,1))
freelib user32.dll
%8 = 10
%9 = 10
%z = @lib(cards.dll,cdtInit,INT:,@addr("%8"),@addr("%9"))
end
if @equal(%1,destroy)
# Cards Destroy
%z = @lib(cards.dll,cdtTerm,NIL:)
dialog add,TEXT,TEMPTEXTBLABLA,0,0,@dlgpos(,w),@dlgpos(,h)
dialog remove,TEMPTEXTBLABLA
freelib cards.dll
end
if @equal(%1,drawback)
# Cards Drawback,<x>,<y>,<image>
# <image>: 1 - 16
%z = @lib(cards.dll,cdtDraw,INT:,%%hdc,%2,%3,@sum(52,%4),1)
end
if @equal(%1,draw)
# Cards Draw,<x>,<y>,<type>,<which>
# <type>: clover, diamonds, hearts, spade
# <which>: A or 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, J, Q, K, A or 1
if @not(%2)@not(%3)@not(%4)@not(%5)
error 2
exit
end
if @equal(%4,clover)
%%BeginNumber = 0
elsif @equal(%4,diamonds)
%%BeginNumber = 1
elsif @equal(%4,hearts)
%%BeginNumber = 2
elsif @equal(%4,spade)
%%BeginNumber = 3
else
error 11
end
if @equal(%5,J)
%5 = 11
elsif @equal(%5,Q)
%5 = 12
elsif @equal(%5,K)
%5 = 13
elsif @equal(%5,A)
%5 = 1
else
if @not(@numeric(%5))
error 11
end
end
if @numeric(%5)
%%CardNumber = @sum(@prod(@pred(%5),4),%%BeginNumber)
else
error 11
end
%z = @lib(cards.dll,cdtDraw,INT:,%%hdc,%2,%3,%%CardNumber,0)
end
exit |
_________________ [ Add autocomplete functionality to your VDS IDE windows! ]
Voor Nederlandse beginners met VDS: bekijk ook eens deze tutorial! |
|