4#include "imgui/imgui.h"
21 LOG_WARN(
"InputBackend",
"Already initialized");
44 LOG_INFO(
"InputBackend",
"SDL2 Input Backend initialized");
51 LOG_INFO(
"InputBackend",
"SDL2 Input Backend shut down");
62 const uint8_t* keyboard_state = SDL_GetKeyboardState(
nullptr);
66 ImGuiIO& io = ImGui::GetIO();
70 if (io.WantTextInput) {
73 static int text_input_log_count = 0;
74 if (text_input_log_count++ < 5) {
75 LOG_DEBUG(
"InputBackend",
"Blocking game input - WantTextInput=true");
107 SDL_Event* sdl_event =
static_cast<SDL_Event*
>(event);
110 if (sdl_event->type == SDL_KEYDOWN) {
112 }
else if (sdl_event->type == SDL_KEYUP) {
180 return std::make_unique<SDL2InputBackend>();
184 LOG_WARN(
"InputBackend",
"SDL3 backend not yet implemented, using SDL2");
185 return std::make_unique<SDL2InputBackend>();
188 return std::make_unique<NullInputBackend>();
191 LOG_ERROR(
"InputBackend",
"Unknown backend type, using SDL2");
192 return std::make_unique<SDL2InputBackend>();
#define LOG_DEBUG(category, format,...)
#define LOG_ERROR(category, format,...)
#define LOG_WARN(category, format,...)
#define LOG_INFO(category, format,...)
Main namespace for the application.