[dasher: 41/43] Win32: now compiles with new game mode.



commit 6384ff8951c25a765f2370f04dd7b3e557943313
Author: Patrick Welche <prlw1 cam ac uk>
Date:   Mon Jun 20 16:24:43 2011 +0100

    Win32: now compiles with new game mode.
    
    Rm GameGroup + GameModeHelper (so no fancy GUI, just use DashIntfScreenMsgs)
    
    Hopefully reinstate IDC_GAMEMODE menu item, checking to set BP_GAME_MODE.
      Hopefully!

 Src/DasherCore/DasherCore_vc80.vcproj |   40 +++--
 Src/DasherCore/GameModule.h           |    1 -
 Src/Win32/Dasher.cpp                  |    4 -
 Src/Win32/Dasher.rc                   |    2 +-
 Src/Win32/DasherWindow.cpp            |   51 ++----
 Src/Win32/DasherWindow.h              |    6 -
 Src/Win32/Dasher_vc80.vcproj          |   16 --
 Src/Win32/GameModeHelper.cpp          |   93 ----------
 Src/Win32/GameModeHelper.h            |   25 ---
 Src/Win32/Widgets/GameGroup.cpp       |  309 ---------------------------------
 Src/Win32/Widgets/GameGroup.h         |  106 -----------
 11 files changed, 39 insertions(+), 614 deletions(-)
---
diff --git a/Src/DasherCore/DasherCore_vc80.vcproj b/Src/DasherCore/DasherCore_vc80.vcproj
index 497d2c0..7bb6e87 100644
--- a/Src/DasherCore/DasherCore_vc80.vcproj
+++ b/Src/DasherCore/DasherCore_vc80.vcproj
@@ -1791,14 +1791,6 @@
 			>
 		</File>
 		<File
-			RelativePath=".\DasherGameMode.cpp"
-			>
-		</File>
-		<File
-			RelativePath=".\DasherGameMode.h"
-			>
-		</File>
-		<File
 			RelativePath="DasherInput.h"
 			>
 		</File>
@@ -1911,31 +1903,27 @@
 			>
 		</File>
 		<File
-			RelativePath=".\FrameRate.cpp"
+			RelativePath=".\FileWordGenerator.cpp"
 			>
 		</File>
 		<File
-			RelativePath="FrameRate.h"
-			>
-		</File>
-		<File
-			RelativePath=".\GameLevel.cpp"
+			RelativePath=".\FileWordGenerator.h"
 			>
 		</File>
 		<File
-			RelativePath=".\GameLevel.h"
+			RelativePath=".\FrameRate.cpp"
 			>
 		</File>
 		<File
-			RelativePath=".\GameMessages.h"
+			RelativePath="FrameRate.h"
 			>
 		</File>
 		<File
-			RelativePath=".\GameScorer.cpp"
+			RelativePath=".\GameModule.cpp"
 			>
 		</File>
 		<File
-			RelativePath=".\GameScorer.h"
+			RelativePath=".\GameModule.h"
 			>
 		</File>
 		<File
@@ -2070,6 +2058,14 @@
 			>
 		</File>
 		<File
+			RelativePath=".\ScreenGameModule.cpp"
+			>
+		</File>
+		<File
+			RelativePath=".\ScreenGameModule.h"
+			>
+		</File>
+		<File
 			RelativePath=".\SettingsStore.cpp"
 			>
 		</File>
@@ -2157,6 +2153,14 @@
 			RelativePath="..\Win32\Common\WinUTF8.h"
 			>
 		</File>
+		<File
+			RelativePath=".\WordGeneratorBase.cpp"
+			>
+		</File>
+		<File
+			RelativePath=".\WordGeneratorBase.h"
+			>
+		</File>
 	</Files>
 	<Globals>
 	</Globals>
diff --git a/Src/DasherCore/GameModule.h b/Src/DasherCore/GameModule.h
index dbf4cb2..3fa13c2 100644
--- a/Src/DasherCore/GameModule.h
+++ b/Src/DasherCore/GameModule.h
@@ -16,7 +16,6 @@ using namespace std;
 #include "DasherTypes.h"
 #include "DasherInterfaceBase.h"
 #include "WordGeneratorBase.h"
