From 82562300ffd1651657779bc528497200796c0382 Mon Sep 17 00:00:00 2001 From: Stepanov Igor Date: Sun, 5 Oct 2025 13:35:00 +0300 Subject: [PATCH] half keyboard is work --- src/window/detail/input_sdl.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/window/detail/input_sdl.cpp b/src/window/detail/input_sdl.cpp index 75af5bbba..410fdc02b 100644 --- a/src/window/detail/input_sdl.cpp +++ b/src/window/detail/input_sdl.cpp @@ -6,6 +6,7 @@ #include #include #include +#include #include #include @@ -17,13 +18,15 @@ static debug::Logger logger("input"); std::string input_util::to_string(Keycode code) { - int icode_repr = static_cast(code); - const char* name = SDL_GetKeyName(icode_repr); + auto icode_repr = static_cast(code); + const char* name = SDL_GetKeyName( + SDL_GetKeyFromScancode(icode_repr, SDL_KMOD_NONE, false) + ); return std::string(name); } Keycode input_util::keycode_from(const std::string& name) { - return static_cast(SDL_GetKeyFromName(name.c_str())); + return static_cast(SDL_GetScancodeFromName(name.c_str())); } input_sdl::input_sdl(window_sdl& window) : window(window) { @@ -79,7 +82,7 @@ void input_sdl::pollEvents() { break; case SDL_EVENT_MOUSE_MOTION: if (cursorDrag) { - delta += glm::vec2{event.motion.xrel, event.motion.yrel}; + delta += glm::vec2 {event.motion.xrel, event.motion.yrel}; } else { cursorDrag = true; }