mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2025-12-22 23:33:04 +01:00
Move majority of input.c to UI
This commit is contained in:
@@ -18,6 +18,7 @@
|
|||||||
#include <openrct2-ui/windows/Window.h>
|
#include <openrct2-ui/windows/Window.h>
|
||||||
#include <openrct2/core/Console.hpp>
|
#include <openrct2/core/Console.hpp>
|
||||||
#include <openrct2/config/Config.h>
|
#include <openrct2/config/Config.h>
|
||||||
|
#include <openrct2/Input.h>
|
||||||
#include "input/Input.h"
|
#include "input/Input.h"
|
||||||
#include "input/KeyboardShortcuts.h"
|
#include "input/KeyboardShortcuts.h"
|
||||||
#include "WindowManager.h"
|
#include "WindowManager.h"
|
||||||
@@ -364,6 +365,11 @@ public:
|
|||||||
window_map_tooltip_update_visibility();
|
window_map_tooltip_update_visibility();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void HandleInput() override
|
||||||
|
{
|
||||||
|
game_handle_input();
|
||||||
|
}
|
||||||
|
|
||||||
void HandleKeyboard(bool isTitle) override
|
void HandleKeyboard(bool isTitle) override
|
||||||
{
|
{
|
||||||
input_handle_keyboard(isTitle);
|
input_handle_keyboard(isTitle);
|
||||||
|
|||||||
1551
src/openrct2-ui/input/MouseInput.cpp
Normal file
1551
src/openrct2-ui/input/MouseInput.cpp
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1064,6 +1064,12 @@ extern "C"
|
|||||||
windowManager->UpdateMapTooltip();
|
windowManager->UpdateMapTooltip();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void context_handle_input()
|
||||||
|
{
|
||||||
|
auto windowManager = GetContext()->GetUiContext()->GetWindowManager();
|
||||||
|
windowManager->HandleInput();
|
||||||
|
}
|
||||||
|
|
||||||
void context_input_handle_keyboard(bool isTitle)
|
void context_input_handle_keyboard(bool isTitle)
|
||||||
{
|
{
|
||||||
auto windowManager = GetContext()->GetUiContext()->GetWindowManager();
|
auto windowManager = GetContext()->GetUiContext()->GetWindowManager();
|
||||||
|
|||||||
@@ -223,6 +223,7 @@ extern "C"
|
|||||||
void context_broadcast_intent(Intent * intent);
|
void context_broadcast_intent(Intent * intent);
|
||||||
void context_force_close_window_by_class(rct_windowclass wc);
|
void context_force_close_window_by_class(rct_windowclass wc);
|
||||||
void context_update_map_tooltip();
|
void context_update_map_tooltip();
|
||||||
|
void context_handle_input();
|
||||||
void context_input_handle_keyboard(bool isTitle);
|
void context_input_handle_keyboard(bool isTitle);
|
||||||
bool context_read_bmp(void * * outPixels, uint32 * outWidth, uint32 * outHeight, const utf8 * path);
|
bool context_read_bmp(void * * outPixels, uint32 * outWidth, uint32 * outHeight, const utf8 * path);
|
||||||
void context_quit();
|
void context_quit();
|
||||||
|
|||||||
@@ -424,7 +424,7 @@ void game_update()
|
|||||||
// Input
|
// Input
|
||||||
gUnk141F568 = gUnk13CA740;
|
gUnk141F568 = gUnk13CA740;
|
||||||
|
|
||||||
game_handle_input();
|
context_handle_input();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Always perform autosave check, even when paused
|
// Always perform autosave check, even when paused
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -96,6 +96,11 @@ extern sint32 gTooltipCursorY;
|
|||||||
extern TOOL_IDX gCurrentToolId;
|
extern TOOL_IDX gCurrentToolId;
|
||||||
extern widget_ref gCurrentToolWidget;
|
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 input_window_position_begin(rct_window *w, rct_widgetindex widgetIndex, sint32 x, sint32 y);
|
||||||
|
|
||||||
void title_handle_keyboard_input();
|
void title_handle_keyboard_input();
|
||||||
|
|||||||
@@ -177,7 +177,7 @@ void TitleScreen::Update()
|
|||||||
|
|
||||||
gSavedAge++;
|
gSavedAge++;
|
||||||
|
|
||||||
game_handle_input();
|
context_handle_input();
|
||||||
|
|
||||||
gInUpdateCode = false;
|
gInUpdateCode = false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ namespace OpenRCT2 { namespace Ui
|
|||||||
void BroadcastIntent(const Intent &intent) override { }
|
void BroadcastIntent(const Intent &intent) override { }
|
||||||
void ForceClose(rct_windowclass windowClass) override { }
|
void ForceClose(rct_windowclass windowClass) override { }
|
||||||
void UpdateMapTooltip() override { }
|
void UpdateMapTooltip() override { }
|
||||||
|
void HandleInput() override { }
|
||||||
void HandleKeyboard(bool isTitle) override { }
|
void HandleKeyboard(bool isTitle) override { }
|
||||||
std::string GetKeyboardShortcutString(sint32 shortcut) override { return std::string(); }
|
std::string GetKeyboardShortcutString(sint32 shortcut) override { return std::string(); }
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ namespace OpenRCT2
|
|||||||
virtual rct_window * ShowError(rct_string_id title, rct_string_id message) abstract;
|
virtual rct_window * ShowError(rct_string_id title, rct_string_id message) abstract;
|
||||||
virtual void ForceClose(rct_windowclass windowClass) abstract;
|
virtual void ForceClose(rct_windowclass windowClass) abstract;
|
||||||
virtual void UpdateMapTooltip() abstract;
|
virtual void UpdateMapTooltip() abstract;
|
||||||
|
virtual void HandleInput() abstract;
|
||||||
virtual void HandleKeyboard(bool isTitle) abstract;
|
virtual void HandleKeyboard(bool isTitle) abstract;
|
||||||
virtual std::string GetKeyboardShortcutString(sint32 shortcut) abstract;
|
virtual std::string GetKeyboardShortcutString(sint32 shortcut) abstract;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user