MCPcopy Create free account
hub / github.com/ddnet/ddnet / TranslateKeyEventKey

Function TranslateKeyEventKey

src/engine/client/input.cpp:604–636  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

602}
603
604static int TranslateKeyEventKey(const SDL_KeyboardEvent &KeyEvent)
605{
606 // See SDL_Keymod for possible modifiers:
607 // NONE = 0
608 // LSHIFT = 1
609 // RSHIFT = 2
610 // LCTRL = 64
611 // RCTRL = 128
612 // LALT = 256
613 // RALT = 512
614 // LGUI = 1024
615 // RGUI = 2048
616 // NUM = 4096
617 // CAPS = 8192
618 // MODE = 16384
619 // Sum if you want to ignore multiple modifiers.
620 if(KeyEvent.keysym.mod & g_Config.m_InpIgnoredModifiers)
621 {
622 return KEY_UNKNOWN;
623 }
624
625 int Key = g_Config.m_InpTranslatedKeys ? SDL_GetScancodeFromKey(KeyEvent.keysym.sym) : KeyEvent.keysym.scancode;
626
627#if defined(CONF_PLATFORM_ANDROID)
628 // Translate the Android back-button to the escape-key so it can be used to open/close the menu, close popups etc.
629 if(Key == KEY_AC_BACK)
630 {
631 Key = KEY_ESCAPE;
632 }
633#endif
634
635 return Key;
636}
637
638static int TranslateMouseButtonEventKey(const SDL_MouseButtonEvent &MouseButtonEvent)
639{

Callers 1

UpdateMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected