]>
git.saurik.com Git - wxWidgets.git/blob - demos/forty/card.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: Forty Thieves patience game
4 // Author: Chris Breeze
8 // Copyright: (c) 1993-1998 Chris Breeze
9 // Licence: wxWindows licence
10 //---------------------------------------------------------------------------
11 // Last modified: 22nd July 1998 - ported to wxWindows 2.0
12 /////////////////////////////////////////////////////////////////////////////
13 //+-------------------------------------------------------------+
15 //| A class for drawing playing cards. |
16 //| InitCards() must be called before using the Card class, |
17 //| otherwise the card bitmaps will not be loaded. |
18 //| CloseCards() must be called before terminating the |
19 //| program so that the bitmaps are deleted and the memory |
20 //| given back to Windows. |
21 //+-------------------------------------------------------------+
26 const int PackSize
= 52;
28 #define CardHeight Card::GetHeight()
29 #define CardWidth Card::GetWidth()
32 enum Suit
{ clubs
= 0, diamonds
= 1, hearts
= 2, spades
= 3 };
33 enum SuitColour
{ red
= 0, black
= 1 };
34 enum WayUp
{ faceup
, facedown
};
37 //--------------------------------//
38 // A class defining a single card //
39 //--------------------------------//
41 static double m_scale
;
42 static int m_width
,m_height
;
45 Card(int value
, WayUp way_up
= facedown
);
48 void Draw(wxDC
& pDC
, int x
, int y
);
49 static void DrawNullCard(wxDC
& pDC
, int x
, int y
); // Draw card place-holder
50 void Erase(wxDC
& pDC
, int x
, int y
);
52 void TurnCard(WayUp way_up
= faceup
) { m_wayUp
= way_up
; }
53 WayUp
GetWayUp() const { return m_wayUp
; }
54 int GetPipValue() const { return m_pipValue
; }
55 Suit
GetSuit() const { return m_suit
; }
56 SuitColour
GetColour() const { return m_colour
; }
57 static void SetScale(double scale
);
58 static int GetHeight() { return m_height
; };
59 static int GetWidth() { return m_width
; };
60 static double GetScale() { return m_scale
; };
64 int m_pipValue
; // in the range 1 (Ace) to 13 (King)
65 SuitColour m_colour
; // red or black
69 static wxBitmap
* m_symbolBmap
;
70 static wxBitmap
* m_pictureBmap
;