return true;
}
-wxColour* FortyApp::BackgroundColour()
+const wxColour& FortyApp::BackgroundColour()
{
if (!m_backgroundColour)
{
m_backgroundColour = new wxColour(0, 128, 0);
}
- return m_backgroundColour;
+
+ return *m_backgroundColour;
}
-wxBrush* FortyApp::BackgroundBrush()
+const wxBrush& FortyApp::BackgroundBrush()
{
if (!m_backgroundBrush)
{
m_backgroundBrush = new wxBrush(*BackgroundColour(), wxSOLID);
}
- return m_backgroundBrush;
+
+ return *m_backgroundBrush;
}
-wxColour* FortyApp::TextColour()
+const wxColour& FortyApp::TextColour()
{
if (!m_textColour)
{
m_textColour = new wxColour("BLACK");
}
- return m_textColour;
+
+ return *m_textColour;
}
// My frame constructor
public:
bool OnInit();
- static wxColour* BackgroundColour();
- static wxColour* TextColour();
- static wxBrush* BackgroundBrush();
+ static const wxColour& BackgroundColour();
+ static const wxColour& TextColour();
+ static const wxBrush& BackgroundBrush();
private:
static wxColour* m_backgroundColour;
// Initialise the card bitmap to the background colour
{
wxMemoryDC memoryDC;
- memoryDC.SelectObject(m_bmap);
+ memoryDC.SelectObject(*m_bmap);
m_liftedCard = m_srcPile->RemoveTopCard(memoryDC, m_xPos, m_yPos);
}
// the screen
{
wxMemoryDC memoryDC;
- memoryDC.SelectObject(m_bmapCard);
+ memoryDC.SelectObject(*m_bmapCard);
m_liftedCard->Draw(memoryDC, 0, 0);
}
}
// Restore the area under the card
wxMemoryDC memoryDC;
- memoryDC.SelectObject(m_bmap);
+ memoryDC.SelectObject(*m_bmap);
dc.Blit(m_xPos, m_yPos, CardWidth, CardHeight,
&memoryDC, 0, 0, wxCOPY);
if (m_liftedCard)
{
wxMemoryDC memoryDC;
- memoryDC.SelectObject(m_bmap);
+ memoryDC.SelectObject(*m_bmap);
int dx = mx + m_xOffset - m_xPos;
int dy = my + m_yOffset - m_yPos;
m_yPos += dy;
// draw the card in its new position
- memoryDC.SelectObject(m_bmapCard);
+ memoryDC.SelectObject(*m_bmapCard);
dc.Blit(m_xPos, m_yPos, CardWidth, CardHeight,
&memoryDC, 0, 0, wxCOPY);
}