Fix mouse pos detect

This commit is contained in:
Stepanov Igor 2025-10-05 02:51:05 +03:00
parent 2293f6f5fa
commit 433a2eae15
4 changed files with 264 additions and 165 deletions

View file

@ -1,9 +1,15 @@
#include <SDL3/SDL_keycode.h>
#include "window/input.hpp"
#include "window/window.hpp"
struct SDL_Window;
class input_sdl final : public Input {
public:
inline static constexpr short keys_buffer_size = 1036;
inline static constexpr short mouse_keys_offset = 1024;
input_sdl();
void pollEvents() override;
@ -33,7 +39,16 @@ public:
const std::vector<Keycode>& getPressedKeys() const override;
const std::vector<uint>& getCodepoints() const override;
private:
glm::vec2 delta;
glm::vec2 cursor;
std::int32_t scroll = 0;
std::uint32_t currentFrame = 0;
std::uint32_t frames[keys_buffer_size] {};
bool keys[keys_buffer_size] {};
bool cursorLocked = false;
bool cursorDrag = false;
Bindings bindings;
std::vector<uint> codepoints;
std::vector<Keycode> pressedKeys;
std::unordered_map<Keycode, util::HandlersList<>> keyCallbacks;
};