Conquer Chess
Chess and Starcraft combined
Loading...
Searching...
No Matches
game_options.h
Go to the documentation of this file.
1#ifndef GAME_OPTIONS_H
2#define GAME_OPTIONS_H
3
4#include "ccfwd.h"
5#include "screen_coordinate.h"
7#include "volume.h"
8#include "game_speed.h"
9
10#include <iosfwd>
11
18{
19public:
20
22
25 auto get_click_distance() const noexcept { return m_click_distance; }
26
28 auto get_damage_per_chess_move() const noexcept { return 1.0; }
29
31 auto get_game_speed() const noexcept { return m_game_speed; }
32
34 double get_message_display_time_secs() const noexcept { return 5.0; }
35
37 auto get_show_debug_info() const noexcept { return m_show_debug_info; }
38
40 auto get_show_occupied() const noexcept { return false; }
41
43 auto get_show_selected() const noexcept { return false; }
44
46 starting_position_type get_starting_position() const noexcept { return m_starting_position; }
47
49 const auto& get_music_volume() const noexcept { return m_music_volume; }
50
52 const volume& get_sound_effects_volume() const noexcept { return m_sound_effects_volume; }
53
55 void reset();
56
58 void set_game_speed(const game_speed speed) noexcept { m_game_speed = speed; }
59
61 void set_music_volume(const volume& v) noexcept { m_music_volume = v; }
62
64 void set_show_debug_info(const bool b) noexcept { m_show_debug_info = b; }
65
68
70 void set_sound_effects_volume(const volume& v) noexcept { m_sound_effects_volume = v; }
71
72private:
73
74
77 double m_click_distance;
78
80 game_speed m_game_speed;
81
83 volume m_music_volume;
84
86 #ifndef NDEBUG
87 bool m_show_debug_info{true};
88 #else
89 bool m_show_debug_info{false};
90 #endif
91
93 volume m_sound_effects_volume;
94
96 starting_position_type m_starting_position;
97};
98
100void decrease_game_speed(game_options& g) noexcept;
101
103void decrease_music_volume(game_options& g) noexcept;
104
107
110
112bool do_show_selected(const game_options& g) noexcept;
113
116constexpr double get_default_click_distance() noexcept { return 0.5; }
117
119constexpr double get_default_message_display_time_secs() noexcept { return 5.0; }
120
125
130
132const volume& get_music_volume(const game_options& g) noexcept;
133
135double get_music_volume_as_percentage(const game_options& g) noexcept;
136
138const volume& get_sound_effects_volume(const game_options& g) noexcept;
139
142
144void increase_game_speed(game_options& g) noexcept;
145
147void increase_music_volume(game_options& g) noexcept;
148
151
154
156void test_game_options();
157
158bool operator==(const game_options& lhs, const game_options& rhs) noexcept;
159bool operator!=(const game_options& lhs, const game_options& rhs) noexcept;
160std::ostream& operator<<(std::ostream& os, const game_options& options) noexcept;
161
162#endif // GAME_OPTIONS_H
Options for the game.
Definition game_options.h:18
starting_position_type get_starting_position() const noexcept
Get the starting position.
Definition game_options.h:46
void reset()
Reset all values to defaults.
Definition game_options.cpp:94
void set_starting_position(const starting_position_type starting_position) noexcept
Set the starting position.
Definition game_options.h:67
game_options()
Definition game_options.cpp:9
auto get_show_debug_info() const noexcept
Show the debug info.
Definition game_options.h:37
void set_music_volume(const volume &v) noexcept
Set the volume, as a percentage.
Definition game_options.h:61
auto get_damage_per_chess_move() const noexcept
Get the damage per chess move that all pieces deal.
Definition game_options.h:28
void set_game_speed(const game_speed speed) noexcept
Set the game speed.
Definition game_options.h:58
void set_show_debug_info(const bool b) noexcept
Set showing the debug info.
Definition game_options.h:64
auto get_show_occupied() const noexcept
Show the squares that are actually occupied by the piecs?
Definition game_options.h:40
void set_sound_effects_volume(const volume &v) noexcept
Set the sound effects volume, as a percentage.
Definition game_options.h:70
auto get_show_selected() const noexcept
Are selected units highlighted?
Definition game_options.h:43
double get_message_display_time_secs() const noexcept
How long log messages are displayed.
Definition game_options.h:34
const auto & get_music_volume() const noexcept
Get the music volume, as a percentage.
Definition game_options.h:49
auto get_game_speed() const noexcept
Get the game speed.
Definition game_options.h:31
auto get_click_distance() const noexcept
Get the distance the mouse must be maximally in for a click to connect to a piece.
Definition game_options.h:25
const volume & get_sound_effects_volume() const noexcept
Get the sound effects volume.
Definition game_options.h:52
A relative sound intensity.
Definition volume.h:10
void test_game_options()
Test this class and its free functions.
Definition game_options.cpp:103
void decrease_starting_position(game_options &g) noexcept
Decrease the sound effects volume.
Definition game_options.cpp:34
constexpr double get_default_message_display_time_secs() noexcept
How long log messages are displayed.
Definition game_options.h:119
const volume & get_music_volume(const game_options &g) noexcept
Get the music volume.
Definition game_options.cpp:54
void increase_music_volume(game_options &g) noexcept
Increase the music volume.
Definition game_options.cpp:79
starting_position_type get_starting_position(const game_options &g) noexcept
Get the starting position.
Definition game_options.cpp:69
constexpr double get_default_click_distance() noexcept
The default pixels distance for the mouse for a click to connect to a piece.
Definition game_options.h:116
void decrease_music_volume(game_options &g) noexcept
Decrease the music volume.
Definition game_options.cpp:24
void increase_game_speed(game_options &g) noexcept
Increase the game speed.
Definition game_options.cpp:74
bool do_show_selected(const game_options &g) noexcept
Are selected squares shown on-screen?
Definition game_options.cpp:39
void increase_sound_effects_volume(game_options &g) noexcept
Increase the sound effects volume.
Definition game_options.cpp:84
void increase_starting_position(game_options &g) noexcept
Increase the starting position.
Definition game_options.cpp:89
volume get_default_music_volume() noexcept
The default music volume.
Definition game_options.cpp:44
void decrease_sound_effects_volume(game_options &g) noexcept
Decrease the sound effects volume.
Definition game_options.cpp:29
double get_music_volume_as_percentage(const game_options &g) noexcept
Get the music volume as a percentage.
Definition game_options.cpp:59
volume get_default_sound_effects_volume() noexcept
The default sound effects volume.
Definition game_options.cpp:49
void decrease_game_speed(game_options &g) noexcept
Decrease the game speed.
Definition game_options.cpp:19
const volume & get_sound_effects_volume(const game_options &g) noexcept
Get the sound effects volume.
Definition game_options.cpp:64
game_speed
The game speed.
Definition game_speed.h:11
starting_position_type
The starting position type.
Definition starting_position_type.h:10