1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-23 15:52:55 +01:00

Refactor IPlatformEnvironment (#5590)

This commit is contained in:
Ted John
2017-06-11 12:53:37 +01:00
committed by GitHub
parent b563d26ffe
commit 0d8f9d6618
15 changed files with 184 additions and 146 deletions

View File

@@ -59,7 +59,8 @@ class UiContext final : public IUiContext
private:
constexpr static uint32 TOUCH_DOUBLE_TIMEOUT = 300;
IPlatformUiContext * const _platformUiContext;
IPlatformEnvironment * const _env;
IPlatformUiContext * const _platformUiContext;
CursorRepository _cursorRepository;
@@ -84,14 +85,18 @@ private:
float _gestureRadius = 0;
public:
UiContext()
: _platformUiContext(CreatePlatformUiContext())
UiContext(IPlatformEnvironment * env)
: _env(env),
_platformUiContext(CreatePlatformUiContext())
{
if (SDL_Init(SDL_INIT_VIDEO) < 0)
{
SDLException::Throw("SDL_Init(SDL_INIT_VIDEO)");
}
_cursorRepository.LoadCursors();
// Temporary to prevent warning, will be used for keyboard shortcuts
UNUSED(_env);
}
~UiContext() override
@@ -690,7 +695,7 @@ private:
}
};
IUiContext * OpenRCT2::Ui::CreateUiContext()
IUiContext * OpenRCT2::Ui::CreateUiContext(IPlatformEnvironment * env)
{
return new UiContext();
return new UiContext(env);
}