-#include <tr1/memory>
 
 
 namespace Dasher {
diff --git a/Src/Win32/Dasher.cpp b/Src/Win32/Dasher.cpp
index eb9a756..f7f7f88 100644
--- a/Src/Win32/Dasher.cpp
+++ b/Src/Win32/Dasher.cpp
@@ -119,15 +119,11 @@ void Dasher::CDasher::HandleEvent(int iParameter) {
 }
 
 void Dasher::CDasher::editOutput(const string &strText, CDasherNode *pSource) {
-  if(m_pWindow->m_pGameModeHelper)
-    m_pWindow->m_pGameModeHelper->Output(strText);
   m_pEdit->output(strText);
   CDasherInterfaceBase::editOutput(strText, pSource);
 }
 
 void Dasher::CDasher::editDelete(const string &strText, CDasherNode *pSource) {
-  if (m_pWindow->m_pGameModeHelper)
-    m_pWindow->m_pGameModeHelper->Delete(strText.size());
   m_pEdit->deletetext(strText);
   CDasherInterfaceBase::editDelete(strText, pSource);
 }
diff --git a/Src/Win32/Dasher.rc b/Src/Win32/Dasher.rc
index ddcb689..0e418eb 100644
--- a/Src/Win32/Dasher.rc
+++ b/Src/Win32/Dasher.rc
@@ -431,7 +431,7 @@ BEGIN
         MENUITEM "&Help Topics",                ID_HELP_CONTENTS
         MENUITEM SEPARATOR
         MENUITEM "&About Dasher",               IDM_ABOUT
-        // MENUITEM "Game Mode",                   ID_GAMEMODE
+        MENUITEM "Game Mode",                   ID_GAMEMODE
     END
 END
 
diff --git a/Src/Win32/DasherWindow.cpp b/Src/Win32/DasherWindow.cpp
index e180404..3bc36b5 100644
--- a/Src/Win32/DasherWindow.cpp
+++ b/Src/Win32/DasherWindow.cpp
@@ -30,7 +30,6 @@
 
 #include "Widgets/Slidebar.h"
 #include "Widgets/Toolbar.h"
-#include "Widgets/GameGroup.h"
 #include "WinCommon.h"
 
 #ifndef _WIN32_WCE
@@ -54,7 +53,6 @@ CDasherWindow::CDasherWindow() {
   m_pSpeedAlphabetBar = 0;
   m_pSplitter = 0;
   m_pDasher = 0;
-  m_pGameGroup = 0;
 
   m_hIconSm = (HICON) LoadImage(WinHelper::hInstApp, (LPCTSTR) IDI_DASHER, IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_DEFAULTCOLOR);
   
@@ -127,19 +125,12 @@ HWND CDasherWindow::Create() {
   m_pSpeedAlphabetBar = new CStatusControl(m_pAppSettings);
   m_pSpeedAlphabetBar->Create(hWnd);
 
-  m_pGameGroup = new CGameGroup(m_pDasher, m_pEdit);
-  m_pGameGroup->Create(hWnd);
-  m_pGameGroup->ShowWindow(SW_HIDE);
-  m_pGameGroup->SetEditFont(m_pAppSettings->GetStringParameter(APP_SP_EDIT_FONT), m_pAppSettings->GetLongParameter(APP_LP_EDIT_FONT_SIZE));
-
   m_pSplitter = new CSplitter(this,100);
   HWND hSplitter =  m_pSplitter->Create(hWnd);
   
   if (!hSplitter)
 	  return 0;
 
-  m_pGameModeHelper = 0;
-
   return hWnd;
 }
 
@@ -231,15 +222,21 @@ void CDasherWindow::HandleParameterChange(int iParameter) {
   case LP_MAX_BITRATE:
     // TODO: reimplement
     break;
+  case BP_GAME_MODE: {
+	  int iNewState(m_pDasher->GetBoolParameter(BP_GAME_MODE) ? MF_CHECKED : MF_UNCHECKED);
+	  DWORD iPrevState = CheckMenuItem(m_hMenu, ID_GAMEMODE, MF_BYCOMMAND | iNewState);
+	  DASHER_ASSERT( iPrevState != -1 ); //-1 = item does not exist (i.e. params to previous incorrect!)
+  }
   default:
     break;
   }
 }
 
 LRESULT CDasherWindow::OnCommand(UINT message, WPARAM wParam, LPARAM lParam, BOOL& bHandled) {
-  const int wmId = LOWORD(wParam);
-  const int wmEvent = HIWORD(wParam);
-  
+  const int wmId = LOWORD(wParam); //command id
+  const int wmEvent = HIWORD(wParam); //notification code: 1=from accelerator, 0=from menu
+  //lParam is the HWND (window handle) of control sending message, 0 if not from control
+
   // Tell edit box if it has changed. It should know itself really, but this is easier
   // This shouldn't be here - it should be in the edit box class
   if( m_pEdit && ((HWND) lParam == m_pEdit->GetHwnd()) && (HIWORD(wParam) == EN_CHANGE)) {
@@ -266,17 +263,12 @@ LRESULT CDasherWindow::OnCommand(UINT message, WPARAM wParam, LPARAM lParam, BOO
     HtmlHelp(m_hWnd, L"Dasher.chm", HH_DISPLAY_INDEX, NULL);
     return 0;
 #endif
-  case ID_HELP_DASHERTUTORIAL:
-    m_pGameModeHelper = new CGameModeHelper(m_pDasher);
-    return 0;
-  case ID_GAMEMODE:
-    m_pDasher->SetBoolParameter(BP_GAME_MODE,!m_pGameGroup->IsWindowVisible());
-      //TODO the following should be done in response to a change to BP_GAME_MODE being
-      // detected (e.g. if changed in DasherCore):
-    m_pGameGroup->ShowWindow(m_pGameGroup->IsWindowVisible()?SW_HIDE:SW_SHOW);
-    m_pEdit->Clear();
-    Layout();
+  case ID_GAMEMODE: {
+	  unsigned int checkState(GetMenuState(m_hMenu, ID_GAMEMODE, MF_BYCOMMAND));
+	  DASHER_ASSERT(checkState==-1); //"specified item does not exist" - presumably, params to above aren't right...
+	  m_pDasher->SetBoolParameter(BP_GAME_MODE, (checkState & MF_CHECKED) ? false : true);
     return 0;
+  }
   case IDM_EXIT:
     DestroyWindow();
     return 0;
@@ -459,16 +451,6 @@ void CDasherWindow::Layout() {
   else
     SpeedAlphabetHeight = 0;
 
-  int GameGroupHeight = 0;
-  int GameGroupWidth = 0;
-  int GameLabelHeight = 0;
-
-  if(m_pGameGroup) {
-    GameGroupHeight = m_pGameGroup->GetHeight();
-    GameGroupWidth = m_pGameGroup->GetWidth();
-    GameLabelHeight = m_pGameGroup->GetLabelHeight();
-  }
-
   int MaxCanvas = Height - SpeedAlphabetHeight*2;
   int CurY = ToolbarHeight;
 
@@ -476,7 +458,7 @@ void CDasherWindow::Layout() {
     int SplitterPos = m_pSplitter->GetPos();
     int SplitterHeight = m_pSplitter->GetHeight();
     //SplitterPos = max(CurY + 2 * SplitterHeight, SplitterPos);
-    SplitterPos = max(CurY + GameGroupHeight, SplitterPos);
+    SplitterPos = max(CurY, SplitterPos);
     SplitterPos = min(SplitterPos, MaxCanvas - 3 * SplitterHeight);
     m_pSplitter->Move(SplitterPos, Width);
 
@@ -491,12 +473,11 @@ void CDasherWindow::Layout() {
       if(bShowEdit) {
         m_pEdit->ShowWindow(SW_SHOW);
         m_pSplitter->ShowWindow(SW_SHOW);
-        m_pGameGroup->MoveWindow(0,CurY,Width,GameGroupHeight);
 
         if(m_pEdit)
         {
           //m_pEdit->Move(2, CurY+2, Width, SplitterPos - CurY-2);
-          m_pEdit->Move(0, CurY+GameLabelHeight, Width-GameGroupWidth, SplitterPos - CurY-GameLabelHeight);
+          m_pEdit->Move(0, CurY, Width, SplitterPos - CurY);
         }
 
         CurY = SplitterPos + SplitterHeight;
diff --git a/Src/Win32/DasherWindow.h b/Src/Win32/DasherWindow.h
index 7a10108..79fcdec 100644
--- a/Src/Win32/DasherWindow.h
+++ b/Src/Win32/DasherWindow.h
@@ -18,7 +18,6 @@
 #include "Widgets/WindowSelect.h"
 #include "DasherMouseInput.h"
 #include "AppSettings.h"
-#include "GameModeHelper.h"
 
 #include "../Common/WinOptions.h"
 
@@ -111,7 +110,6 @@ private:
 	//CCanvas *m_pCanvas;
 	CSplitter *m_pSplitter;
 	CStatusControl *m_pSpeedAlphabetBar;
-  CGameGroup* m_pGameGroup;
 	CMenu WinMenu;
 	//CSplash *Splash;
 
@@ -127,10 +125,6 @@ private:
 
 	// Misc window handling
 	void Layout();
-public:
-  // ACL temporary hack to allow CDasher to send it edit events.
-  CGameModeHelper *m_pGameModeHelper;
-
 };
 
 #endif /* #ifdef __MainWindow_h__ */
diff --git a/Src/Win32/Dasher_vc80.vcproj b/Src/Win32/Dasher_vc80.vcproj
index 972e1ae..1a3de18 100644
--- a/Src/Win32/Dasher_vc80.vcproj
+++ b/Src/Win32/Dasher_vc80.vcproj
@@ -1314,14 +1314,6 @@
 				>
 			</File>
 			<File
-				RelativePath=".\Widgets\GameGroup.cpp"
-				>
-			</File>
-			<File
-				RelativePath=".\Widgets\GameGroup.h"
-				>
-			</File>
-			<File
 				RelativePath=".\Widgets\Menu.cpp"
 				>
 			</File>
@@ -1379,14 +1371,6 @@
 			>
 		</File>
 		<File
-			RelativePath=".\GameModeHelper.cpp"
-			>
-		</File>
-		<File
-			RelativePath=".\GameModeHelper.h"
-			>
-		</File>
-		<File
 			RelativePath=".\resource.h"
 			>
 		</File>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]