]> git.saurik.com Git - wxWidgets.git/blame - demos/forty/card.h
Avoid dropping events in wxDocParentFrameAnyBase in some circumstances.
[wxWidgets.git] / demos / forty / card.h
CommitLineData
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
63cafd27 7// Copyright: (c) 1993-1998 Chris Breeze
010216e3 8// Licence: wxWindows licence
63cafd27 9//---------------------------------------------------------------------------
be5a51fb 10// Last modified: 22nd July 1998 - ported to wxWidgets 2.0
63cafd27
JS
11/////////////////////////////////////////////////////////////////////////////
12//+-------------------------------------------------------------+
010216e3
WS
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. |
63cafd27
JS
20//+-------------------------------------------------------------+
21#ifndef _CARD_H_
22#define _CARD_H_
23
010216e3 24// Constants
63cafd27 25const int PackSize = 52;
fc799548
JS
26
27#define CardHeight Card::GetHeight()
28#define CardWidth Card::GetWidth()
63cafd27 29
010216e3 30// Data types
63cafd27
JS
31enum Suit { clubs = 0, diamonds = 1, hearts = 2, spades = 3 };
32enum SuitColour { red = 0, black = 1 };
33enum WayUp { faceup, facedown };
34
63cafd27
JS
35//--------------------------------//
36// A class defining a single card //
37//--------------------------------//
38class Card {
15bee36f
JS
39 friend class FortyApp;
40
41 static double m_scale;
42 static int m_width,m_height;
fc799548 43
63cafd27 44public:
010216e3 45 Card(int value, WayUp way_up = facedown);
254a2129 46 virtual ~Card(){};
63cafd27 47
010216e3
WS
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);
63cafd27 51
010216e3
WS
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; };
63cafd27
JS
61
62private:
010216e3
WS
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;
63cafd27 68
010216e3
WS
69 static wxBitmap* m_symbolBmap;
70 static wxBitmap* m_pictureBmap;
63cafd27
JS
71};
72
73#endif // _CARD_H_