Skip to content

Commit

Permalink
move toKeyEvent implementation into touchcontrols
Browse files Browse the repository at this point in the history
  • Loading branch information
y5nw committed Dec 31, 2024
1 parent 67dd5dc commit c5a0215
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
8 changes: 0 additions & 8 deletions src/client/keycode.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,6 @@ class KeyPress
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
Expand Down
10 changes: 9 additions & 1 deletion src/gui/touchcontrols.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit c5a0215

Please sign in to comment.