diff GUI/UI/UIRest.cpp @ 2544:c674d547cc7c

GUIWindow switch logic refactored into behaviour classes
author a.parshin
date Mon, 11 May 2015 09:51:04 +0200
parents b6140dfeac27
children e06a3fe9ad6e
line wrap: on
line diff
--- a/GUI/UI/UIRest.cpp	Sun May 10 03:21:14 2015 +0200
+++ b/GUI/UI/UIRest.cpp	Mon May 11 09:51:04 2015 +0200
@@ -30,7 +30,7 @@
     }
     pEventTimer->Pause();
     if (_506F14_resting_stage != 2)
-        GUIWindow::Create(518, 450, 0, 0, WINDOW_PressedButton2, (int)pBtn_Rest, 0);
+        new OnButtonClick2(518, 450, 0, 0, (int)pBtn_Rest, 0);
     _506F18_num_minutes_to_sleep = 0;
     _506F14_resting_stage = 0;
     uRestUI_FoodRequiredToRest = 2;
@@ -72,7 +72,7 @@
 
   OutdoorLocation::LoadActualSkyFrame();
 
-  auto wnd = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_Rest, 0, 0);
+  auto wnd = new GUIWindow_Rest(0, 0, window->GetWidth(), window->GetHeight(), 0, 0);
   pButton_RestUI_Exit =          wnd->CreateButton(280, 297, 154, 37, 1, 0, UIMSG_ExitRest, 0, 0, "", pIcons_LOD->GetTexture(uTextureID_RestUI_restexit), 0);
   pButton_RestUI_Main =          wnd->CreateButton( 24, 154, 225, 37, 1, 0, UIMSG_Rest8Hour, 0, 'R', "", pIcons_LOD->GetTexture(uTextureID_RestUI_restb4), 0);
   pButton_RestUI_WaitUntilDawn = wnd->CreateButton( 61, 232, 154, 33, 1, 0, UIMSG_AlreadyResting, 0, 'D', "", pIcons_LOD->GetTexture(uTextureID_RestUI_restb1), 0);
@@ -170,6 +170,5 @@
       Party::Sleep6Hours();
   }
   else
-    GUIWindow::Create(pButton_RestUI_Exit->uX, pButton_RestUI_Exit->uY, 0, 0, WINDOW_CloseRestWindowBtn, 
-      (int)pButton_RestUI_Exit, pGlobalTXT_LocalizationStrings[81]); // "Exit Rest"
+      new OnCancel(pButton_RestUI_Exit->uX, pButton_RestUI_Exit->uY, 0, 0, (int)pButton_RestUI_Exit, pGlobalTXT_LocalizationStrings[81]); // "Exit Rest"
 }
\ No newline at end of file