8#include <entt/locator/locator.hpp>
15#ifdef GALAXY_WIN_PLATFORM
24 auto& config = entt::locator<Config>::value();
26 config.restore<
int>(
"width", 1920,
"window");
27 config.restore<
int>(
"height", 1080,
"window");
28 config.restore<std::string>(
"icon",
"",
"window");
29 config.restore<
bool>(
"fullscreen",
false,
"window");
30 config.restore<
bool>(
"maximized",
true,
"window");
31 config.restore<
bool>(
"vsync",
false,
"window");
32 config.restore<
bool>(
"resizable",
true,
"window");
33 config.restore<
bool>(
"border",
true,
"window");
35 config.restore<
bool>(
"mouse_grabbed",
false,
"mouse");
36 config.restore<
bool>(
"cursor_show",
true,
"mouse");
37 config.restore<std::string>(
"cursor_icon",
"",
"mouse");
38 config.restore<
int>(
"x", 0,
"mouse.cursor_hotspot");
39 config.restore<
int>(
"y", 0,
"mouse.cursor_hotspot");
41 config.restore<
int>(
"audio_freq", 44100,
"audio");
43 config.restore<std::string>(
"title",
"galaxy app",
"meta");
44 config.restore<std::string>(
"version",
"1.0",
"meta");
45 config.restore<std::string>(
"identifier",
"com.galaxy.app",
"meta");
46 config.restore<std::string>(
"creator",
"reworks",
"meta");
47 config.restore<std::string>(
"copyright",
"2025+ reworks",
"meta");
48 config.restore<std::string>(
"website",
"https://reworks-org.github.io/galaxy/",
"meta");
50 config.restore<std::string>(
"assets_dir",
"assets/",
"fs");
51 config.restore<std::string>(
"editor_dir",
"editor/",
"fs");
52 config.restore<std::string>(
"asset_pack",
"assets.galaxy",
"fs");
53 config.restore<
bool>(
"use_loose_assets",
true,
"fs");
54 config.restore<std::string>(
"assets_music",
"music/",
"fs");
55 config.restore<std::string>(
"assets_sfx",
"sfx/",
"fs");
56 config.restore<std::string>(
"assets_voice",
"voice/",
"fs");
57 config.restore<std::string>(
"assets_font",
"fonts/",
"fs");
58 config.restore<std::string>(
"assets_script",
"scripts/",
"fs");
59 config.restore<std::string>(
"assets_shaders",
"shaders/",
"fs");
60 config.restore<std::string>(
"assets_animation",
"animations/",
"fs");
61 config.restore<std::string>(
"assets_texture",
"textures/",
"fs");
62 config.restore<std::string>(
"assets_prefabs",
"prefabs/",
"fs");
63 config.restore<std::string>(
"assets_maps",
"maps/",
"fs");
64 config.restore<std::string>(
"assets_video",
"video/",
"fs");
65 config.restore<std::string>(
"assets_ui",
"ui/",
"fs");
72 auto& config = entt::locator<Config>::value();
74 s_window_width = config.get<
int>(
"width",
"window").value();
75 s_window_height = config.get<
int>(
"height",
"window").value();
76 s_window_icon = config.get<std::string>(
"icon",
"window").value();
77 s_fullscreen = config.get<
bool>(
"fullscreen",
"window").value();
78 s_maximized = config.get<
bool>(
"maximized",
"window").value();
79 s_vsync = config.get<
bool>(
"vsync",
"window").value();
80 s_resizable = config.get<
bool>(
"resizable",
"window").value();
81 s_border = config.get<
bool>(
"border",
"window").value();
83 s_mouse_grabbed = config.get<
bool>(
"mouse_grabbed",
"mouse").value();
84 s_cursor_show = config.get<
bool>(
"cursor_show",
"mouse").value();
85 s_cursor_icon = config.get<std::string>(
"cursor_icon",
"mouse").value();
86 s_cursor_hotspot.x = config.get<
int>(
"x",
"mouse.cursor_hotspot").value();
87 s_cursor_hotspot.y = config.get<
int>(
"y",
"mouse.cursor_hotspot").value();
89 s_audio_freq = config.get<
int>(
"audio_freq",
"audio").value();
91 s_title = config.get<std::string>(
"title",
"meta").value();
92 s_version = config.get<std::string>(
"version",
"meta").value();
93 s_identifier = config.get<std::string>(
"identifier",
"meta").value();
94 s_creator = config.get<std::string>(
"creator",
"meta").value();
95 s_copyright = config.get<std::string>(
"copyright",
"meta").value();
96 s_website = config.get<std::string>(
"website",
"meta").value();
98 s_assets_dir = config.get<std::string>(
"assets_dir",
"fs").value();
99 s_editor_dir = config.get<std::string>(
"editor_dir",
"fs").value();
100 s_asset_pack = config.get<std::string>(
"asset_pack",
"fs").value();
101 s_use_loose_assets = config.get<
bool>(
"use_loose_assets",
"fs").value();
102 s_assets_music = config.get<std::string>(
"assets_music",
"fs").value();
103 s_assets_sfx = config.get<std::string>(
"assets_sfx",
"fs").value();
104 s_assets_voice = config.get<std::string>(
"assets_voice",
"fs").value();
105 s_assets_font = config.get<std::string>(
"assets_font",
"fs").value();
106 s_assets_script = config.get<std::string>(
"assets_script",
"fs").value();
107 s_assets_shaders = config.get<std::string>(
"assets_shaders",
"fs").value();
108 s_assets_animation = config.get<std::string>(
"assets_animation",
"fs").value();
109 s_assets_texture = config.get<std::string>(
"assets_texture",
"fs").value();
110 s_assets_prefabs = config.get<std::string>(
"assets_prefabs",
"fs").value();
111 s_assets_maps = config.get<std::string>(
"assets_maps",
"fs").value();
112 s_assets_video = config.get<std::string>(
"assets_video",
"fs").value();
113 s_assets_ui = config.get<std::string>(
"assets_ui",
"fs").value();
213 static std::string
log_dir =
"logs/";
219 return std::filesystem::current_path();
303#ifdef GALAXY_WIN_PLATFORM
#define GALAXY_DISABLE_WARNING_POP
#define GALAXY_DISABLE_WARNING(x)
#define GALAXY_DISABLE_WARNING_PUSH
Macro for windows platform detection.
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 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 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 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 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