]> git.saurik.com Git - wxWidgets.git/blob - demos/forty/card.h
wxDialogBase only has one ctor, so just do initialization in ctor instead of Init()
[wxWidgets.git] / demos / forty / card.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: card.h
3 // Purpose: Forty Thieves patience game
4 // Author: Chris Breeze
5 // Modified by:
6 // Created: 21/07/97
7 // Copyright: (c) 1993-1998 Chris Breeze
8 // Licence: wxWindows licence
9 //---------------------------------------------------------------------------
10 // Last modified: 22nd July 1998 - ported to wxWidgets 2.0
11 /////////////////////////////////////////////////////////////////////////////
12 //+-------------------------------------------------------------+
13 //| Description: |
14 //| A class for drawing playing cards. |
15 //| InitCards() must be called before using the Card class, |
16 //| otherwise the card bitmaps will not be loaded. |
17 //| CloseCards() must be called before terminating the |
18 //| program so that the bitmaps are deleted and the memory |
19 //| given back to Windows. |
20 //+-------------------------------------------------------------+
21 #ifndef _CARD_H_
22 #define _CARD_H_
23
24 // Constants
25 const int PackSize = 52;
26
27 #define CardHeight Card::GetHeight()
28 #define CardWidth Card::GetWidth()
29
30 // Data types
31 enum Suit { clubs = 0, diamonds = 1, hearts = 2, spades = 3 };
32 enum SuitColour { red = 0, black = 1 };
33 enum WayUp { faceup, facedown };
34
35 //--------------------------------//
36 // A class defining a single card //
37 //--------------------------------//
38 class Card {
39 friend class FortyApp;
40
41 static double m_scale;
42 static int m_width,m_height;
43
44 public:
45 Card(int value, WayUp way_up = facedown);
46 virtual ~Card(){};
47
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);
51
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; };
61
62 private:
63 Suit m_suit;
64 int m_pipValue; // in the range 1 (Ace) to 13 (King)
65 SuitColour m_colour; // red or black
66 bool m_status;
67 WayUp m_wayUp;
68
69 static wxBitmap* m_symbolBmap;
70 static wxBitmap* m_pictureBmap;
71 };
72
73 #endif // _CARD_H_