input system rework

This commit is contained in:
veclavtalica
2025-02-04 07:32:25 +03:00
parent 4efe80bb5a
commit 02b5ac4cc3
27 changed files with 293 additions and 786 deletions

View File

@ -13,7 +13,6 @@
union ButtonCode {
SDL_Scancode scancode;
SDL_Keycode keycode;
SDL_GameControllerButton gamepad_button;
uint8_t mouse_button; /* SDL_BUTTON_ enum */
};
@ -22,7 +21,6 @@ union ButtonCode {
typedef enum ButtonSource {
BUTTON_SOURCE_NOT_SET,
BUTTON_SOURCE_KEYBOARD_PHYSICAL,
BUTTON_SOURCE_KEYBOARD_CHARACTER,
BUTTON_SOURCE_GAMEPAD,
BUTTON_SOURCE_MOUSE,
} ButtonSource;
@ -70,6 +68,14 @@ typedef struct InputState {
} InputState;
typedef struct ControlDesc {
union {
SDL_Scancode scancode;
uint8_t mouse_button;
};
} ControlDesc;
void input_state_init(InputState *input);
void input_state_deinit(InputState *input);