move toKeyEvent implementation into touchcontrols
This commit is contained in:
parent
67dd5dc445
commit
c5a02153c5
@ -38,14 +38,6 @@ public:
|
|||||||
return 0;
|
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
|
bool operator==(const KeyPress &o) const
|
||||||
{
|
{
|
||||||
#if USE_SDL2
|
#if USE_SDL2
|
||||||
|
@ -30,7 +30,15 @@ TouchControls *g_touchcontrols;
|
|||||||
|
|
||||||
void TouchControls::emitKeyboardEvent(const KeyPress &key, bool pressed)
|
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)
|
void TouchControls::loadButtonTexture(IGUIImage *gui_button, const std::string &path)
|
||||||
|
Loading…
Reference in New Issue
Block a user