Starter project for SDL2.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
914 B

  1. #ifndef IZ_CONFIG_H
  2. #define IZ_CONFIG_H
  3. #include "SDL_keycode.h"
  4. #include "../IZ_common.h"
  5. typedef struct {
  6. uint16_t width;
  7. uint16_t height;
  8. } IZ_VideoConfig;
  9. typedef SDL_KeyCode IZ_KeyCode;
  10. typedef int IZ_PadButton;
  11. typedef struct {
  12. IZ_KeyCode keyboard[CONTROLS];
  13. IZ_PadButton gamepad[CONTROLS];
  14. } IZ_ControlsConfig;
  15. typedef struct {
  16. IZ_VideoConfig video;
  17. IZ_ControlsConfig controls[PLAYERS];
  18. } IZ_Config;
  19. static const IZ_KeyCode IZ_DEFAULT_KEYBOARD_CONTROLS[CONTROLS] = {
  20. SDLK_RIGHT,
  21. SDLK_DOWN,
  22. SDLK_LEFT,
  23. SDLK_UP,
  24. SDLK_RETURN, // yes
  25. SDLK_BACKSPACE, // no
  26. SDLK_a, // action0
  27. SDLK_s, // action1
  28. SDLK_d, // action2
  29. SDLK_f, // action3
  30. SDLK_z, // action4
  31. SDLK_x, // action5
  32. SDLK_c, // action6
  33. SDLK_v, // action7
  34. SDLK_w, // action8
  35. SDLK_e, // action9
  36. };
  37. void IZ_GetConfigPath(char* config_path);
  38. void IZ_SaveConfig(IZ_Config* config);
  39. void IZ_LoadConfig(IZ_Config* config);
  40. #endif