comparison GUI/UI/UIMainMenu.cpp @ 2541:a902abdfc7f2

1. Renamed class Game to class Engine. 2. Separated game logic as state of FSM from game logic as engine. 3. Found out that many UI screen initializers were optimized away, intially they all returned newly created window as separate object like it is done in CharacterUI_Initialize.
author a.parshin
date Sun, 10 May 2015 01:29:11 +0200
parents c7264ab7132f
children c674d547cc7c
comparison
equal deleted inserted replaced
2540:abc6a9d079b9 2541:a902abdfc7f2
1 #define _CRTDBG_MAP_ALLOC 1 #define _CRTDBG_MAP_ALLOC
2 #include <stdlib.h> 2 #include <stdlib.h>
3 #include <crtdbg.h> 3 #include <crtdbg.h>
4 4
5 #define _CRT_SECURE_NO_WARNINGS 5 #define _CRT_SECURE_NO_WARNINGS
6
7 #include "Engine/Engine.h"
8
6 #include "..\../IO/Mouse.h" 9 #include "..\../IO/Mouse.h"
7 #include "..\../IO/Keyboard.h" 10 #include "..\../IO/Keyboard.h"
8 #include "..\../Engine/ErrorHandling.h"
9 11
10 #include "..\../GUI/GUIWindow.h" 12 #include "..\../GUI/GUIWindow.h"
11 #include "..\../GUI/GUIFont.h" 13 #include "..\../GUI/GUIFont.h"
12 #include "..\../Media/Audio/AudioPlayer.h" 14 #include "..\../Media/Audio/AudioPlayer.h"
13 #include "..\../Engine/Graphics/Render.h" 15 #include "..\../Engine/Graphics/Render.h"
15 #include "..\../Engine/Graphics/PaletteManager.h" 17 #include "..\../Engine/Graphics/PaletteManager.h"
16 #include "..\../Engine/Tables/IconFrameTable.h" 18 #include "..\../Engine/Tables/IconFrameTable.h"
17 #include "..\../Engine/texts.h" 19 #include "..\../Engine/texts.h"
18 #include "..\../Engine/MMT.h" 20 #include "..\../Engine/MMT.h"
19 21
20 #include "..\../Engine/mm7_data.h" 22 #include "Game/Game.h"
21 #include "..\../Engine/Game.h" 23 #include "Game/MainMenu.h"
22 24
23 25
24 //----- (0041B578) -------------------------------------------------------- 26 //----- (0041B578) --------------------------------------------------------
25 void MainMenuUI_LoadFontsAndSomeStuff() 27 void MainMenuUI_LoadFontsAndSomeStuff()
26 { 28 {
296 cred_texture.uHeight, Color16(0x70u, 0x8Fu, 0xFEu), Color16(0xECu, 0xE6u, 0x9Cu), pString, cred_texture.pPixels, cred_texture.uWidth); 298 cred_texture.uHeight, Color16(0x70u, 0x8Fu, 0xFEu), Color16(0xECu, 0xE6u, 0x9Cu), pString, cred_texture.pPixels, cred_texture.uWidth);
297 free(pString); 299 free(pString);
298 300
299 pWindow_MainMenu = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_MainMenu, 0, cred_texturet); 301 pWindow_MainMenu = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_MainMenu, 0, cred_texturet);
300 pWindow_MainMenu->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_Escape, 0, 27, "", 0); 302 pWindow_MainMenu->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_Escape, 0, 27, "", 0);
301 pCurrentScreen = SCREEN_CREATORS; 303 current_screen_type = SCREEN_CREATORS;
302 SetCurrentMenuID(MENU_CREDITSPROC); 304 SetCurrentMenuID(MENU_CREDITSPROC);
303 305
304 move_Y = 0; 306 move_Y = 0;
305 do 307 do
306 { 308 {
307 while ( PeekMessageA(&Msg, 0, 0, 0, 1) ) 309 while ( PeekMessageA(&Msg, 0, 0, 0, 1) )
308 { 310 {
309 if ( Msg.message == 18 ) 311 if ( Msg.message == 18 )
310 Game_DeinitializeAndTerminate(0); 312 Engine_DeinitializeAndTerminate(0);
311 TranslateMessage(&Msg); 313 TranslateMessage(&Msg);
312 DispatchMessageA(&Msg); 314 DispatchMessageA(&Msg);
313 } 315 }
314 if (dword_6BE364_game_settings_1 & GAME_SETTINGS_APP_INACTIVE) 316 if (dword_6BE364_game_settings_1 & GAME_SETTINGS_APP_INACTIVE)
315 { 317 {
326 pRenderer->EndScene(); 328 pRenderer->EndScene();
327 ++move_Y; 329 ++move_Y;
328 if ( move_Y >= cred_texture.uHeight ) 330 if ( move_Y >= cred_texture.uHeight )
329 SetCurrentMenuID(MENU_MAIN); 331 SetCurrentMenuID(MENU_MAIN);
330 pRenderer->Present(); 332 pRenderer->Present();
331 pCurrentScreen = SCREEN_GAME;//Ritor1: temporarily, must be corrected GUI_MainMenuMessageProc() 333 current_screen_type = SCREEN_GAME;//Ritor1: temporarily, must be corrected MainMenu_EventLoop()
332 GUI_MainMenuMessageProc(); 334 MainMenu_EventLoop();
333 } 335 }
334 } 336 }
335 while ( GetCurrentMenuID() == MENU_CREDITSPROC ); 337 while ( GetCurrentMenuID() == MENU_CREDITSPROC );
336 if ( use_music_folder ) 338 if ( use_music_folder )
337 alSourceStop(mSourceID); 339 alSourceStop(mSourceID);