diff options
| author | navewindre <boneyaard@gmail.com> | 2025-09-28 02:45:10 +0200 |
|---|---|---|
| committer | navewindre <boneyaard@gmail.com> | 2025-09-28 02:45:10 +0200 |
| commit | 0db9c91742a6ab17c3d8a8b86a34392c1797740b (patch) | |
| tree | c3b2595722f601c61b342cc470e9e7f8a13891d0 /src/util/input.h | |
| parent | ae694bc0da98e45c5def20ac1d92f9d8aad65fd5 (diff) | |
input bettr
Diffstat (limited to 'src/util/input.h')
| -rw-r--r-- | src/util/input.h | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/util/input.h b/src/util/input.h index 4885f0f..ec901ab 100644 --- a/src/util/input.h +++ b/src/util/input.h @@ -23,15 +23,27 @@ struct MOUSE_DATA { 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 mouse_captured; - F32 mouse_sensitivity = 1.0f; + F32 mouse_sensitivity = .3f; + INPUT_KEYBINDS binds; LIST<ON_INPUT_FN> on_input; + }; extern INPUT_DATA input; @@ -41,5 +53,6 @@ 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 void input_capture_mouse( bool capture ); +extern void input_reset_mouse_accumulator(); #define kb_down( key ) input_is_key_down( key ) |
