summaryrefslogtreecommitdiff
path: root/src/util/input.h
diff options
context:
space:
mode:
authornavewindre <boneyaard@gmail.com>2025-11-28 14:41:22 +0100
committerGitHub <noreply@github.com>2025-11-28 14:41:22 +0100
commit9c05c795d7b59c5ab94fb769f315c712b37df0cd (patch)
tree16cccf8cbb88703de798066a06f94013f89a8a5a /src/util/input.h
parentf8b92ce3aa08b1445c9f956d8166830946562d12 (diff)
parent3e094f20d4dda90e0356aba3f0abc4b7c7015844 (diff)
Merge pull request #1 from navewindre/windows-compat
Windows compat
Diffstat (limited to 'src/util/input.h')
-rw-r--r--src/util/input.h21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/util/input.h b/src/util/input.h
index e174fe6..86d715c 100644
--- a/src/util/input.h
+++ b/src/util/input.h
@@ -16,19 +16,36 @@ const U32 MOUSE_WHEEL = 0x4;
struct MOUSE_DATA {
VEC2 pos;
+ VEC2 pos_delta;
U8 left;
U8 right;
U8 middle;
U8 wheel;
};
+struct INPUT_KEYBINDS {
+ U8 fwd = 'w';
+ U8 back = 's';
+ U8 left = 'a';
+ U8 right = 'd';
+
+ U8 jump = ' ';
+ U8 crouch = SDL_SCANCODE_LCTRL;
+};
+
using ON_INPUT_FN = std::function<void( SDL_Event* )>;
struct INPUT_DATA {
MOUSE_DATA mouse;
U8 keys[0xff];
+ bool mouselock;
+ F32 msens = .3f;
+ F32 myaw = 1.f;
+ F32 mpitch = 1.f;
+ INPUT_KEYBINDS binds;
LIST<ON_INPUT_FN> on_input;
+
};
extern INPUT_DATA input;
@@ -36,6 +53,8 @@ extern INPUT_DATA input;
extern void input_frame_end();
extern void input_on_event( SDL_Event* e );
extern void input_on_mouse( I32 type, I32 x, I32 y );
-extern void input_is_key_down( U32 key );
+extern U8 input_is_key_down( U32 key );
+extern void input_capture_mouse( bool capture );
+extern void input_reset_mouse_accumulator();
#define kb_down( key ) input_is_key_down( key )