twn_input: add twn_scancode.h as port of SDL_scancode.h, remove SDL2/SDL.h header usage sa for plans on having clean public headers

This commit is contained in:
2024-10-06 23:49:05 +03:00
parent 61caec7258
commit 3e972b2dad
4 changed files with 451 additions and 22 deletions

View File

@ -2,6 +2,26 @@
#define INPUT_INTERNAL_API_H
#include "twn_input.h"
#include "twn_vec.h"
#include <SDL2/SDL.h>
union ButtonCode {
SDL_Scancode scancode;
SDL_Keycode keycode;
SDL_GameControllerButton gamepad_button;
uint8_t mouse_button; /* SDL_BUTTON_ enum */
};
/* an input to which an action is bound */
/* it is not limited to literal buttons */
typedef struct Button {
enum ButtonSource source;
union ButtonCode code;
} Button;
void input_reset_state(InputState *input);