]> git.saurik.com Git - wxWidgets.git/blob - samples/forty/card.h
old makefiles removed
[wxWidgets.git] / samples / 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 // RCS-ID: $Id$
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 //+-------------------------------------------------------------+
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. |
21 //+-------------------------------------------------------------+
22 #ifndef _CARD_H_
23 #define _CARD_H_
24
25 // Constants
26 const int PackSize = 52;
27 const int CardWidth = 50;
28 const int CardHeight = 70;
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 //--------------------------------//
37 // A class defining a single card //
38 //--------------------------------//
39 class Card {
40 public:
41 Card(int value, WayUp way_up = facedown);
42 virtual ~Card();
43
44 void Draw(wxDC& pDC, int x, int y);
45 static void DrawNullCard(wxDC& pDC, int x, int y); // Draw card place-holder
46 void Erase(wxDC& pDC, int x, int y);
47
48 void TurnCard(WayUp way_up = faceup) { m_wayUp = way_up; }
49 WayUp GetWayUp() const { return m_wayUp; }
50 int GetPipValue() const { return m_pipValue; }
51 Suit GetSuit() const { return m_suit; }
52 SuitColour GetColour() const { return m_colour; }
53
54 private:
55 Suit m_suit;
56 int m_pipValue; // in the range 1 (Ace) to 13 (King)
57 SuitColour m_colour; // red or black
58 bool m_status;
59 WayUp m_wayUp;
60
61 static wxBitmap* m_symbolBmap;
62 static wxBitmap* m_pictureBmap;
63 };
64
65 #endif // _CARD_H_