X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/63cafd2799b6e9dcbe34ce63635f1f8a807d895f..6e6110ee8194ee39944dffd57cce9f22cd8b961e:/samples/forty/game.cpp?ds=sidebyside

diff --git a/samples/forty/game.cpp b/samples/forty/game.cpp
index c121d8dd06..4ac59941eb 100644
--- a/samples/forty/game.cpp
+++ b/samples/forty/game.cpp
@@ -166,12 +166,12 @@ void Game::DoMove(wxDC& dc, Pile* src, Pile* dest)
 
 void Game::DisplayScore(wxDC& dc)
 {
-    wxColour* bgColour = FortyApp::BackgroundColour();
-	wxPen* pen = wxThePenList->FindOrCreatePen(*bgColour, 1, wxSOLID);
-    dc.SetTextBackground(*bgColour);
-    dc.SetTextForeground(*FortyApp::TextColour());
+    wxColour bgColour = FortyApp::BackgroundColour();
+	wxPen* pen = wxThePenList->FindOrCreatePen(bgColour, 1, wxSOLID);
+    dc.SetTextBackground(bgColour);
+    dc.SetTextForeground(FortyApp::TextColour());
 	dc.SetBrush(FortyApp::BackgroundBrush());
-	dc.SetPen(pen);
+	dc.SetPen(* pen);
 
 	// count the number of cards in foundations
     m_currentScore = 0;
@@ -288,11 +288,12 @@ void Game::Redraw(wxDC& dc)
 
 		// Initialise the card bitmap to the background colour
 		wxMemoryDC memoryDC;
-		memoryDC.SelectObject(m_bmapCard);
+		memoryDC.SelectObject(*m_bmapCard);
 		memoryDC.SetBrush(FortyApp::BackgroundBrush());
 		memoryDC.DrawRectangle(0, 0, CardWidth, CardHeight);
-		memoryDC.SelectObject(m_bmap);
+		memoryDC.SelectObject(*m_bmap);
 		memoryDC.DrawRectangle(0, 0, CardWidth, CardHeight);
+		memoryDC.SelectObject(wxNullBitmap);
 	}
 }
 
@@ -363,7 +364,7 @@ bool Game::LButtonDown(wxDC& dc, int x, int y)
 			// 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);
 		}
 
@@ -371,7 +372,7 @@ bool Game::LButtonDown(wxDC& dc, int x, int y)
 			// the screen
 		{
 			wxMemoryDC memoryDC;
-			memoryDC.SelectObject(m_bmapCard);
+			memoryDC.SelectObject(*m_bmapCard);
 			m_liftedCard->Draw(memoryDC, 0, 0);
 		}
     }
@@ -557,7 +558,7 @@ void Game::LButtonUp(wxDC& dc, int x, int y)
 
 		// 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);
 
@@ -603,7 +604,7 @@ void Game::MouseMove(wxDC& dc, int mx, int my)
     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;
@@ -674,7 +675,7 @@ void Game::MouseMove(wxDC& dc, int mx, int my)
 		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);
     }
@@ -745,8 +746,8 @@ void Pack::Redraw(wxDC& dc)
     char str[10];
     sprintf(str, "%d  ", m_topCard + 1);
 
-	dc.SetTextBackground(*FortyApp::BackgroundColour());
-	dc.SetTextForeground(*FortyApp::TextColour());
+	dc.SetTextBackground(FortyApp::BackgroundColour());
+	dc.SetTextForeground(FortyApp::TextColour());
     dc.DrawText(str, m_x + CardWidth + 5, m_y + CardHeight / 2);
 
 }