1998-07-24 15:43:32 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: card.cpp
|
|
|
|
// Purpose: Forty Thieves patience game
|
|
|
|
// Author: Chris Breeze
|
|
|
|
// Modified by:
|
|
|
|
// Created: 21/07/97
|
|
|
|
// 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
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
//+-------------------------------------------------------------+
|
1998-07-27 16:50:48 -04:00
|
|
|
//| Description
|
2004-06-02 05:14:59 -04:00
|
|
|
//| A class for drawing playing cards.
|
|
|
|
//| Currently assumes that the card symbols have been
|
|
|
|
//| loaded into hbmap_symbols and the pictures for the
|
|
|
|
//| Jack, Queen and King have been loaded into
|
|
|
|
//| hbmap_pictures.
|
1998-07-24 15:43:32 -04:00
|
|
|
//+-------------------------------------------------------------+
|
|
|
|
|
|
|
|
// For compilers that support precompilation, includes "wx/wx.h".
|
|
|
|
#include "wx/wxprec.h"
|
|
|
|
|
|
|
|
#ifdef __BORLANDC__
|
|
|
|
#pragma hdrstop
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef WX_PRECOMP
|
|
|
|
#include "wx/wx.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include "forty.h"
|
|
|
|
#include "card.h"
|
|
|
|
|
|
|
|
#include "pictures.xpm"
|
2006-03-28 06:12:48 -05:00
|
|
|
#include "symbols.xpm"
|
1998-07-24 15:43:32 -04:00
|
|
|
|
|
|
|
wxBitmap* Card::m_pictureBmap = 0;
|
|
|
|
wxBitmap* Card::m_symbolBmap = 0;
|
|
|
|
|
2002-03-06 12:50:52 -05:00
|
|
|
double Card::m_scale = 1.0;
|
|
|
|
int Card::m_width = 50;
|
|
|
|
int Card::m_height = 70;
|
1998-07-24 15:43:32 -04:00
|
|
|
|
|
|
|
//+-------------------------------------------------------------+
|
2004-06-02 05:14:59 -04:00
|
|
|
//| Card::Card() |
|
1998-07-24 15:43:32 -04:00
|
|
|
//+-------------------------------------------------------------+
|
2004-06-02 05:14:59 -04:00
|
|
|
//| Description: |
|
|
|
|
//| Constructor for a playing card. |
|
|
|
|
//| Checks that the value is in the range 1..52 and then |
|
|
|
|
//| initialises the suit, colour, pipValue and wayUp. |
|
1998-07-24 15:43:32 -04:00
|
|
|
//+-------------------------------------------------------------+
|
|
|
|
Card::Card(int value, WayUp way_up) :
|
2004-06-02 05:14:59 -04:00
|
|
|
m_wayUp(way_up)
|
1998-07-24 15:43:32 -04:00
|
|
|
{
|
2004-06-02 05:14:59 -04:00
|
|
|
if (!m_symbolBmap)
|
|
|
|
{
|
2006-03-28 06:12:48 -05:00
|
|
|
m_symbolBmap = new wxBitmap(symbols_xpm);
|
2011-05-03 12:29:04 -04:00
|
|
|
if (!m_symbolBmap->IsOk())
|
2004-06-02 05:14:59 -04:00
|
|
|
{
|
2009-07-23 16:30:22 -04:00
|
|
|
::wxMessageBox(wxT("Failed to load bitmap CardSymbols"), wxT("Error"));
|
2004-06-02 05:14:59 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!m_pictureBmap)
|
|
|
|
{
|
|
|
|
m_pictureBmap = new wxBitmap(Pictures);
|
2011-05-03 12:29:04 -04:00
|
|
|
if (!m_pictureBmap->IsOk())
|
2004-06-02 05:14:59 -04:00
|
|
|
{
|
2009-07-23 16:30:22 -04:00
|
|
|
::wxMessageBox(wxT("Failed to load bitmap CardPictures"), wxT("Error"));
|
2004-06-02 05:14:59 -04:00
|
|
|
}
|
|
|
|
}
|
1998-07-24 15:43:32 -04:00
|
|
|
|
|
|
|
if (value >= 1 && value <= PackSize)
|
|
|
|
{
|
2004-06-02 05:14:59 -04:00
|
|
|
switch ((value - 1) / 13)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
m_suit = clubs;
|
|
|
|
m_colour = black;
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
m_suit = diamonds;
|
|
|
|
m_colour = red;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
m_suit = hearts;
|
|
|
|
m_colour = red;
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
m_suit = spades;
|
|
|
|
m_colour = black;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
m_pipValue = 1 + (value - 1) % 13;
|
|
|
|
m_status = true;
|
1998-07-24 15:43:32 -04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2004-03-23 16:23:17 -05:00
|
|
|
m_status = false;
|
1998-07-24 15:43:32 -04:00
|
|
|
}
|
|
|
|
} // Card::Card()
|
|
|
|
|
|
|
|
|
2002-03-06 12:50:52 -05:00
|
|
|
//+-------------------------------------------------------------+
|
2004-06-02 05:14:59 -04:00
|
|
|
//| Card::SetScale() |
|
2002-03-06 12:50:52 -05:00
|
|
|
//+-------------------------------------------------------------+
|
2004-06-02 05:14:59 -04:00
|
|
|
//| Description: |
|
|
|
|
//| Scales the cards |
|
2002-03-06 12:50:52 -05:00
|
|
|
//+-------------------------------------------------------------+
|
|
|
|
void Card::SetScale(double scale)
|
|
|
|
{
|
|
|
|
m_scale = scale;
|
|
|
|
m_width = int(50*scale);
|
|
|
|
m_height = int(70*scale);
|
|
|
|
}
|
|
|
|
|
1998-07-24 15:43:32 -04:00
|
|
|
//+-------------------------------------------------------------+
|
2004-06-02 05:14:59 -04:00
|
|
|
//| Card::Erase() |
|
1998-07-24 15:43:32 -04:00
|
|
|
//+-------------------------------------------------------------+
|
2004-06-02 05:14:59 -04:00
|
|
|
//| Description: |
|
|
|
|
//| Erase the card at (x, y) by drawing a rectangle in the |
|
|
|
|
//| background colour. |
|
1998-07-24 15:43:32 -04:00
|
|
|
//+-------------------------------------------------------------+
|
|
|
|
void Card::Erase(wxDC& dc, int x, int y)
|
|
|
|
{
|
2004-06-02 05:14:59 -04:00
|
|
|
wxPen* pen = wxThePenList->FindOrCreatePen(
|
2017-11-25 11:39:44 -05:00
|
|
|
FortyApp::BackgroundColour()
|
2004-06-02 05:14:59 -04:00
|
|
|
);
|
|
|
|
dc.SetPen(* pen);
|
|
|
|
dc.SetBrush(FortyApp::BackgroundBrush());
|
2002-03-06 12:50:52 -05:00
|
|
|
dc.DrawRectangle(x, y, m_width, m_height);
|
1998-07-24 15:43:32 -04:00
|
|
|
} // Card::Erase()
|
|
|
|
|
|
|
|
|
|
|
|
//+-------------------------------------------------------------+
|
2004-06-02 05:14:59 -04:00
|
|
|
//| Card::Draw() |
|
1998-07-24 15:43:32 -04:00
|
|
|
//+-------------------------------------------------------------+
|
2004-06-02 05:14:59 -04:00
|
|
|
//| Description: |
|
|
|
|
//| Draw the card at (x, y). |
|
|
|
|
//| If the card is facedown draw the back of the card. |
|
|
|
|
//| If the card is faceup draw the front of the card. |
|
|
|
|
//| Cards are not held in bitmaps, instead they are drawn |
|
|
|
|
//| from their constituent parts when required. |
|
|
|
|
//| hbmap_symbols contains large and small suit symbols and |
|
|
|
|
//| pip values. These are copied to the appropriate part of |
|
|
|
|
//| the card. Picture cards use the pictures defined in |
|
|
|
|
//| hbmap_pictures. Note that only one picture is defined |
|
|
|
|
//| for the Jack, Queen and King, unlike a real pack where |
|
|
|
|
//| each suit is different. |
|
|
|
|
//| |
|
|
|
|
//| WARNING: |
|
|
|
|
//| The locations of these symbols is 'hard-wired' into the |
|
|
|
|
//| code. Editing the bitmaps or the numbers below will |
|
|
|
|
//| result in the wrong symbols being displayed. |
|
1998-07-24 15:43:32 -04:00
|
|
|
//+-------------------------------------------------------------+
|
|
|
|
void Card::Draw(wxDC& dc, int x, int y)
|
|
|
|
{
|
2004-06-02 05:14:59 -04:00
|
|
|
wxBrush backgroundBrush( dc.GetBackground() );
|
|
|
|
dc.SetBrush(* wxWHITE_BRUSH);
|
|
|
|
dc.SetPen(* wxBLACK_PEN);
|
2002-03-06 12:50:52 -05:00
|
|
|
dc.DrawRoundedRectangle(x, y, m_width, m_height, 4);
|
2004-06-02 05:14:59 -04:00
|
|
|
if (m_wayUp == facedown)
|
|
|
|
{
|
|
|
|
dc.SetBackground(* wxRED_BRUSH);
|
2018-11-25 14:22:35 -05:00
|
|
|
dc.SetBackgroundMode(wxBRUSHSTYLE_SOLID);
|
2004-06-02 05:14:59 -04:00
|
|
|
wxBrush* brush = wxTheBrushList->FindOrCreateBrush(
|
2017-11-25 11:39:44 -05:00
|
|
|
*wxBLACK, wxBRUSHSTYLE_CROSSDIAG_HATCH
|
2004-06-02 05:14:59 -04:00
|
|
|
);
|
|
|
|
dc.SetBrush(* brush);
|
|
|
|
|
|
|
|
dc.DrawRoundedRectangle(
|
|
|
|
x + 4, y + 4,
|
|
|
|
m_width - 8, m_height - 8,
|
|
|
|
2
|
|
|
|
);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
wxMemoryDC memoryDC;
|
|
|
|
|
|
|
|
memoryDC.SelectObject(*m_symbolBmap);
|
|
|
|
|
2018-11-25 14:22:35 -05:00
|
|
|
// dc.SetBackgroundMode(wxBRUSHSTYLE_TRANSPARENT);
|
2004-06-02 05:14:59 -04:00
|
|
|
|
|
|
|
dc.SetTextBackground(*wxWHITE);
|
|
|
|
switch (m_suit)
|
|
|
|
{
|
|
|
|
case spades:
|
|
|
|
case clubs:
|
|
|
|
dc.SetTextForeground(*wxBLACK);
|
|
|
|
break;
|
|
|
|
case diamonds:
|
|
|
|
case hearts:
|
|
|
|
dc.SetTextForeground(*wxRED);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
int symsize = 11;
|
|
|
|
int sympos = 14;
|
|
|
|
int sympos2 = 25;
|
|
|
|
int symdist = 5;
|
|
|
|
int symdist2 = 6;
|
|
|
|
|
|
|
|
int pipsize,pippos,valueheight,valuewidth;
|
|
|
|
int valuepos;
|
|
|
|
if (m_scale > 1.2)
|
|
|
|
{
|
|
|
|
pipsize = symsize;
|
|
|
|
pippos = sympos;
|
|
|
|
valueheight = 10;
|
|
|
|
valuewidth = 9;
|
|
|
|
valuepos = 50;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pipsize = 7;
|
|
|
|
pippos = 0;
|
|
|
|
valueheight = 7;
|
|
|
|
valuewidth = 6;
|
|
|
|
valuepos = 36;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Draw the value
|
|
|
|
dc.Blit((wxCoord)(x + m_scale*3),
|
|
|
|
(wxCoord)(y + m_scale*3),
|
2004-10-05 11:38:40 -04:00
|
|
|
valuewidth,
|
2004-06-02 05:14:59 -04:00
|
|
|
valueheight,
|
2004-10-05 11:38:40 -04:00
|
|
|
&memoryDC,
|
|
|
|
valuewidth * (m_pipValue - 1),
|
|
|
|
valuepos,
|
2004-06-02 05:14:59 -04:00
|
|
|
wxCOPY);
|
2004-10-05 11:38:40 -04:00
|
|
|
dc.Blit((wxCoord)(x + m_width - m_scale*3 - valuewidth),
|
2004-06-02 05:14:59 -04:00
|
|
|
(wxCoord)(y + m_height - valueheight - m_scale*3),
|
2004-10-05 11:38:40 -04:00
|
|
|
valuewidth,
|
2004-06-02 05:14:59 -04:00
|
|
|
valueheight,
|
2004-10-05 11:38:40 -04:00
|
|
|
&memoryDC,
|
|
|
|
valuewidth * (m_pipValue - 1),
|
|
|
|
valuepos+valueheight,
|
2004-06-02 05:14:59 -04:00
|
|
|
wxCOPY);
|
|
|
|
|
|
|
|
// Draw the pips
|
2004-10-05 11:38:40 -04:00
|
|
|
dc.Blit((wxCoord)(x + m_scale*3 + valuewidth+2),
|
|
|
|
(wxCoord)(y + m_scale*3),
|
2004-06-02 05:14:59 -04:00
|
|
|
pipsize,
|
2004-10-05 11:38:40 -04:00
|
|
|
pipsize,
|
|
|
|
&memoryDC,
|
|
|
|
pipsize * m_suit,
|
|
|
|
pippos,
|
2004-06-02 05:14:59 -04:00
|
|
|
wxCOPY);
|
2004-10-05 11:38:40 -04:00
|
|
|
dc.Blit((wxCoord)(x + m_width - m_scale*3-valuewidth-pipsize-2),
|
2004-06-02 05:14:59 -04:00
|
|
|
(wxCoord)(y + m_height - pipsize - m_scale*3),
|
|
|
|
pipsize,
|
2004-10-05 11:38:40 -04:00
|
|
|
pipsize,
|
|
|
|
&memoryDC,
|
|
|
|
pipsize * m_suit,
|
|
|
|
pipsize+pippos,
|
2004-06-02 05:14:59 -04:00
|
|
|
wxCOPY);
|
|
|
|
|
|
|
|
switch (m_pipValue)
|
|
|
|
{
|
|
|
|
case 1:
|
2004-10-05 11:38:40 -04:00
|
|
|
dc.Blit((wxCoord)(x - symdist + m_width / 2),
|
|
|
|
(wxCoord)(y - m_scale*5 + m_height / 2),
|
|
|
|
symsize,
|
2004-06-02 05:14:59 -04:00
|
|
|
symsize,
|
2004-10-05 11:38:40 -04:00
|
|
|
&memoryDC,
|
|
|
|
symsize * m_suit,
|
|
|
|
sympos,
|
2004-06-02 05:14:59 -04:00
|
|
|
wxCOPY);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 3:
|
2004-10-05 11:38:40 -04:00
|
|
|
dc.Blit((wxCoord)(x - symdist + m_width / 2),
|
|
|
|
(wxCoord)(y - symdist + m_height / 2),
|
2004-06-02 05:14:59 -04:00
|
|
|
symsize,
|
2004-10-05 11:38:40 -04:00
|
|
|
symsize,
|
|
|
|
&memoryDC,
|
|
|
|
symsize * m_suit,
|
|
|
|
sympos,
|
2004-06-02 05:14:59 -04:00
|
|
|
wxCOPY);
|
2017-11-25 11:39:44 -05:00
|
|
|
wxFALLTHROUGH;
|
2004-06-02 05:14:59 -04:00
|
|
|
case 2:
|
|
|
|
dc.Blit((wxCoord)(x - symdist + m_width / 2),
|
2004-10-05 11:38:40 -04:00
|
|
|
(wxCoord)(y - symdist + m_height / 4),
|
|
|
|
symsize,
|
2004-06-02 05:14:59 -04:00
|
|
|
symsize,
|
2004-10-05 11:38:40 -04:00
|
|
|
&memoryDC,
|
|
|
|
symsize * m_suit,
|
|
|
|
sympos,
|
2004-06-02 05:14:59 -04:00
|
|
|
wxCOPY);
|
|
|
|
dc.Blit((wxCoord)(x - symdist + m_width / 2),
|
2004-10-05 11:38:40 -04:00
|
|
|
(wxCoord)(y - symdist + 3 * m_height / 4),
|
|
|
|
symsize,
|
2004-06-02 05:14:59 -04:00
|
|
|
symsize,
|
2004-10-05 11:38:40 -04:00
|
|
|
&memoryDC,
|
|
|
|
symsize * m_suit,
|
|
|
|
sympos2,
|
2004-06-02 05:14:59 -04:00
|
|
|
wxCOPY);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 5:
|
2004-10-05 11:38:40 -04:00
|
|
|
dc.Blit((wxCoord)(x - symdist + m_width / 2),
|
|
|
|
(wxCoord)(y - symdist + m_height / 2),
|
|
|
|
symsize,
|
2004-06-02 05:14:59 -04:00
|
|
|
symsize,
|
2004-10-05 11:38:40 -04:00
|
|
|
&memoryDC,
|
|
|
|
symsize * m_suit,
|
|
|
|
sympos,
|
2004-06-02 05:14:59 -04:00
|
|
|
wxCOPY);
|
2017-11-25 11:39:44 -05:00
|
|
|
wxFALLTHROUGH;
|
2004-06-02 05:14:59 -04:00
|
|
|
case 4:
|
|
|
|
dc.Blit((wxCoord)(x - symdist + m_width / 4),
|
2004-10-05 11:38:40 -04:00
|
|
|
(wxCoord)(y - symdist + m_height / 4),
|
|
|
|
symsize,
|
2004-06-02 05:14:59 -04:00
|
|
|
symsize,
|
2004-10-05 11:38:40 -04:00
|
|
|
&memoryDC,
|
|
|
|
symsize * m_suit,
|
|
|
|
sympos,
|
2004-06-02 05:14:59 -04:00
|
|
|
wxCOPY);
|
|
|
|
dc.Blit((wxCoord)(x - symdist + m_width / 4),
|
2004-10-05 11:38:40 -04:00
|
|
|
(wxCoord)(y - symdist + 3 * m_height / 4),
|
2004-06-02 05:14:59 -04:00
|
|
|
symsize,
|
2004-10-05 11:38:40 -04:00
|
|
|
symsize,
|
|
|
|
&memoryDC,
|
|
|
|
symsize * m_suit,
|
|
|
|
sympos2,
|
2004-06-02 05:14:59 -04:00
|
|
|
wxCOPY);
|
|
|
|
dc.Blit((wxCoord)(x - symdist + 3 * m_width / 4),
|
2004-10-05 11:38:40 -04:00
|
|
|
(wxCoord)(y - symdist + m_height / 4),
|
|
|
|
symsize,
|
2004-06-02 05:14:59 -04:00
|
|
|
symsize,
|
2004-10-05 11:38:40 -04:00
|
|
|
&memoryDC,
|
|
|
|
symsize * m_suit,
|
|
|
|
sympos,
|
2004-06-02 05:14:59 -04:00
|
|
|
wxCOPY);
|
|
|
|
dc.Blit((wxCoord)(x - symdist + 3 * m_width / 4),
|
2004-10-05 11:38:40 -04:00
|
|
|
(wxCoord)(y - symdist + 3 * m_height / 4),
|
2004-06-02 05:14:59 -04:00
|
|
|
symsize,
|
2004-10-05 11:38:40 -04:00
|
|
|
symsize,
|
|
|
|
&memoryDC,
|
|
|
|
symsize * m_suit,
|
|
|
|
sympos2,
|
2004-06-02 05:14:59 -04:00
|
|
|
wxCOPY);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 8:
|
|
|
|
dc.Blit((wxCoord)(x - symdist + 5 * m_width / 10),
|
2004-10-05 11:38:40 -04:00
|
|
|
(wxCoord)(y - symdist + 5 * m_height / 8),
|
|
|
|
symsize,
|
2004-06-02 05:14:59 -04:00
|
|
|
symsize,
|
2004-10-05 11:38:40 -04:00
|
|
|
&memoryDC,
|
|
|
|
symsize * m_suit,
|
|
|
|
sympos2,
|
2004-06-02 05:14:59 -04:00
|
|
|
wxCOPY);
|
2017-11-25 11:39:44 -05:00
|
|
|
wxFALLTHROUGH;
|
2004-06-02 05:14:59 -04:00
|
|
|
case 7:
|
|
|
|
dc.Blit((wxCoord)(x - symdist + 5 * m_width / 10),
|
2004-10-05 11:38:40 -04:00
|
|
|
(wxCoord)(y - symdist + 3 * m_height / 8),
|
|
|
|
symsize,
|
2004-06-02 05:14:59 -04:00
|
|
|
symsize,
|
2004-10-05 11:38:40 -04:00
|
|
|
&memoryDC,
|
|
|
|
symsize * m_suit,
|
|
|
|
sympos,
|
2004-06-02 05:14:59 -04:00
|
|
|
wxCOPY);
|
2017-11-25 11:39:44 -05:00
|
|
|
wxFALLTHROUGH;
|
2004-06-02 05:14:59 -04:00
|
|
|
case 6:
|
|
|
|
dc.Blit((wxCoord)(x - symdist + m_width / 4),
|
2004-10-05 11:38:40 -04:00
|
|
|
(wxCoord)(y - symdist + m_height / 4),
|
|
|
|
symsize,
|
2004-06-02 05:14:59 -04:00
|
|
|
symsize,
|
|
|
|
&memoryDC, symsize * m_suit, sympos, wxCOPY);
|
|
|
|
dc.Blit((wxCoord)(x - symdist + m_width / 4),
|
2004-10-05 11:38:40 -04:00
|
|
|
(wxCoord)(y - symdist + m_height / 2),
|
|
|
|
symsize,
|
2004-06-02 05:14:59 -04:00
|
|
|
symsize,
|
2004-10-05 11:38:40 -04:00
|
|
|
&memoryDC,
|
|
|
|
symsize * m_suit,
|
|
|
|
sympos,
|
2004-06-02 05:14:59 -04:00
|
|
|
wxCOPY);
|
|
|
|
dc.Blit((wxCoord)(x - symdist + m_width / 4),
|
2004-10-05 11:38:40 -04:00
|
|
|
(wxCoord)(y - symdist + 3 * m_height / 4),
|
|
|
|
symsize,
|
2004-06-02 05:14:59 -04:00
|
|
|
symsize,
|
2004-10-05 11:38:40 -04:00
|
|
|
&memoryDC,
|
|
|
|
symsize * m_suit,
|
|
|
|
sympos2,
|
2004-06-02 05:14:59 -04:00
|
|
|
wxCOPY);
|
|
|
|
dc.Blit((wxCoord)(x - symdist + 3 * m_width / 4),
|
2004-10-05 11:38:40 -04:00
|
|
|
(wxCoord)(y - symdist + m_height / 4),
|
2004-06-02 05:14:59 -04:00
|
|
|
symsize,
|
2004-10-05 11:38:40 -04:00
|
|
|
symsize,
|
|
|
|
&memoryDC,
|
|
|
|
symsize * m_suit,
|
|
|
|
sympos,
|
2004-06-02 05:14:59 -04:00
|
|
|
wxCOPY);
|
|
|
|
dc.Blit((wxCoord)(x - symdist + 3 * m_width / 4),
|
2004-10-05 11:38:40 -04:00
|
|
|
(wxCoord)(y - symdist + m_height / 2),
|
|
|
|
symsize,
|
2004-06-02 05:14:59 -04:00
|
|
|
symsize,
|
2004-10-05 11:38:40 -04:00
|
|
|
&memoryDC,
|
|
|
|
symsize * m_suit,
|
|
|
|
sympos,
|
2004-06-02 05:14:59 -04:00
|
|
|
wxCOPY);
|
|
|
|
dc.Blit((wxCoord)(x - symdist + 3 * m_width / 4),
|
2004-10-05 11:38:40 -04:00
|
|
|
(wxCoord)(y - symdist + 3 * m_height / 4),
|
|
|
|
symsize,
|
2004-06-02 05:14:59 -04:00
|
|
|
symsize,
|
2004-10-05 11:38:40 -04:00
|
|
|
&memoryDC,
|
|
|
|
symsize * m_suit,
|
|
|
|
sympos2,
|
2004-06-02 05:14:59 -04:00
|
|
|
wxCOPY);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 10:
|
|
|
|
dc.Blit((wxCoord)(x - symdist + m_width / 2),
|
2004-10-05 11:38:40 -04:00
|
|
|
(wxCoord)(y - symdist + 2 * m_height / 3),
|
2004-06-02 05:14:59 -04:00
|
|
|
symsize,
|
2004-10-05 11:38:40 -04:00
|
|
|
symsize,
|
|
|
|
&memoryDC,
|
|
|
|
symsize * m_suit,
|
|
|
|
sympos2,
|
2004-06-02 05:14:59 -04:00
|
|
|
wxCOPY);
|
2017-11-25 11:39:44 -05:00
|
|
|
wxFALLTHROUGH;
|
2004-06-02 05:14:59 -04:00
|
|
|
case 9:
|
|
|
|
dc.Blit((wxCoord)(x - symdist + m_width / 4),
|
2004-10-05 11:38:40 -04:00
|
|
|
(wxCoord)(y - symdist2 + m_height / 4),
|
|
|
|
symsize,
|
2004-06-02 05:14:59 -04:00
|
|
|
symsize,
|
2004-10-05 11:38:40 -04:00
|
|
|
&memoryDC,
|
|
|
|
symsize * m_suit,
|
|
|
|
sympos,
|
2004-06-02 05:14:59 -04:00
|
|
|
wxCOPY);
|
|
|
|
dc.Blit((wxCoord)(x - symdist + m_width / 4),
|
2004-10-05 11:38:40 -04:00
|
|
|
(wxCoord)(y - symdist2 + 5 * m_height / 12),
|
2004-06-02 05:14:59 -04:00
|
|
|
symsize,
|
2004-10-05 11:38:40 -04:00
|
|
|
symsize,
|
|
|
|
&memoryDC,
|
|
|
|
symsize * m_suit,
|
|
|
|
sympos,
|
2004-06-02 05:14:59 -04:00
|
|
|
wxCOPY);
|
|
|
|
dc.Blit((wxCoord)(x - symdist + m_width / 4),
|
2004-10-05 11:38:40 -04:00
|
|
|
(wxCoord)(y - symdist + 7 * m_height / 12),
|
|
|
|
symsize,
|
2004-06-02 05:14:59 -04:00
|
|
|
symsize,
|
2004-10-05 11:38:40 -04:00
|
|
|
&memoryDC,
|
|
|
|
symsize * m_suit,
|
|
|
|
sympos2,
|
2004-06-02 05:14:59 -04:00
|
|
|
wxCOPY);
|
|
|
|
dc.Blit((wxCoord)(x - symdist + m_width / 4),
|
2004-10-05 11:38:40 -04:00
|
|
|
(wxCoord)(y - symdist + 3 * m_height / 4),
|
|
|
|
symsize,
|
2004-06-02 05:14:59 -04:00
|
|
|
symsize,
|
2004-10-05 11:38:40 -04:00
|
|
|
&memoryDC,
|
|
|
|
symsize * m_suit,
|
|
|
|
sympos2,
|
2004-06-02 05:14:59 -04:00
|
|
|
wxCOPY);
|
|
|
|
|
|
|
|
dc.Blit((wxCoord)(x - symdist + 3 * m_width / 4),
|
2004-10-05 11:38:40 -04:00
|
|
|
(wxCoord)(y - symdist2 + m_height / 4),
|
2004-06-02 05:14:59 -04:00
|
|
|
symsize,
|
2004-10-05 11:38:40 -04:00
|
|
|
symsize,
|
|
|
|
&memoryDC,
|
|
|
|
symsize * m_suit,
|
|
|
|
sympos,
|
2004-06-02 05:14:59 -04:00
|
|
|
wxCOPY);
|
|
|
|
dc.Blit((wxCoord)(x - symdist + 3 * m_width / 4),
|
2004-10-05 11:38:40 -04:00
|
|
|
(wxCoord)(y - symdist2 + 5 * m_height / 12),
|
|
|
|
symsize,
|
2004-06-02 05:14:59 -04:00
|
|
|
symsize,
|
2004-10-05 11:38:40 -04:00
|
|
|
&memoryDC,
|
|
|
|
symsize * m_suit,
|
|
|
|
sympos,
|
2004-06-02 05:14:59 -04:00
|
|
|
wxCOPY);
|
|
|
|
dc.Blit((wxCoord)(x - symdist + 3 * m_width / 4),
|
2004-10-05 11:38:40 -04:00
|
|
|
(wxCoord)(y - symdist + 7 * m_height / 12),
|
2004-06-02 05:14:59 -04:00
|
|
|
symsize,
|
2004-10-05 11:38:40 -04:00
|
|
|
symsize,
|
|
|
|
&memoryDC,
|
|
|
|
symsize * m_suit,
|
|
|
|
sympos2,
|
2004-06-02 05:14:59 -04:00
|
|
|
wxCOPY);
|
|
|
|
dc.Blit((wxCoord)(x - symdist + 3 * m_width / 4),
|
2004-10-05 11:38:40 -04:00
|
|
|
(wxCoord)(y - symdist + 3 * m_height / 4),
|
|
|
|
symsize,
|
2004-06-02 05:14:59 -04:00
|
|
|
symsize,
|
2004-10-05 11:38:40 -04:00
|
|
|
&memoryDC,
|
|
|
|
symsize * m_suit,
|
|
|
|
sympos2,
|
2004-06-02 05:14:59 -04:00
|
|
|
wxCOPY);
|
|
|
|
dc.Blit((wxCoord)(x - symdist + m_width / 2),
|
2004-10-05 11:38:40 -04:00
|
|
|
(wxCoord)(y - symdist + m_height / 3),
|
|
|
|
symsize,
|
2004-06-02 05:14:59 -04:00
|
|
|
symsize,
|
2004-10-05 11:38:40 -04:00
|
|
|
&memoryDC,
|
|
|
|
symsize * m_suit,
|
|
|
|
sympos,
|
2004-06-02 05:14:59 -04:00
|
|
|
wxCOPY);
|
|
|
|
break;
|
|
|
|
case 11:
|
2017-11-25 11:39:44 -05:00
|
|
|
wxFALLTHROUGH;
|
2004-06-02 05:14:59 -04:00
|
|
|
case 12:
|
2017-11-25 11:39:44 -05:00
|
|
|
wxFALLTHROUGH;
|
2004-06-02 05:14:59 -04:00
|
|
|
case 13:
|
|
|
|
memoryDC.SelectObject(*m_pictureBmap);
|
|
|
|
int picwidth = 40,picheight = 45;
|
2004-10-05 11:38:40 -04:00
|
|
|
dc.Blit((wxCoord)(x + (m_width-picwidth)/2),
|
2004-06-02 05:14:59 -04:00
|
|
|
(wxCoord)(y - picheight/2 + m_height/2),
|
2004-10-05 11:38:40 -04:00
|
|
|
picwidth,
|
2004-06-02 05:14:59 -04:00
|
|
|
picheight,
|
2004-10-05 11:38:40 -04:00
|
|
|
&memoryDC,
|
|
|
|
picwidth * (m_pipValue - 11),
|
|
|
|
0,
|
2004-06-02 05:14:59 -04:00
|
|
|
wxCOPY);
|
|
|
|
|
|
|
|
memoryDC.SelectObject(*m_symbolBmap);
|
|
|
|
dc.Blit((wxCoord)(x + m_width-(m_width-picwidth)/2-symsize-3),
|
2004-10-05 11:38:40 -04:00
|
|
|
(wxCoord)(y - picheight/2+m_height/2+1),
|
2004-06-02 05:14:59 -04:00
|
|
|
symsize,
|
2004-10-05 11:38:40 -04:00
|
|
|
symsize,
|
|
|
|
&memoryDC,
|
|
|
|
symsize * m_suit,
|
|
|
|
sympos,
|
2004-06-02 05:14:59 -04:00
|
|
|
wxCOPY);
|
|
|
|
dc.Blit((wxCoord)(x + (m_width-picwidth)/2+2),
|
2004-10-05 11:38:40 -04:00
|
|
|
(wxCoord)(y + picheight/2 + m_height/2-symsize),
|
|
|
|
symsize,
|
2004-06-02 05:14:59 -04:00
|
|
|
symsize,
|
2004-10-05 11:38:40 -04:00
|
|
|
&memoryDC,
|
|
|
|
symsize * m_suit,
|
|
|
|
sympos2,
|
2004-06-02 05:14:59 -04:00
|
|
|
wxCOPY);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
dc.SetBackground( backgroundBrush );
|
1998-07-24 15:43:32 -04:00
|
|
|
} // Card:Draw()
|
|
|
|
|
|
|
|
|
|
|
|
//+-------------------------------------------------------------+
|
2004-06-02 05:14:59 -04:00
|
|
|
//| Card::DrawNullCard() |
|
1998-07-24 15:43:32 -04:00
|
|
|
//+-------------------------------------------------------------+
|
2004-06-02 05:14:59 -04:00
|
|
|
//| Description: |
|
|
|
|
//| Draws the outline of a card at (x, y). |
|
|
|
|
//| Used to draw place holders for empty piles of cards. |
|
1998-07-24 15:43:32 -04:00
|
|
|
//+-------------------------------------------------------------+
|
|
|
|
void Card::DrawNullCard(wxDC& dc, int x, int y)
|
|
|
|
{
|
2017-11-25 11:39:44 -05:00
|
|
|
wxPen* pen = wxThePenList->FindOrCreatePen(FortyApp::TextColour());
|
2004-06-02 05:14:59 -04:00
|
|
|
dc.SetBrush(FortyApp::BackgroundBrush());
|
|
|
|
dc.SetPen(*pen);
|
|
|
|
dc.DrawRoundedRectangle(x, y, m_width, m_height, 4);
|
1998-07-24 15:43:32 -04:00
|
|
|
} // Card::DrawNullCard()
|