#include "iwa/input.hpp" #include "iwa/log.hpp" namespace iwa { KeyState getKeyState(ScanCode scanCode) noexcept { const int index = static_cast(scanCode); int numKeys = 0; const Uint8* keys = SDL_GetKeyboardState(&numKeys); if (index >= numKeys) { return {}; } return { .pressed = keys[index] > 0 }; } void captureMouse() noexcept { SDL_CaptureMouse(SDL_TRUE); } void uncaptureMouse() noexcept { SDL_CaptureMouse(SDL_FALSE); } std::pair getMouseScreenPosition() noexcept { std::pair position; SDL_GetGlobalMouseState(&position.first, &position.second); return position; } } // namespace iwa