1998-07-24 15:43:32 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: card.h
|
|
|
|
// Purpose: Forty Thieves patience game
|
|
|
|
// Author: Chris Breeze
|
|
|
|
// Modified by:
|
|
|
|
// Created: 21/07/97
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Copyright: (c) 1993-1998 Chris Breeze
|
2004-06-02 05:14:59 -04:00
|
|
|
// Licence: wxWindows licence
|
1998-07-24 15:43:32 -04:00
|
|
|
//---------------------------------------------------------------------------
|
2004-05-25 07:20:37 -04:00
|
|
|
// Last modified: 22nd July 1998 - ported to wxWidgets 2.0
|
1998-07-24 15:43:32 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
//+-------------------------------------------------------------+
|
2004-06-02 05:14:59 -04:00
|
|
|
//| Description: |
|
|
|
|
//| A class for drawing playing cards. |
|
|
|
|
//| InitCards() must be called before using the Card class, |
|
|
|
|
//| otherwise the card bitmaps will not be loaded. |
|
|
|
|
//| CloseCards() must be called before terminating the |
|
|
|
|
//| program so that the bitmaps are deleted and the memory |
|
|
|
|
//| given back to Windows. |
|
1998-07-24 15:43:32 -04:00
|
|
|
//+-------------------------------------------------------------+
|
|
|
|
#ifndef _CARD_H_
|
|
|
|
#define _CARD_H_
|
|
|
|
|
2004-06-02 05:14:59 -04:00
|
|
|
// Constants
|
1998-07-24 15:43:32 -04:00
|
|
|
const int PackSize = 52;
|
2002-03-06 12:50:52 -05:00
|
|
|
|
|
|
|
#define CardHeight Card::GetHeight()
|
|
|
|
#define CardWidth Card::GetWidth()
|
1998-07-24 15:43:32 -04:00
|
|
|
|
2004-06-02 05:14:59 -04:00
|
|
|
// Data types
|
1998-07-24 15:43:32 -04:00
|
|
|
enum Suit { clubs = 0, diamonds = 1, hearts = 2, spades = 3 };
|
|
|
|
enum SuitColour { red = 0, black = 1 };
|
|
|
|
enum WayUp { faceup, facedown };
|
|
|
|
|
|
|
|
//--------------------------------//
|
|
|
|
// A class defining a single card //
|
|
|
|
//--------------------------------//
|
|
|
|
class Card {
|
2002-04-07 17:12:45 -04:00
|
|
|
friend class FortyApp;
|
|
|
|
|
|
|
|
static double m_scale;
|
|
|
|
static int m_width,m_height;
|
2002-03-06 12:50:52 -05:00
|
|
|
|
1998-07-24 15:43:32 -04:00
|
|
|
public:
|
2004-06-02 05:14:59 -04:00
|
|
|
Card(int value, WayUp way_up = facedown);
|
|
|
|
virtual ~Card();
|
1998-07-24 15:43:32 -04:00
|
|
|
|
2004-06-02 05:14:59 -04:00
|
|
|
void Draw(wxDC& pDC, int x, int y);
|
|
|
|
static void DrawNullCard(wxDC& pDC, int x, int y); // Draw card place-holder
|
|
|
|
void Erase(wxDC& pDC, int x, int y);
|
1998-07-24 15:43:32 -04:00
|
|
|
|
2004-06-02 05:14:59 -04:00
|
|
|
void TurnCard(WayUp way_up = faceup) { m_wayUp = way_up; }
|
|
|
|
WayUp GetWayUp() const { return m_wayUp; }
|
|
|
|
int GetPipValue() const { return m_pipValue; }
|
|
|
|
Suit GetSuit() const { return m_suit; }
|
|
|
|
SuitColour GetColour() const { return m_colour; }
|
|
|
|
static void SetScale(double scale);
|
|
|
|
static int GetHeight() { return m_height; };
|
|
|
|
static int GetWidth() { return m_width; };
|
|
|
|
static double GetScale() { return m_scale; };
|
1998-07-24 15:43:32 -04:00
|
|
|
|
|
|
|
private:
|
2004-06-02 05:14:59 -04:00
|
|
|
Suit m_suit;
|
|
|
|
int m_pipValue; // in the range 1 (Ace) to 13 (King)
|
|
|
|
SuitColour m_colour; // red or black
|
|
|
|
bool m_status;
|
|
|
|
WayUp m_wayUp;
|
1998-07-24 15:43:32 -04:00
|
|
|
|
2004-06-02 05:14:59 -04:00
|
|
|
static wxBitmap* m_symbolBmap;
|
|
|
|
static wxBitmap* m_pictureBmap;
|
1998-07-24 15:43:32 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // _CARD_H_
|