Toast Engine
Toggle main menu visibility
Loading...
Searching...
No Matches
project_settings.hpp
Go to the documentation of this file.
1
6
7
#pragma once
8
#include <array>
9
#include <filesystem>
10
#include <format>
11
#include <string>
12
#include <string_view>
13
#include <
toast/assets/types.hpp
>
14
#include <
toast/export.hpp
>
15
#include <vector>
16
17
namespace
toast {
18
19
class
TOAST_API
GameplaySettings
{
20
public
:
21
[[nodiscard]]
22
auto
initScene()
const
{
23
return
m_init_scene;
24
}
25
26
[[nodiscard]]
27
auto
player()
const
{
28
return
m_player;
29
}
30
31
private
:
32
friend
class
ProjectSettings;
33
assets::Handle<assets::Prefab>
m_init_scene;
34
assets::Handle<assets::Prefab>
m_player;
35
};
36
37
class
TOAST_API
UISettings
{
38
public
:
39
[[nodiscard]]
40
auto
colorScheme()
const
{
41
return
m_color_scheme;
42
}
43
45
[[nodiscard]]
46
auto
languages
() const -> const std::vector<std::
string
>& {
47
return
m_languages;
48
}
49
50
private
:
51
friend
class
ProjectSettings
;
52
assets::Handle<assets::ColorScheme>
m_color_scheme;
53
std::vector<std::string> m_languages {
"en"
};
54
};
55
56
class
TOAST_API
PhysicsSettings
{
57
private
:
58
;
59
};
60
61
class
TOAST_API ProjectSettings {
62
public
:
63
explicit
ProjectSettings(
const
std::filesystem::path& path);
64
65
static
auto
get() -> ProjectSettings* {
return
instance; }
66
67
static
auto
name() -> std::string_view {
return
instance->m_name; }
68
69
static
auto
version() -> std::string {
70
return
std::format(
"v{}.{}.{}"
, instance->m_version[0], instance->m_version[1], instance->m_version[2]);
71
}
72
74
static
auto
databases
() ->
const
std::vector<std::string>& {
return
instance->m_databases; }
75
76
static
auto
gameplaySettings() ->
const
GameplaySettings
& {
return
instance->m_gameplay_settings; }
77
78
static
auto
uiSettings() ->
const
UISettings& {
return
instance->m_ui_settings; }
79
81
static
auto
maxTickRate
() ->
unsigned
{
return
instance !=
nullptr
? instance->m_max_tick_rate : k_default_max_tick_rate; }
82
83
private
:
84
static
constexpr
unsigned
k_default_max_tick_rate = 500;
85
static
inline
ProjectSettings
* instance =
nullptr
;
86
std::string m_name;
87
std::array<unsigned, 3> m_version {1, 0, 0};
88
std::vector<std::string> m_databases;
89
GameplaySettings m_gameplay_settings;
90
UISettings m_ui_settings;
91
unsigned
m_max_tick_rate = k_default_max_tick_rate;
92
};
93
94
}
assets::Handle
Type-safe smart pointer for assets.
Definition
core_types.hpp:149
toast::GameplaySettings
Definition
project_settings.hpp:19
toast::PhysicsSettings
Definition
project_settings.hpp:56
toast::ProjectSettings
Definition
project_settings.hpp:61
toast::ProjectSettings::maxTickRate
static auto maxTickRate() -> unsigned
0 is uncapped
Definition
project_settings.hpp:81
toast::ProjectSettings::databases
static auto databases() -> const std::vector< std::string > &
List of content database names.
Definition
project_settings.hpp:74
toast::UISettings
Definition
project_settings.hpp:37
toast::UISettings::languages
auto languages() const -> const std::vector< std::string > &
the first entry is the default
Definition
project_settings.hpp:46
export.hpp
types.hpp
Concrete asset types for the Toast engine.
engine
src
toast
project_settings.hpp
Generated by
1.17.0