8#include <entt/locator/locator.hpp>
45 auto& lua = entt::locator<sol::state>::value();
50 auto config_type = lua.new_usertype<
core::Config>(
"Config", sol::no_constructor);
53 config_type[
"has_at_root"] = sol::resolve<bool(const std::string&)>(&
core::Config::has);
54 config_type[
"has_in_section"] = sol::resolve<bool(const std::string&, const std::string&, const std::string&)>(&
core::Config::has);
67 config_type[
"set_section_bool"] = sol::resolve<void(const std::string&, const bool&, const std::string&, const std::string&)>(&
core::Config::set<bool>);
68 config_type[
"set_section_int"] = sol::resolve<void(const std::string&, const int&, const std::string&, const std::string&)>(&
core::Config::set<int>);
69 config_type[
"set_section_float"] = sol::resolve<void(const std::string&, const float&, const std::string&, const std::string&)>(&
core::Config::set<float>);
70 config_type[
"set_section_string"] = sol::resolve<void(const std::string&, const std::string&, const std::string&, const std::string&)>(&
core::Config::set<std::string>);
71 config_type[
"restore_section_bool"] = sol::resolve<void(const std::string&, const bool&, const std::string&, const std::string&)>(&
core::Config::restore<bool>);
72 config_type[
"restore_section_int"] = sol::resolve<void(const std::string&, const int&, const std::string&, const std::string&)>(&
core::Config::restore<int>);
73 config_type[
"restore_section_float"] = sol::resolve<void(const std::string&, const float&, const std::string&, const std::string&)>(&
core::Config::restore<float>);
74 config_type[
"restore_section_string"] =
76 config_type[
"get_section_bool"] = sol::resolve<bool(const std::string&, const std::string&, const std::string&)>(&
core::Config::get<bool>);
77 config_type[
"get_section_int"] = sol::resolve<int(const std::string&, const std::string&, const std::string&)>(&
core::Config::get<int>);
78 config_type[
"get_section_float"] = sol::resolve<float(const std::string&, const std::string&, const std::string&)>(&
core::Config::get<float>);
79 config_type[
"get_section_string"] = sol::resolve<std::string(const std::string&, const std::string&, const std::string&)>(&
core::Config::get<std::string>);
#define GALAXY_ZLIB_COMPLETE_CHUNK
ZLib inflate/deflate chunk size.
Allows you to read, write and manipulate JSON config files.
Value get(const std::string &key)
Retrieve a root config value.
void restore(const std::string &key, const Value &value) noexcept
Sets a new setting, only if key or value is missing.
bool empty() const
Is the config file blank.
void save()
Save the config file. Must be opened first.
bool has(const std::string &key) noexcept
Check if the config file actually has a value.
void set(const std::string &key, const Value &value) noexcept
Set a new key-value pair for the config.
std::string root_path_wrapper() noexcept
std::string editor_path_wrapper() noexcept
std::string assets_path_wrapper() noexcept
void inject_core()
Inject galaxy core services into Lua.
static auto cursor_icon() noexcept -> const std::string &
Cursor texture file in vfs.
static auto assets_dir_video() noexcept -> const std::string &
Video asset location.
static auto assets_dir_voice() noexcept -> const std::string &
Voice asset location.
static auto dt() noexcept -> double
Get galaxy delta time.
static auto window_icon() noexcept -> const std::string &
Window icon file in vfs.
static auto assets_dir_script() noexcept -> const std::string &
Scripts asset location.
static auto msaa() noexcept -> bool
Enable MSAA.
static auto vsync() noexcept -> bool
Vsync control.
static auto window_width() noexcept -> int
Window creation width.
static auto asset_pack() noexcept -> const std::string &
Name of packed assets file.
static auto window_height() noexcept -> int
Window creation height.
static auto root_dir() noexcept -> std::filesystem::path
Current root directory of application, unless it has been changed.
static auto cursor_hotspot() noexcept -> const sf::Vector2u &
Cursor selector point (hotspot).
static auto assets_dir_prefabs() noexcept -> const std::string &
Prefab asset location.
static auto assets_dir_shaders() noexcept -> const std::string &
Shaders asset location.
static auto cursor_visible() noexcept -> bool
Show/hide mouse cursor.
static auto assets_dir_animation() noexcept -> const std::string &
Animation data location.
static auto editor_dir() noexcept -> std::filesystem::path
Directory for editor specific stuff.
static auto window_title() noexcept -> const std::string &
Window title.
static auto assets_dir_font() noexcept -> const std::string &
Font asset location.
static auto cursor_grabbed() noexcept -> bool
Grab/release mouse cursor.
static auto assets_dir_maps() noexcept -> const std::string &
Maps asset location.
static auto ups() noexcept -> double
Game updates per second, independant of FPS, see "fixed timestep gameloop".
static auto assets_dir() noexcept -> std::filesystem::path
Main data directory.
static auto key_repeat() noexcept -> bool
Enable if a keypress will dispatch a single or repeating events.
static auto assets_dir_texture() noexcept -> const std::string &
Textures asset location.
static auto use_loose_assets() noexcept -> bool
Should asset data be read from pack or assets dir.
static auto assets_dir_music() noexcept -> const std::string &
Music asset location.
static auto cursor_icon_size() noexcept -> const sf::Vector2u &
Cursor icon texture size.
static auto assets_dir_sfx() noexcept -> const std::string &
SFX asset location.
static auto assets_dir_ui() noexcept -> const std::string &
UI asset location.
static auto fullscreen() noexcept -> bool
Window maximized state.