]>
Commit | Line | Data |
---|---|---|
63cafd27 JS |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: card.h | |
3 | // Purpose: Forty Thieves patience game | |
4 | // Author: Chris Breeze | |
5 | // Modified by: | |
6 | // Created: 21/07/97 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) 1993-1998 Chris Breeze | |
010216e3 | 9 | // Licence: wxWindows licence |
63cafd27 | 10 | //--------------------------------------------------------------------------- |
be5a51fb | 11 | // Last modified: 22nd July 1998 - ported to wxWidgets 2.0 |
63cafd27 JS |
12 | ///////////////////////////////////////////////////////////////////////////// |
13 | //+-------------------------------------------------------------+ | |
010216e3 WS |
14 | //| Description: | |
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. | | |
63cafd27 JS |
21 | //+-------------------------------------------------------------+ |
22 | #ifndef _CARD_H_ | |
23 | #define _CARD_H_ | |
24 | ||
010216e3 | 25 | // Constants |
63cafd27 | 26 | const int PackSize = 52; |
fc799548 JS |
27 | |
28 | #define CardHeight Card::GetHeight() | |
29 | #define CardWidth Card::GetWidth() | |
63cafd27 | 30 | |
010216e3 | 31 | // Data types |
63cafd27 JS |
32 | enum Suit { clubs = 0, diamonds = 1, hearts = 2, spades = 3 }; |
33 | enum SuitColour { red = 0, black = 1 }; | |
34 | enum WayUp { faceup, facedown }; | |
35 | ||
63cafd27 JS |
36 | //--------------------------------// |
37 | // A class defining a single card // | |
38 | //--------------------------------// | |
39 | class Card { | |
15bee36f JS |
40 | friend class FortyApp; |
41 | ||
42 | static double m_scale; | |
43 | static int m_width,m_height; | |
fc799548 | 44 | |
63cafd27 | 45 | public: |
010216e3 | 46 | Card(int value, WayUp way_up = facedown); |
254a2129 | 47 | virtual ~Card(){}; |
63cafd27 | 48 | |
010216e3 WS |
49 | void Draw(wxDC& pDC, int x, int y); |
50 | static void DrawNullCard(wxDC& pDC, int x, int y); // Draw card place-holder | |
51 | void Erase(wxDC& pDC, int x, int y); | |
63cafd27 | 52 | |
010216e3 WS |
53 | void TurnCard(WayUp way_up = faceup) { m_wayUp = way_up; } |
54 | WayUp GetWayUp() const { return m_wayUp; } | |
55 | int GetPipValue() const { return m_pipValue; } | |
56 | Suit GetSuit() const { return m_suit; } | |
57 | SuitColour GetColour() const { return m_colour; } | |
58 | static void SetScale(double scale); | |
59 | static int GetHeight() { return m_height; }; | |
60 | static int GetWidth() { return m_width; }; | |
61 | static double GetScale() { return m_scale; }; | |
63cafd27 JS |
62 | |
63 | private: | |
010216e3 WS |
64 | Suit m_suit; |
65 | int m_pipValue; // in the range 1 (Ace) to 13 (King) | |
66 | SuitColour m_colour; // red or black | |
67 | bool m_status; | |
68 | WayUp m_wayUp; | |
63cafd27 | 69 | |
010216e3 WS |
70 | static wxBitmap* m_symbolBmap; |
71 | static wxBitmap* m_pictureBmap; | |
63cafd27 JS |
72 | }; |
73 | ||
74 | #endif // _CARD_H_ |