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

Move majority of input.c to UI

This commit is contained in:
Marijn van der Werf
2017-12-07 22:16:20 +01:00
parent 22966c1ad7
commit e9ef843619
10 changed files with 1577 additions and 1538 deletions

View File

@@ -18,6 +18,7 @@
#include <openrct2-ui/windows/Window.h>
#include <openrct2/core/Console.hpp>
#include <openrct2/config/Config.h>
#include <openrct2/Input.h>
#include "input/Input.h"
#include "input/KeyboardShortcuts.h"
#include "WindowManager.h"
@@ -364,6 +365,11 @@ public:
window_map_tooltip_update_visibility();
}
void HandleInput() override
{
game_handle_input();
}
void HandleKeyboard(bool isTitle) override
{
input_handle_keyboard(isTitle);

File diff suppressed because it is too large Load Diff

View File

@@ -1064,6 +1064,12 @@ extern "C"
windowManager->UpdateMapTooltip();
}
void context_handle_input()
{
auto windowManager = GetContext()->GetUiContext()->GetWindowManager();
windowManager->HandleInput();
}
void context_input_handle_keyboard(bool isTitle)
{
auto windowManager = GetContext()->GetUiContext()->GetWindowManager();

View File

@@ -223,6 +223,7 @@ extern "C"
void context_broadcast_intent(Intent * intent);
void context_force_close_window_by_class(rct_windowclass wc);
void context_update_map_tooltip();
void context_handle_input();
void context_input_handle_keyboard(bool isTitle);
bool context_read_bmp(void * * outPixels, uint32 * outWidth, uint32 * outHeight, const utf8 * path);
void context_quit();

View File

@@ -424,7 +424,7 @@ void game_update()
// Input
gUnk141F568 = gUnk13CA740;
game_handle_input();
context_handle_input();
}
// Always perform autosave check, even when paused

File diff suppressed because it is too large Load Diff

View File

@@ -96,6 +96,11 @@ extern sint32 gTooltipCursorY;
extern TOOL_IDX gCurrentToolId;
extern widget_ref gCurrentToolWidget;
// TODO: Move to openrct2-ui and make static again
extern INPUT_STATE _inputState;
extern uint8 _inputFlags;
extern uint16 _tooltipNotShownTicks;
void input_window_position_begin(rct_window *w, rct_widgetindex widgetIndex, sint32 x, sint32 y);
void title_handle_keyboard_input();

View File

@@ -177,7 +177,7 @@ void TitleScreen::Update()
gSavedAge++;
game_handle_input();
context_handle_input();
gInUpdateCode = false;
}

View File

@@ -29,6 +29,7 @@ namespace OpenRCT2 { namespace Ui
void BroadcastIntent(const Intent &intent) override { }
void ForceClose(rct_windowclass windowClass) override { }
void UpdateMapTooltip() override { }
void HandleInput() override { }
void HandleKeyboard(bool isTitle) override { }
std::string GetKeyboardShortcutString(sint32 shortcut) override { return std::string(); }
};

View File

@@ -43,6 +43,7 @@ namespace OpenRCT2
virtual rct_window * ShowError(rct_string_id title, rct_string_id message) abstract;
virtual void ForceClose(rct_windowclass windowClass) abstract;
virtual void UpdateMapTooltip() abstract;
virtual void HandleInput() abstract;
virtual void HandleKeyboard(bool isTitle) abstract;
virtual std::string GetKeyboardShortcutString(sint32 shortcut) abstract;
};