unit cards;
{ interface for CARDS.DLL, allows drawing cards on the screen for card games }
interface
type
DWORD = Integer;
ColorRef = DWORD;
HDC = Integer;
card_type = (ecsFront, ecsBack, ecsSelected, ecsEmpty, ecsErase,
ecsEmptyNB, ecsDrawX, ecsDrawO);
card_suit = (ecsClubs, ecsDiamonds, ecsHearts, ecsSpades);
card_name = (ecsAce, ecsTwo, ecsThree, ecsFour, ecsFive, ecsSix, ecsSeven,
ecsEight, ecsNine, ecsTen, ecsJack, ecsQueen, ecsKing);
const
cardsdll = 'CARDS.DLL';
{ card backs }
ecbCrossHatch = 53;
ecbWeave1 = 54;
ecbWeave2 = 55;
ecbRobot = 56;
ecbFlowers = 57;
ecbVine1 = 58;
ecbVine2 = 59;
ecbFish1 = 60;
ecbFish2 = 61;
ecbShells = 62;
ecbCastle = 63;
ecbIsland = 64;
ecbCardHand = 65;
ecbUnused = 66;
ecbThe_X = 67;
ecbThe_0 = 68;
var
carddimx, carddimy: integer; { default card dimensions for cdtDraw }
{ cdtInit initalizes cards, width is card width, height is card height }
function cdtInit(var width, height: Integer): boolean; stdcall;
{ cdtDraw draws a card on HDC at x, y, with descriptions afterward
face = 0 or 2, card front, 1 card back
card = card id (0-51) if type 0 or 2, card back (53-68) if type 1
color = background color for card back 53 (crosshatch) }
function cdtDraw(HDC_Canvas: HDC; x, y,
card: integer; ctype: card_type; color: ColorRef): boolean; stdcall;
{ same as cdtDraw, except dx and dy specify card dimensions }
function cdtDrawExt(HDC_Canvas: HDC; x, y, dx, dy,
card: integer; ctype: card_type; color: ColorRef): boolean; stdcall;
{ animate card backs - start with frame = 0 and increment until true }
function cdtAnimate(HDC_Canvas: HDC; cardback,
x, y, frame: integer): boolean; stdcall;
{ terminate processing }
procedure cdtTerm; stdcall;
function card_desc(incardname: card_name; insuit: card_suit): integer;
implementation
function card_desc(incardname: card_name; insuit: card_suit): integer;
{ get card value for descriptions, takes in suit and face,
and returns proper card #, for displaying specific cards }
begin
Result := Integer(incardname) + (Integer(insuit) * 4);
end;
function cdtInit; external cardsdll name 'cdtInit';
function cdtdraw; external cardsdll name 'cdtDraw';
function cdtdrawext; external cardsdll name 'cdtDrawExt';
function cdtAnimate; external cardsdll name 'cdtAnimate';
procedure cdtTerm; external cardsdll name 'cdtTerm';
initialization
cdtInit(carddimx, carddimy);
finalization
cdtTerm;
end.