Conquer Chess
Chess and Starcraft combined
Loading...
Searching...
No Matches
options_view.h
Go to the documentation of this file.
1#ifndef OPTIONS_VIEW_H
2#define OPTIONS_VIEW_H
3
4#ifndef LOGIC_ONLY
5
6#include "ccfwd.h"
7#include "chess_color.h"
9#include "options_view_item.h"
10#include "game_options.h"
12#include "controls_bar.h"
13#include "view.h"
14
15#include <SFML/Graphics.hpp>
16
18class options_view : public view
19{
20public:
21 explicit options_view();
22
24 void draw_impl() override;
25
26 const auto& get_game_options() const noexcept { return m_game_options; }
27
28 const auto& get_layout() const noexcept { return m_layout; }
29
30 const auto& get_physical_controllers() const noexcept { return m_pc; }
31
32 options_view_item get_selected() const noexcept { return m_selected; }
33
39 bool has_accepted() const noexcept { return m_has_accepted; }
40
43 bool process_event_impl(sf::Event& event) override;
44
46 void process_resize_event_impl(sf::Event& event) override;
47
52 void set_game_options(const game_options& go) noexcept { m_game_options = go; }
53
56 void set_selected(const options_view_item i);
57
58 void start_impl() override;
59
60 void stop_impl() override;
61
62 void tick_impl(const delta_t dt) override;
63
64private:
65
66 bool m_has_accepted{false};
67
68 controls_bar m_controls_bar;
69
70 game_options m_game_options;
71
72 options_view_layout m_layout;
73
76
78 options_view_item m_selected;
79
82 void decrease_selected();
83
86 void increase_selected();
87
88};
89
90void draw_panel(
91 options_view& v,
92 const screen_rect& panel_position,
93 const std::string panel_text,
94 const chess_color color
95);
96
99
102
106
109void draw_bottom_row(options_view& v, const side player_side);
110
113
116
119
122
125
128
131
133void draw_top(options_view& v);
134
135#endif // LOGIC_ONLY
136
137#endif // OPTIONS_VIEW_H
chess_color
A chess piece color.
Definition chess_color.h:10
Definition controls_bar.h:12
A change of in_game_time}.
Definition delta_t.h:12
Options for the game.
Definition game_options.h:18
The Options dialog.
Definition options_view.h:19
const auto & get_layout() const noexcept
Definition options_view.h:28
options_view_item get_selected() const noexcept
Definition options_view.h:32
void draw_impl() override
Draw the menu on the main window.
Definition options_view.cpp:277
void process_resize_event_impl(sf::Event &event) override
Process a resize event.
Definition options_view.cpp:254
void tick_impl(const delta_t dt) override
Run the game, until the user quits.
Definition options_view.cpp:434
const auto & get_physical_controllers() const noexcept
Definition options_view.h:30
void stop_impl() override
Clean up after this window has been shown.
Definition options_view.cpp:427
const auto & get_game_options() const noexcept
Definition options_view.h:26
bool has_accepted() const noexcept
Has the user accepted these settings?
Definition options_view.h:39
options_view()
Definition options_view.cpp:24
bool process_event_impl(sf::Event &event) override
Process all events.
Definition options_view.cpp:93
void set_game_options(const game_options &go) noexcept
Set the game options.
Definition options_view.h:52
void set_selected(const options_view_item i)
Select an item.
Definition options_view.cpp:268
void start_impl() override
Prepare this window for being shown.
Definition options_view.cpp:421
The physical controllers used by all players.
Definition physical_controllers.h:12
A rectangle-shaped area on the screen.
Definition screen_rect.h:15
The abstract base class of all other views.
Definition view.h:26
void draw_panel(options_view &v, const screen_rect &panel_position, const std::string panel_text, const chess_color color)
Definition options_view.cpp:79
void draw_pieces(options_view &view)
Show all the pieces in the initial position.
Definition options_view.cpp:358
void draw_game_speed(options_view &v)
Show the game speed label and value.
Definition options_view.cpp:350
void draw_sound_effects_volume(options_view &v)
Show the sound effects volume label and value.
Definition options_view.cpp:414
void draw_background(options_view &v)
Show the bottom part.
Definition options_view.cpp:308
void draw_layout_panels(options_view &v)
Show all the layout panels.
Definition options_view.cpp:391
void draw_bottom_row(options_view &v, const side player_side)
Show the left player's settings of the bottom part, i.e.
Definition options_view.cpp:330
void draw_starting_position(options_view &v)
Show the starting position label and value.
Definition options_view.cpp:371
void draw_music_volume(options_view &v)
Show the music volume label and value.
Definition options_view.cpp:402
void draw_bottom(options_view &v)
Show the bottom part.
Definition options_view.cpp:316
void draw_bottom_header(options_view &v)
Show the header of the bottom part, i.e.
Definition options_view.cpp:323
void draw_selected_panel(options_view &v)
Show the selected panel.
Definition options_view.cpp:409
void draw_top(options_view &v)
Show the top part.
Definition options_view.cpp:378
options_view_item
A selectable item at in the Options menu.
Definition options_view_item.h:12
side
The side the player/piece is on.
Definition side.h:11