Flint Engine
Modular C++20 2D game engine powered by SDL3
Loading...
Searching...
No Matches
config.h
1// SPDX-License-Identifier: MIT
2// SPDX-FileCopyrightText: 2025-2026 Manuel Osorio
3#pragma once
4#include "flint/core/log.h"
5#include "flint/platform/process.h"
6
7#include <filesystem>
8#include <string>
9#include <vector>
10
11namespace Flint {
12
19 enum class GRAPHICS_BACKEND {
20 AUTO,
21 VULKAN,
22 METAL,
23 D3D12
24 };
25
26 enum class GRAPHICS_PRESENT_MODE {
27 IMMEDIATE,
28 VSYNC,
29 MAILBOX
30 };
31
37 inline GRAPHICS_BACKEND resolveBackend(GRAPHICS_BACKEND backend) {
38 if (backend != GRAPHICS_BACKEND::AUTO) {
39 return backend;
40 }
41
42#if defined(__APPLE__)
43 return GRAPHICS_BACKEND::METAL;
44#elif defined(_WIN32) || defined(__linux__)
45 return GRAPHICS_BACKEND::VULKAN;
46#else
47 return GRAPHICS_BACKEND::VULKAN;
48#endif
49 }
50
57 inline const char *getGpuDriverHint(GRAPHICS_BACKEND backend) {
58 switch (backend) {
59 case GRAPHICS_BACKEND::VULKAN:
60 {
61 return "VULKAN";
62 }
63 case GRAPHICS_BACKEND::METAL:
64 {
65 return "METAL";
66 }
67 case GRAPHICS_BACKEND::D3D12:
68 {
69 return "direct3d12";
70 }
71 case GRAPHICS_BACKEND::AUTO:
72 default:
73 {
74 return nullptr;
75 }
76 }
77 }
78
83 std::string appName = "Flint App";
84 std::string appVersion = "0.1.0";
85 std::string appIdentifier = "com.example.flint-app";
87 std::string windowTitle = "Flint";
88 int width = 1280;
89 int height = 720;
91 bool resizable = true;
92 bool fullscreen = false;
94 std::filesystem::path assetRoot = "assets";
95 };
96
101 GRAPHICS_BACKEND backend = GRAPHICS_BACKEND::AUTO;
102 GRAPHICS_PRESENT_MODE presentMode =
103 GRAPHICS_PRESENT_MODE::VSYNC;
105 float maxFPS = 0;
107 bool enableAudio = true;
108 bool enableGamepads = true;
109 bool enableHaptics = true;
110 bool verboseSdlLogging = false;
111 bool initTrueTypeFont = true;
112 bool embedDefaultFont = true;
114#ifdef NDEBUG
115 bool enableAssetHotReload = false;
116#else
117 bool enableAssetHotReload = true;
118#endif
119 };
120
122#ifdef NDEBUG
123 LOG_LEVEL engineLevel = LOG_LEVEL::Warn;
124 LOG_LEVEL applicationLevel = LOG_LEVEL::Info;
125#else
126 LOG_LEVEL engineLevel = LOG_LEVEL::Debug;
127 LOG_LEVEL applicationLevel = LOG_LEVEL::Debug;
128#endif
129 };
130
132 bool enabled = false;
133 std::vector<std::filesystem::path> watchDirectories;
134 std::vector<std::filesystem::path> excludePaths;
135 ProcessCommand buildCommand;
136 };
137
141 struct FlintConfig {
144 LoggingConfig logging{};
145 CodeHotReloadConfig codeHotReload{};
146 };
147}
User-facing metadata and window defaults for a Flint-powered application.
Definition config.h:82
std::string appName
Definition config.h:83
std::string appVersion
Definition config.h:84
std::filesystem::path assetRoot
Definition config.h:94
std::string appIdentifier
Definition config.h:85
std::string windowTitle
Definition config.h:87
Engine initialization toggles that control runtime systems and GPU behavior.
Definition config.h:100
GRAPHICS_BACKEND backend
Definition config.h:101
GRAPHICS_PRESENT_MODE presentMode
Definition config.h:102
Aggregate configuration passed to the engine bootstrap code.
Definition config.h:141
ApplicationConfig app
Definition config.h:142
EngineConfig engine
Definition config.h:143