1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-12-07 23:33:15 +02:00

Renamed CGuiHandler to GameEngine

- class CGuiHandler is now called GameEngine to better describe its
functionality
- renamed global GH to more clear ENGINE
- GH/ENGINE is now unique_ptr to make construction / deconstruction
order more clear and to allow interface / implementation split
- CGuiHandler.cpp/h is now called GameEngine.cpp/h and located in root
directory of client dir
This commit is contained in:
Ivan Savenko
2025-02-10 21:49:23 +00:00
parent 0c5a560c80
commit cacceda950
144 changed files with 1019 additions and 1021 deletions

View File

@@ -13,7 +13,7 @@
#include "../../lib/CConfigHandler.h"
#include "../CPlayerInterface.h"
#include "../gui/CGuiHandler.h"
#include "../GameEngine.h"
#include "../gui/EventDispatcher.h"
#include "../gui/Shortcut.h"
#include "../gui/ShortcutHandler.h"
@@ -70,7 +70,7 @@ void InputSourceKeyboard::handleEventKeyDown(const SDL_KeyboardEvent & key)
std::string clipboardContent = clipboardBuffer;
boost::erase_all(clipboardContent, "\r");
boost::erase_all(clipboardContent, "\n");
GH.events().dispatchTextInput(clipboardContent);
ENGINE->events().dispatchTextInput(clipboardContent);
SDL_free(clipboardBuffer);
return;
}
@@ -84,11 +84,11 @@ void InputSourceKeyboard::handleEventKeyDown(const SDL_KeyboardEvent & key)
if(handleBackRightMouseButton && key.keysym.scancode == SDL_SCANCODE_AC_BACK) // on some android devices right mouse button is "back"
{
GH.events().dispatchShowPopup(GH.getCursorPosition(), settings["input"]["mouseToleranceDistance"].Integer());
ENGINE->events().dispatchShowPopup(ENGINE->getCursorPosition(), settings["input"]["mouseToleranceDistance"].Integer());
return;
}
auto shortcutsVector = GH.shortcuts().translateKeycode(keyName);
auto shortcutsVector = ENGINE->shortcuts().translateKeycode(keyName);
if (vstd::contains(shortcutsVector, EShortcut::MAIN_MENU_LOBBY))
CSH->getGlobalLobby().activateInterface();
@@ -97,7 +97,7 @@ void InputSourceKeyboard::handleEventKeyDown(const SDL_KeyboardEvent & key)
{
Settings full = settings.write["video"]["fullscreen"];
full->Bool() = !full->Bool();
GH.onScreenResize(true);
ENGINE->onScreenResize(true);
}
if (vstd::contains(shortcutsVector, EShortcut::SPECTATE_TRACK_HERO))
@@ -118,7 +118,7 @@ void InputSourceKeyboard::handleEventKeyDown(const SDL_KeyboardEvent & key)
s["spectate-skip-battle-result"].Bool() = !settings["session"]["spectate-skip-battle-result"].Bool();
}
GH.events().dispatchShortcutPressed(shortcutsVector);
ENGINE->events().dispatchShortcutPressed(shortcutsVector);
}
void InputSourceKeyboard::handleEventKeyUp(const SDL_KeyboardEvent & key)
@@ -128,7 +128,7 @@ void InputSourceKeyboard::handleEventKeyUp(const SDL_KeyboardEvent & key)
if(handleBackRightMouseButton && key.keysym.scancode == SDL_SCANCODE_AC_BACK) // on some android devices right mouse button is "back"
{
GH.events().dispatchClosePopup(GH.getCursorPosition());
ENGINE->events().dispatchClosePopup(ENGINE->getCursorPosition());
return;
}
@@ -143,9 +143,9 @@ void InputSourceKeyboard::handleEventKeyUp(const SDL_KeyboardEvent & key)
assert(key.state == SDL_RELEASED);
auto shortcutsVector = GH.shortcuts().translateKeycode(keyName);
auto shortcutsVector = ENGINE->shortcuts().translateKeycode(keyName);
GH.events().dispatchShortcutReleased(shortcutsVector);
ENGINE->events().dispatchShortcutReleased(shortcutsVector);
}
bool InputSourceKeyboard::isKeyboardCmdDown() const