-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgame_resources.h
190 lines (140 loc) · 4.41 KB
/
game_resources.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
#ifndef GAME_RESOURCES_H
#define GAME_RESOURCES_H
#ifndef LOGIC_ONLY
#include "chess_color.h"
#include "fonts.h"
#include "lobby_menu_textures.h"
#include "options_menu_textures.h"
#include "loading_screen_fonts.h"
#include "loading_screen_songs.h"
#include "loading_screen_textures.h"
#include "map_textures.h"
#include "message.h"
#include "piece_portrait_textures.h"
#include "piece_action_textures.h"
#include "piece_textures.h"
#include "piece_type.h"
#include "piece_action_type.h"
#include "songs.h"
#include "sound_effects.h"
#include "textures.h"
#include <optional>
/// The raw game resources,
class game_resources
{
public:
game_resources();
// Lazy loading
fonts& get_fonts() noexcept;
// Lazy loading
lobby_menu_textures& get_lobby_menu_textures() noexcept;
// Lazy loading
options_menu_textures& get_options_menu_textures() noexcept;
// Lazy loading
loading_screen_fonts& get_loading_screen_fonts() noexcept;
// Lazy loading
loading_screen_textures& get_loading_screen_textures() noexcept;
// Lazy loading
loading_screen_songs& get_loading_screen_songs() noexcept;
int get_n_fonts() noexcept;
int get_n_lobby_menu_textures() noexcept;
int get_n_options_menu_textures() noexcept;
int get_n_loading_screen_fonts() noexcept;
int get_n_loading_screen_songs() noexcept;
int get_n_loading_screen_textures() noexcept;
int get_n_map_textures() noexcept;
int get_n_piece_action_textures() noexcept;
int get_n_piece_portrait_textures() noexcept;
int get_n_piece_textures() noexcept;
int get_n_songs() noexcept;
int get_n_sound_effects() noexcept;
int get_n_textures() noexcept;
// Lazy loading
map_textures& get_map_textures() noexcept;
// Lazy loading
piece_action_textures& get_piece_action_textures() noexcept;
// Lazy loading
piece_portrait_textures& get_piece_portrait_textures() noexcept;
// Lazy loading
piece_textures& get_piece_textures() noexcept;
// Lazy loading
songs& get_songs() noexcept;
// Lazy loading
sound_effects& get_sound_effects() noexcept;
// Lazy loading
textures& get_textures() noexcept;
private:
/// Lazy loading
static std::optional<fonts> m_fonts;
/// Lazy loading
static std::optional<lobby_menu_textures> m_lobby_menu_textures;
/// Lazy loading
static std::optional<options_menu_textures> m_options_menu_textures;
/// Lazy loading
static std::optional<loading_screen_fonts> m_loading_screen_fonts;
/// Lazy loading
static loading_screen_songs * m_loading_screen_songs;
/// Lazy loading
static std::optional<loading_screen_textures> m_loading_screen_textures;
/// Lazy loading
static std::optional<map_textures> m_map_textures;
/// Lazy loading
static std::optional<piece_action_textures> m_piece_action_textures;
/// Lazy loading
static std::optional<piece_textures> m_piece_textures;
/// Lazy loading
static std::optional<piece_portrait_textures> m_piece_portrait_textures;
/// Lazy loading
static songs * m_songs;
/// Lazy loading
static sound_effects * m_sound_effects;
/// Lazy loading
static std::optional<textures> m_textures;
};
sf::Texture& get_about(game_resources& r) noexcept;
sf::Texture& get_action_icon(
game_resources& r,
piece_action_type t
) noexcept;
/// Get the Arial font
sf::Font& get_arial_font(game_resources& r) noexcept;
/// Get the Arial font
sf::Font& get_code_squared_font(game_resources& r) noexcept;
/// Get an icon that accompanies a game option,
/// to be used in the Options screen
sf::Texture& get_game_option_icon(
game_resources& r,
const options_view_item item
) noexcept;
sf::Texture& get_options(game_resources& r) noexcept;
/// Get texture of a piece
sf::Texture& get_piece(
game_resources& gr,
const race r,
const chess_color color,
const piece_type type
);
/// Get texture of a portrait of a piece
sf::Texture& get_piece_portrait(
game_resources& gr,
const race r,
const chess_color color,
const piece_type type
);
sf::Texture& get_quit(game_resources& r) noexcept;
/// Get the map for a race
sf::Texture& get_map(
game_resources& gr,
const race r
) noexcept;
sf::Texture& get_start(game_resources& r) noexcept;
sf::Texture& get_strip(game_resources& r, const chess_color c) noexcept;
sf::Texture& get_subtitle(game_resources& r) noexcept;
sf::Texture& get_title(game_resources& r) noexcept;
/// Play a sound effect
void play(
game_resources& r,
const message& effect
);
#endif // LOGIC_ONLY
#endif // GAME_RESOURCES_H