2D Run-and-gun shooter inspired by One Man's Doomsday, Counter-Strike, and Metal Slug.
 
 
 
 
 
 

69 行
1.3 KiB

  1. #ifndef IZ_CONFIG_H
  2. #define IZ_CONFIG_H
  3. #include <stdlib.h>
  4. #include <string.h>
  5. #include <minIni.h>
  6. #include "../common/IZ_common.h"
  7. #include "../log/IZ_log.h"
  8. #include "../stdinc/IZ_string.h"
  9. typedef enum {
  10. IZ_CONFIG_TYPE_VOID,
  11. IZ_CONFIG_TYPE_STRING,
  12. IZ_CONFIG_TYPE_U8,
  13. IZ_CONFIG_TYPE_U16,
  14. IZ_CONFIG_TYPE_I32,
  15. IZ_CONFIG_TYPE_GUID,
  16. } IZ_ConfigType;
  17. typedef struct {
  18. void* serialize;
  19. void* deserialize;
  20. } IZ_ConfigSerializerPair;
  21. typedef struct {
  22. IZ_ConfigType type;
  23. size_t dest_size;
  24. const char* section;
  25. const char* key;
  26. const char* cmdline_option;
  27. const void* default_value;
  28. void* validator;
  29. IZ_ConfigSerializerPair transformer;
  30. void* dest;
  31. } IZ_ConfigItem;
  32. void IZ_ConfigGetDefaultPath(char*, size_t);
  33. const char* IZ_ConfigGetCommandlineOption(u8, const char*[], const char*);
  34. typedef enum {
  35. IZ_CONFIG_INITIALIZE_RESULT_ERROR = -1,
  36. IZ_CONFIG_INITIALIZE_RESULT_OK,
  37. IZ_CONFIG_INITIALIZE_RESULT_WARNING
  38. } IZ_ConfigInitializeResult;
  39. IZ_ConfigInitializeResult IZ_ConfigInitialize(IZ_ConfigItem[], const char*, u8, const char*[]);
  40. typedef i64 IZ_ConfigSaveResult;
  41. IZ_ConfigSaveResult IZ_ConfigSave(IZ_ConfigItem[], const char*);
  42. #define IZ_CONFIG_ITEM_NULL (IZ_ConfigItem) { \
  43. IZ_CONFIG_TYPE_VOID, \
  44. 0, \
  45. NULL, \
  46. NULL, \
  47. NULL, \
  48. NULL, \
  49. NULL, \
  50. { \
  51. .serialize = NULL, \
  52. .deserialize = NULL, \
  53. }, \
  54. NULL, \
  55. }
  56. #endif