Re-implementation of Izanami game engine
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.

62 lines
1.4 KiB

  1. #ifndef IZ_CONFIG_H
  2. #define IZ_CONFIG_H
  3. #include <stdio.h>
  4. #include <stdlib.h>
  5. #if _WIN64
  6. #include <windows.h>
  7. #include <fileapi.h>
  8. #endif
  9. #include "../adapter/framework/IZ_keyboard.h"
  10. #include "../core/IZ_constants.h"
  11. #include "../logging/IZ_log.h"
  12. #include "../input/IZ_action.h"
  13. #include "IZ_config_mapping.h"
  14. #include "IZ_config_pool.h"
  15. #include "IZ_config_window.h"
  16. /**
  17. * File path of the configuration file.
  18. */
  19. static const char* IZ_CONFIG_FILE_PATH = "config.ini";
  20. /**
  21. * Structure that defines the application's internal configuration.
  22. */
  23. typedef struct {
  24. /**
  25. * Window configuration.
  26. */
  27. IZ_ConfigWindow window;
  28. /**
  29. * Pool configuration.
  30. */
  31. IZ_ConfigPool pool;
  32. /**
  33. * Keyboard and joystick mappings for each controllable agent.
  34. */
  35. IZ_ConfigMapping mapping[IZ_MAX_PLAYERS];
  36. } IZ_Config;
  37. /**
  38. * Writes the configuration to a file.
  39. * @param config The pointer to the configuration data.
  40. * @param filename The filename of the destination file.
  41. * @return Result code of the operation.
  42. */
  43. unsigned int IZ_ConfigSave(IZ_Config* config, const char* filename);
  44. /**
  45. * Reads the configuration from a file.
  46. * @param config The pointer to the configuration data.
  47. * @param filename The filename of the destination file.
  48. * @return Error message, or NULL if there are no errors.
  49. */
  50. unsigned int IZ_ConfigLoad(IZ_Config* config, const char* filename);
  51. #endif