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:
@@ -14,7 +14,7 @@
|
||||
#include "SDL_Extensions.h"
|
||||
#include "SDLImageScaler.h"
|
||||
|
||||
#include "../gui/CGuiHandler.h"
|
||||
#include "../GameEngine.h"
|
||||
#include "../render/IScreenHandler.h"
|
||||
#include "../render/Colors.h"
|
||||
#include "../render/IImage.h"
|
||||
@@ -38,7 +38,7 @@ CursorHardware::~CursorHardware()
|
||||
|
||||
void CursorHardware::setVisible(bool on)
|
||||
{
|
||||
GH.dispatchMainThread([on]()
|
||||
ENGINE->dispatchMainThread([on]()
|
||||
{
|
||||
if (on)
|
||||
SDL_ShowCursor(SDL_ENABLE);
|
||||
@@ -49,18 +49,18 @@ void CursorHardware::setVisible(bool on)
|
||||
|
||||
void CursorHardware::setImage(std::shared_ptr<IImage> image, const Point & pivotOffset)
|
||||
{
|
||||
int videoScalingSettings = GH.screenHandler().getInterfaceScalingPercentage();
|
||||
int videoScalingSettings = ENGINE->screenHandler().getInterfaceScalingPercentage();
|
||||
float cursorScalingSettings = settings["video"]["cursorScalingFactor"].Float();
|
||||
int cursorScalingPercent = videoScalingSettings * cursorScalingSettings;
|
||||
Point cursorDimensions = image->dimensions() * GH.screenHandler().getScalingFactor();
|
||||
Point cursorDimensions = image->dimensions() * ENGINE->screenHandler().getScalingFactor();
|
||||
Point cursorDimensionsScaled = image->dimensions() * cursorScalingPercent / 100;
|
||||
Point pivotOffsetScaled = pivotOffset * cursorScalingPercent / 100 / GH.screenHandler().getScalingFactor();
|
||||
Point pivotOffsetScaled = pivotOffset * cursorScalingPercent / 100 / ENGINE->screenHandler().getScalingFactor();
|
||||
|
||||
auto cursorSurface = CSDL_Ext::newSurface(cursorDimensions);
|
||||
|
||||
CSDL_Ext::fillSurface(cursorSurface, CSDL_Ext::toSDL(Colors::TRANSPARENCY));
|
||||
|
||||
image->draw(cursorSurface, Point(0,0), nullptr, GH.screenHandler().getScalingFactor());
|
||||
image->draw(cursorSurface, Point(0,0), nullptr, ENGINE->screenHandler().getScalingFactor());
|
||||
|
||||
SDLImageScaler scaler(cursorSurface);
|
||||
scaler.scaleSurface(cursorDimensionsScaled, EScalingAlgorithm::BILINEAR);
|
||||
@@ -75,7 +75,7 @@ void CursorHardware::setImage(std::shared_ptr<IImage> image, const Point & pivot
|
||||
SDL_FreeSurface(cursorSurface);
|
||||
SDL_FreeSurface(cursorSurfaceScaled);
|
||||
|
||||
GH.dispatchMainThread([this, oldCursor](){
|
||||
ENGINE->dispatchMainThread([this, oldCursor](){
|
||||
SDL_SetCursor(cursor);
|
||||
|
||||
if (oldCursor)
|
||||
|
||||
Reference in New Issue
Block a user