|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- #ifndef IZ_JOYSTICK_H
- #define IZ_JOYSTICK_H
-
- #include <SDL_joystick.h>
- #include <SDL_events.h>
- #include <minIni.h>
- #include "../IZ_action.h"
- #include "../IZ_config.h"
-
- typedef uint8_t IZ_PadButton;
-
- typedef enum {
- IZ_JOYAXIS_DIRECTION_HORIZONTAL1 = 0,
- IZ_JOYAXIS_DIRECTION_VERTICAL1 = 1,
- IZ_JOYAXIS_DIRECTION_HORIZONTAL2 = 3,
- IZ_JOYAXIS_DIRECTION_VERTICAL2 = 4,
- } IZ_JoyAxisDirection;
-
- typedef struct {
- uint16_t axis_threshold;
- IZ_PadButton control_mapping[CONTROLS];
- } IZ_JoystickConfig;
-
- typedef struct {
- SDL_Joystick* joystick_instance;
-
- IZ_JoystickConfig config;
- } IZ_JoystickState;
-
- static IZ_PadButton IZ_DEFAULT_JOYSTICK_CONTROLS[PLAYERS][CONTROLS] = {
- {
- 255,
- 255,
- 255,
- 255,
- 11,
- 10,
- 1,
- 0,
- 4,
- 3,
- 6,
- 7,
- 8,
- 9,
- 13,
- 14,
- },
- };
-
- void IZ_LoadJoystickConfig(IZ_JoystickConfig*, uint8_t);
-
- void IZ_SaveJoystickConfig(IZ_JoystickConfig*, uint8_t);
-
- void IZ_HandleJoystickEvents(SDL_Event, IZ_JoystickState*, IZ_Action*);
-
- #endif
|