move toKeyEvent implementation into touchcontrols

This commit is contained in:
y5nw 2024-12-31 00:35:23 +01:00
parent 67dd5dc445
commit c5a02153c5
2 changed files with 9 additions and 9 deletions

View File

@ -38,14 +38,6 @@ public:
return 0;
}
irr::SEvent toKeyEvent(bool pressedDown = false) const
{
irr::SEvent event;
event.EventType = EET_KEY_INPUT_EVENT;
event.KeyInput = {getKeychar(), getKeycode(), getScancode(), pressedDown, false, false};
return event;
}
bool operator==(const KeyPress &o) const
{
#if USE_SDL2

View File

@ -30,7 +30,15 @@ TouchControls *g_touchcontrols;
void TouchControls::emitKeyboardEvent(const KeyPress &key, bool pressed)
{
m_receiver->OnEvent(key.toKeyEvent(pressed));
SEvent e{};
e.EventType = EET_KEY_INPUT_EVENT;
e.KeyInput.Key = key.getKeycode();
e.KeyInput.Control = false;
e.KeyInput.Shift = false;
e.KeyInput.Char = key.getKeychar();
e.KeyInput.SystemKeyCode = key.getScancode();
e.KeyInput.PressedDown = pressed;
m_receiver->OnEvent(e);
}
void TouchControls::loadButtonTexture(IGUIImage *gui_button, const std::string &path)