mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-10 21:41:50 +00:00
Fix mouse pos detect
This commit is contained in:
parent
2293f6f5fa
commit
433a2eae15
4 changed files with 264 additions and 165 deletions
|
|
@ -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;
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue