1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-25 22:42:04 +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

@@ -10,7 +10,7 @@
#include "StdInc.h"
#include "CIntObject.h"
#include "CGuiHandler.h"
#include "GameEngine.h"
#include "WindowHandler.h"
#include "EventDispatcher.h"
#include "Shortcut.h"
@@ -27,8 +27,8 @@ CIntObject::CIntObject(int used_, Point pos_):
recActions(ALL_ACTIONS),
pos(pos_, Point())
{
if(GH.captureChildren)
GH.createdObj.front()->addChild(this, true);
if(ENGINE->captureChildren)
ENGINE->createdObj.front()->addChild(this, true);
}
CIntObject::~CIntObject()
@@ -157,7 +157,7 @@ void CIntObject::setRedrawParent(bool on)
void CIntObject::fitToScreen(int borderWidth, bool propagate)
{
fitToRect(Rect(Point(0, 0), GH.screenDimensions()), borderWidth, propagate);
fitToRect(Rect(Point(0, 0), ENGINE->screenDimensions()), borderWidth, propagate);
}
void CIntObject::fitToRect(Rect rect, int borderWidth, bool propagate)
@@ -238,7 +238,7 @@ void CIntObject::redraw()
}
else
{
Canvas buffer = GH.screenHandler().getScreenCanvas();
Canvas buffer = ENGINE->screenHandler().getScreenCanvas();
showAll(buffer);
}
}
@@ -277,7 +277,7 @@ const Rect & CIntObject::center( const Rect &r, bool propagate )
{
pos.w = r.w;
pos.h = r.h;
return center(Point(GH.screenDimensions().x/2, GH.screenDimensions().y/2), propagate);
return center(Point(ENGINE->screenDimensions().x/2, ENGINE->screenDimensions().y/2), propagate);
}
const Rect & CIntObject::center( bool propagate )
@@ -314,7 +314,7 @@ void CKeyShortcut::keyPressed(EShortcut key)
if( assignedKey == key && assignedKey != EShortcut::NONE && !shortcutPressed)
{
shortcutPressed = true;
clickPressed(GH.getCursorPosition());
clickPressed(ENGINE->getCursorPosition());
}
}
@@ -323,7 +323,7 @@ void CKeyShortcut::keyReleased(EShortcut key)
if( assignedKey == key && assignedKey != EShortcut::NONE && shortcutPressed)
{
shortcutPressed = false;
clickReleased(GH.getCursorPosition());
clickReleased(ENGINE->getCursorPosition());
}
}
@@ -335,10 +335,10 @@ WindowBase::WindowBase(int used_, Point pos_)
void WindowBase::close()
{
if(!GH.windows().isTopWindow(this))
if(!ENGINE->windows().isTopWindow(this))
{
auto topWindow = GH.windows().topWindow<IShowActivatable>().get();
auto topWindow = ENGINE->windows().topWindow<IShowActivatable>().get();
throw std::runtime_error(std::string("Only top interface can be closed! Top window is ") + typeid(*topWindow).name() + " but attempted to close " + typeid(*this).name());
}
GH.windows().popWindows(1);
ENGINE->windows().popWindows(1);
}