Compare commits
2 Commits
662cfe2114
...
2b0350bbdc
Author | SHA1 | Date | |
---|---|---|---|
2b0350bbdc | |||
adf7214a58 |
@ -22,7 +22,7 @@ struct GameSettings {
|
||||
RendererSettings renderer_settings;
|
||||
|
||||
JSON_SERIALIZABLE(GameSettings, renderer_settings);
|
||||
TOML_SERIALIZABLE(GameSettings, renderer_settings);
|
||||
TOML_CLASS(GameSettings, renderer_settings);
|
||||
};
|
||||
|
||||
} // namespace elemental
|
||||
|
@ -54,7 +54,7 @@ Phong::Phong(int argc, c::const_string args[], c::const_string env[])
|
||||
, video_renderer(IRenderer::GetInstance<SdlRenderer>())
|
||||
, event_emitter(Singleton::getReference<SdlEventSource>())
|
||||
, settings_file(
|
||||
paths::get_app_config_root() / "phong" / "settings.json",
|
||||
paths::get_app_config_root() / "phong" / "settings.toml",
|
||||
CreateDirs::Enabled
|
||||
)
|
||||
, settings()
|
||||
@ -62,14 +62,13 @@ Phong::Phong(int argc, c::const_string args[], c::const_string env[])
|
||||
|
||||
try {
|
||||
settings_file.read();
|
||||
settings = settings_file.get<GameSettings>();
|
||||
} catch (std::exception& except) {
|
||||
settings_file.set(kDefaultSettings);
|
||||
settings_file.write();
|
||||
settings = settings_file.get<GameSettings>();
|
||||
}
|
||||
|
||||
settings = settings_file.get<GameSettings>();
|
||||
|
||||
this->video_renderer.init(settings.renderer_settings);
|
||||
|
||||
//** EventDispatcher ** /
|
||||
|
2
Modules/External/IOCore
vendored
2
Modules/External/IOCore
vendored
@ -1 +1 @@
|
||||
Subproject commit 254dc5ee74e74884ca80f5b6c10d36959a881807
|
||||
Subproject commit f4f6ea7c81dd41e74199f2ff0d8decb06263613d
|
@ -10,6 +10,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "IOCore/util/serialization.hpp"
|
||||
#include "IOCore/util/toml.hpp"
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
@ -19,14 +20,14 @@ namespace elemental {
|
||||
struct Point {
|
||||
uint32_t x, y;
|
||||
JSON_SERIALIZABLE(Point, x, y);
|
||||
TOML_SERIALIZABLE(Point, x, y);
|
||||
TOML_CLASS(Point, x, y);
|
||||
};
|
||||
using Position2D = Point;
|
||||
|
||||
struct Area {
|
||||
uint32_t width, height;
|
||||
JSON_SERIALIZABLE(Area, width, height);
|
||||
TOML_SERIALIZABLE(Area, width, height);
|
||||
TOML_CLASS(Area, width, height);
|
||||
};
|
||||
using Resolution = Area;
|
||||
|
||||
@ -41,7 +42,7 @@ struct Rectangle {
|
||||
uint32_t& height = size.height;
|
||||
|
||||
JSON_SERIALIZABLE(Rectangle, position, size);
|
||||
TOML_SERIALIZABLE(Rectangle, position, size);
|
||||
TOML_CLASS(Rectangle, position, size);
|
||||
};
|
||||
|
||||
enum class WindowMode {
|
||||
@ -49,12 +50,18 @@ enum class WindowMode {
|
||||
Borderless = 0x01,
|
||||
Fullscreen = 0x11,
|
||||
};
|
||||
TOML_ENUM(
|
||||
WindowMode, WindowMode::Windowed, WindowMode::Borderless,
|
||||
WindowMode::Fullscreen
|
||||
);
|
||||
JSON_SERIALIZABLE_ENUM( // NOLINT(readability-identifier-length)
|
||||
WindowMode, { { WindowMode::Windowed, "Windowed" },
|
||||
{ WindowMode::Borderless, "Borderless" },
|
||||
{ WindowMode::Fullscreen, "Fullscreen" } }
|
||||
);
|
||||
enum class WindowPlacement : int { Manual = 0x00, Centered = 0x01 };
|
||||
|
||||
enum WindowPlacement { Manual, Centered };
|
||||
TOML_ENUM(WindowPlacement, Manual, Centered);
|
||||
|
||||
struct WindowParameters {
|
||||
std::string title;
|
||||
@ -66,9 +73,7 @@ struct WindowParameters {
|
||||
JSON_SERIALIZABLE(
|
||||
WindowParameters, title, mode, placement, position, size
|
||||
);
|
||||
TOML_SERIALIZABLE(
|
||||
WindowParameters, title, mode, placement, position, size
|
||||
);
|
||||
TOML_CLASS(WindowParameters, title, mode, placement, position, size);
|
||||
};
|
||||
|
||||
struct RendererSettings {
|
||||
@ -76,9 +81,10 @@ struct RendererSettings {
|
||||
Resolution resolution;
|
||||
|
||||
JSON_SERIALIZABLE(RendererSettings, window, resolution);
|
||||
TOML_SERIALIZABLE(RendererSettings, window, resolution);
|
||||
TOML_CLASS(RendererSettings, window, resolution);
|
||||
};
|
||||
|
||||
} // namespace elemental
|
||||
// clang-format off
|
||||
|
||||
// clang-format off
|
||||
// vim: set foldmethod=syntax textwidth=80 ts=8 sts=0 sw=8 noexpandtab ft=cpp.doxygen :
|
||||
|
Loading…
Reference in New Issue
Block a user