1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-24 00:03:11 +01:00

Add SetKeysPressed() function to UiContext

This commit is contained in:
Richard Jenkins
2017-05-17 16:31:44 +01:00
committed by Gymnasiast
parent 898ffdb8e0
commit 999a467b9a
3 changed files with 9 additions and 3 deletions

View File

@@ -111,9 +111,8 @@ void TextComposition::HandleMessage(const SDL_Event * e)
// Map Keypad enter to regular enter.
key = SDLK_RETURN;
}
// _lastKeyPressed = e.key.keysym.sym;
// _keysPressed[e.key.keysym.scancode] = 1;
GetContext()->GetUiContext()->SetKeysPressed(key, e->key.keysym.scancode);
// Text input
if (_session.Buffer == nullptr)

View File

@@ -217,6 +217,12 @@ public:
{
SDL_SetWindowGrab(_window, value ? SDL_TRUE : SDL_FALSE);
}
void SetKeysPressed(uint32 keysym, uint8 scancode) override
{
_lastKeyPressed = keysym;
_keysPressed[scancode] = 1;
}
// Drawing
IDrawingEngine * CreateDrawingEngine(DRAWING_ENGINE_TYPE type) override

View File

@@ -119,6 +119,7 @@ namespace OpenRCT2
virtual void SetCursorTrap(bool value) abstract;
virtual const uint8 * GetKeysState() abstract;
virtual const uint8 * GetKeysPressed() abstract;
virtual void SetKeysPressed(uint32 keysym, uint8 scancode) abstract;
// Drawing
virtual Drawing::IDrawingEngine * CreateDrawingEngine(Drawing::DRAWING_ENGINE_TYPE type) abstract;