diff --git a/src/config/config.c b/src/config/config.c new file mode 100644 index 0000000..72445f3 --- /dev/null +++ b/src/config/config.c @@ -0,0 +1,26 @@ +// vim:fileencoding=utf-8:foldmethod=marker + +#include "config.h" +#include "../wapp/wapp.h" + +wp_intern Config config = { +#ifdef USE_SDL_WINDOW_BACKEND + .window_backend = WINDOW_BACKEND_SDL, + .window_backend_name = "SDL", +#else +#error "No window backend detected" +#endif + +#ifdef USE_VULKAN_RENDER_BACKEND + .gpu_backend = GPU_BACKEND_VULKAN, + .gpu_backend_name = "Vulkan", + .shader_format = SHADER_FORMAT_SPIRV, + .shader_format_name = "spirv", +#else +#error "No render backend detected" +#endif +}; + +Config configGet(void) { + return config; +} diff --git a/src/config/config.h b/src/config/config.h new file mode 100644 index 0000000..f681aa1 --- /dev/null +++ b/src/config/config.h @@ -0,0 +1,37 @@ +// vim:fileencoding=utf-8:foldmethod=marker + +#ifndef CONFIG_H +#define CONFIG_H + +#include "../wapp/wapp.h" + +typedef enum WindowBackend { + WINDOW_BACKEND_SDL, + + COUNT_WINDOW_BACKENDS, +} WindowBackend; + +typedef enum GpuBackend { + GPU_BACKEND_VULKAN, + + COUNT_GPU_BACKENDS, +} GpuBackend; + +typedef enum ShaderFormat { + SHADER_FORMAT_SPIRV, + + COUNT_SHADER_FORMATS, +} ShaderFormat; + +typedef struct Config { + const char *window_backend_name; + const char *gpu_backend_name; + const char *shader_format_name; + WindowBackend window_backend; + GpuBackend gpu_backend; + ShaderFormat shader_format; +} Config; + +Config configGet(void); + +#endif // !CONFIG_H diff --git a/src/config/config_inc.h b/src/config/config_inc.h new file mode 100644 index 0000000..565d902 --- /dev/null +++ b/src/config/config_inc.h @@ -0,0 +1,8 @@ +// vim:fileencoding=utf-8:foldmethod=marker + +#ifndef CONFIG_INC_H +#define CONFIG_INC_H + +#include "config.h" + +#endif // !CONFIG_INC_H diff --git a/src/config/config_src.c b/src/config/config_src.c new file mode 100644 index 0000000..7c2776d --- /dev/null +++ b/src/config/config_src.c @@ -0,0 +1,3 @@ +// vim:fileencoding=utf-8:foldmethod=marker + +#include "config.c"