8#include <entt/locator/locator.hpp>
15#ifdef GALAXY_WIN_PLATFORM
25 auto& config = entt::locator<Config>::value();
27 config.restore<
int>(
"width", 1920,
"window");
28 config.restore<
int>(
"height", 1080,
"window");
29 config.restore<std::string>(
"icon",
"",
"window");
30 config.restore<
bool>(
"fullscreen",
false,
"window");
31 config.restore<
bool>(
"maximized",
true,
"window");
32 config.restore<
bool>(
"vsync",
false,
"window");
33 config.restore<
bool>(
"resizable",
true,
"window");
34 config.restore<
bool>(
"border",
true,
"window");
36 config.restore<
bool>(
"mouse_grabbed",
false,
"mouse");
37 config.restore<
bool>(
"cursor_show",
true,
"mouse");
38 config.restore<std::string>(
"cursor_icon",
"",
"mouse");
39 config.restore<
int>(
"x", 0,
"mouse.cursor_hotspot");
40 config.restore<
int>(
"y", 0,
"mouse.cursor_hotspot");
42 config.restore<
int>(
"audio_freq", 44100,
"audio");
44 config.restore<
int>(
"ansiotrophy", 0,
"graphics");
45 config.restore<
bool>(
"mipmap",
true,
"graphics");
46 config.restore<std::string>(
"texture_filter",
"NEAREST",
"graphics");
48 config.restore<std::string>(
"title",
"galaxy app",
"meta");
49 config.restore<std::string>(
"version",
"1.0",
"meta");
50 config.restore<std::string>(
"identifier",
"com.galaxy.app",
"meta");
51 config.restore<std::string>(
"creator",
"reworks",
"meta");
52 config.restore<std::string>(
"copyright",
"2025+ reworks",
"meta");
53 config.restore<std::string>(
"website",
"https://reworks-org.github.io/galaxy/",
"meta");
55 config.restore<std::string>(
"assets_dir",
"assets/",
"fs");
56 config.restore<std::string>(
"editor_dir",
"editor/",
"fs");
57 config.restore<std::string>(
"asset_pack",
"assets.galaxy",
"fs");
58 config.restore<
bool>(
"use_loose_assets",
true,
"fs");
59 config.restore<std::string>(
"assets_music",
"music/",
"fs");
60 config.restore<std::string>(
"assets_sfx",
"sfx/",
"fs");
61 config.restore<std::string>(
"assets_voice",
"voice/",
"fs");
62 config.restore<std::string>(
"assets_font",
"fonts/",
"fs");
63 config.restore<std::string>(
"assets_script",
"scripts/",
"fs");
64 config.restore<std::string>(
"assets_shaders",
"shaders/",
"fs");
65 config.restore<std::string>(
"assets_animation",
"animations/",
"fs");
66 config.restore<std::string>(
"assets_texture",
"textures/",
"fs");
67 config.restore<std::string>(
"assets_prefabs",
"prefabs/",
"fs");
68 config.restore<std::string>(
"assets_maps",
"maps/",
"fs");
69 config.restore<std::string>(
"assets_video",
"video/",
"fs");
70 config.restore<std::string>(
"assets_ui",
"ui/",
"fs");
77 auto& config = entt::locator<Config>::value();
79 s_window_width = *config.get<
int>(
"width",
"window");
80 s_window_height = *config.get<
int>(
"height",
"window");
81 s_window_icon = *config.get<std::string>(
"icon",
"window");
82 s_fullscreen = *config.get<
bool>(
"fullscreen",
"window");
83 s_maximized = *config.get<
bool>(
"maximized",
"window");
84 s_vsync = *config.get<
bool>(
"vsync",
"window");
85 s_resizable = *config.get<
bool>(
"resizable",
"window");
86 s_border = *config.get<
bool>(
"border",
"window");
88 s_mouse_grabbed = *config.get<
bool>(
"mouse_grabbed",
"mouse");
89 s_cursor_show = *config.get<
bool>(
"cursor_show",
"mouse");
90 s_cursor_icon = *config.get<std::string>(
"cursor_icon",
"mouse");
91 s_cursor_hotspot.x = *config.get<
int>(
"x",
"mouse.cursor_hotspot");
92 s_cursor_hotspot.y = *config.get<
int>(
"y",
"mouse.cursor_hotspot");
94 s_audio_freq = *config.get<
int>(
"audio_freq",
"audio");
96 s_ansio = *config.get<
int>(
"ansiotrophy",
"graphics");
97 s_mipmap = *config.get<
bool>(
"mipmap",
"graphics");
98 s_filtering = *config.get<std::string>(
"texture_filter",
"graphics").and_then([](std::string_view filter) {
99 return magic_enum::enum_cast<GLTextureFilter>(filter);
102 s_title = *config.get<std::string>(
"title",
"meta");
103 s_version = *config.get<std::string>(
"version",
"meta");
104 s_identifier = *config.get<std::string>(
"identifier",
"meta");
105 s_creator = *config.get<std::string>(
"creator",
"meta");
106 s_copyright = *config.get<std::string>(
"copyright",
"meta");
107 s_website = *config.get<std::string>(
"website",
"meta");
109 s_assets_dir = *config.get<std::string>(
"assets_dir",
"fs");
110 s_editor_dir = *config.get<std::string>(
"editor_dir",
"fs");
111 s_asset_pack = *config.get<std::string>(
"asset_pack",
"fs");
112 s_use_loose_assets = *config.get<
bool>(
"use_loose_assets",
"fs");
113 s_assets_music = *config.get<std::string>(
"assets_music",
"fs");
114 s_assets_sfx = *config.get<std::string>(
"assets_sfx",
"fs");
115 s_assets_voice = *config.get<std::string>(
"assets_voice",
"fs");
116 s_assets_font = *config.get<std::string>(
"assets_font",
"fs");
117 s_assets_script = *config.get<std::string>(
"assets_script",
"fs");
118 s_assets_shaders = *config.get<std::string>(
"assets_shaders",
"fs");
119 s_assets_animation = *config.get<std::string>(
"assets_animation",
"fs");
120 s_assets_texture = *config.get<std::string>(
"assets_texture",
"fs");
121 s_assets_prefabs = *config.get<std::string>(
"assets_prefabs",
"fs");
122 s_assets_maps = *config.get<std::string>(
"assets_maps",
"fs");
123 s_assets_video = *config.get<std::string>(
"assets_video",
"fs");
124 s_assets_ui = *config.get<std::string>(
"assets_ui",
"fs");
239 static std::string
log_dir =
"logs/";
245 return std::filesystem::current_path();
329#ifdef GALAXY_WIN_PLATFORM
#define GALAXY_DISABLE_WARNING_POP
#define GALAXY_DISABLE_WARNING(x)
#define GALAXY_DISABLE_WARNING_PUSH
Macro for windows platform detection.
GLTextureFilter
Mipmap filtering.
static auto window_icon() noexcept -> const std::string &
Window icon file in vfs.
static std::string s_asset_pack
static auto root_dir() noexcept -> std::filesystem::path
Current root directory of application, unless it has been changed.
static std::string s_title
static std::string s_assets_video
static std::string s_assets_prefabs
static std::string s_assets_music
static auto window_height() noexcept -> int
Window creation height.
static auto log_dir() noexcept -> const std::string &
Current root directory of application, unless it has been changed.
static auto ansiotrophy() noexcept -> int
Ansiotropic filtering level.
static auto fullscreen() noexcept -> bool
Is window started fullscreen.
static auto assets_dir_prefabs() noexcept -> const std::string &
Prefab asset location.
static auto copyright() noexcept -> const std::string &
Copyright message.
static auto assets_dir_texture() noexcept -> const std::string &
Textures asset location.
static auto vsync() noexcept -> bool
Vsync control.
static auto assets_dir_voice() noexcept -> const std::string &
Voice asset location.
static std::string s_cursor_icon
static int s_window_height
static auto mipmap() noexcept -> bool
Mipmapping.
static auto window_width() noexcept -> int
Window creation width.
static bool s_use_loose_assets
static auto assets_dir_shaders() noexcept -> const std::string &
Shaders asset location.
static std::string s_assets_sfx
static std::string s_copyright
static auto window_border() noexcept -> bool
Controls if a window has a border around it (including titlebar).
static std::string s_assets_script
static auto assets_dir_ui() noexcept -> const std::string &
UI asset location.
static auto set_settings_from_config() -> void
Set all our settings using the provided config file.
static auto use_loose_assets() noexcept -> bool
Should asset data be read from pack or assets dir.
static std::string s_assets_texture
static auto assets_dir_animation() noexcept -> const std::string &
Animation data location.
static auto assets_dir_script() noexcept -> const std::string &
Scripts asset location.
static auto assets_dir_music() noexcept -> const std::string &
Music asset location.
static int s_window_width
static auto window_resizable() noexcept -> bool
Is the window resizable.
static auto identifier() noexcept -> const std::string &
Game identifier i.e. com.galaxy.app.
static auto maximized() noexcept -> bool
Is window started maximized?
static auto texture_filter() noexcept -> GLTextureFilter
Texture filtering type.
static auto title() noexcept -> const std::string &
Game title.
static std::string s_creator
static std::string s_assets_voice
static auto cursor_show() noexcept -> bool
Is the mouse cursor visible or not.
static bool s_mouse_grabbed
static auto assets_dir() noexcept -> std::filesystem::path
Main data directory.
static auto cursor_hotspot() noexcept -> const glm::ivec2 &
Cursor selector point (hotspot).
static auto asset_pack() noexcept -> const std::string &
Name of packed assets file.
static std::filesystem::path s_assets_dir
static auto version() noexcept -> const std::string &
Game semver.
static auto audio_freq() noexcept -> int
Set audio frequency to use with SDL.
static auto mouse_grabbed() noexcept -> bool
Is the cursor grabbed.
static std::string s_assets_maps
static auto website() noexcept -> const std::string &
Website URL.
static auto assets_dir_sfx() noexcept -> const std::string &
SFX asset location.
static auto assets_dir_maps() noexcept -> const std::string &
Maps asset location.
static std::string s_assets_shaders
static bool s_cursor_show
static GLTextureFilter s_filtering
static std::string s_assets_animation
static std::filesystem::path s_editor_dir
static auto set_config_to_default() -> void
Restore all config settings to default.
static std::string s_assets_font
static std::string s_assets_ui
static auto editor_dir() noexcept -> std::filesystem::path
Directory for editor specific stuff.
static std::string s_website
static auto assets_dir_video() noexcept -> const std::string &
Video asset location.
static std::string s_version
static auto cursor_icon() noexcept -> const std::string &
Cursor texture file in vfs.
static glm::ivec2 s_cursor_hotspot
static auto assets_dir_font() noexcept -> const std::string &
Font asset location.
static auto creator() noexcept -> const std::string &
Owner.
static std::string s_window_icon
static std::string s_identifier