Conquer Chess
Chess and Starcraft combined
Loading...
Searching...
No Matches
game_view_layout.h
Go to the documentation of this file.
1#ifndef GAME_VIEW_LAYOUT_H
2#define GAME_VIEW_LAYOUT_H
3
4#include "ccfwd.h"
5#include "screen_rect.h"
6#include "game_coordinate.h"
7#include "screen_coordinate.h"
8#include "game_options.h"
9#include "layout.h"
10#include "side.h"
11#include "board_layout.h"
15#include <iosfwd>
16#include <map>
17#include <vector>
18
61{
62public:
63 explicit game_view_layout(
65 const int margin_width = get_default_margin_width()
66 );
67
69 const auto& get_background() const noexcept { return m_background; }
70
71 const auto& get_board() const noexcept { return m_board; }
72
73 const in_game_controls_layout& get_controls(const side player) const noexcept;
74
75 const screen_rect& get_debug(const side player) const noexcept;
76
77 const auto& get_game_info() const noexcept { return m_game_statistics; }
78
80 const screen_rect& get_log(const side player) const noexcept;
81
82 const navigation_controls_layout& get_navigation_controls(const side player) const noexcept;
83
85 const screen_rect& get_unit_info(const side player) const noexcept;
86
87private:
88
89 screen_rect m_background;
90 board_layout m_board;
91 std::map<side, in_game_controls_layout> m_controls;
92 std::map<side, screen_rect> m_debug;
93 game_options m_game_options;
94 game_statistics_widget_layout m_game_statistics;
95 std::map<side, screen_rect> m_log;
96 std::map<side, screen_rect> m_unit_info;
97};
98
101 const game_coordinate& coordinat,
102 const game_view_layout& layout
103);
104
107 const game_rect& coordinat,
108 const game_view_layout& layout
109);
110
113 const square& s,
114 const game_view_layout& layout
115);
116
119 const screen_coordinate& coordinat,
120 const game_view_layout& layout
121);
122
124int get_board_height(const game_view_layout& layout) noexcept;
125
127int get_board_width(const game_view_layout& layout) noexcept;
128
130double get_square_height(const game_view_layout& layout) noexcept;
131
133double get_square_width(const game_view_layout& layout) noexcept;
134
137
138std::ostream& operator<<(std::ostream& os, const game_view_layout& layout) noexcept;
139
140#endif // GAME_VIEW_LAYOUT_H
The layout of a chess board.
Definition board_layout.h:15
An exact coordinate anywhere on the board.
Definition game_coordinate.h:32
Options for the game.
Definition game_options.h:18
A rectangle of game coordinates.
Definition game_rect.h:12
The layout of the widget that displays the in-game statistics.
Definition game_statistics_widget_layout.h:39
The layout of the Game dialog.
Definition game_view_layout.h:61
const auto & get_game_info() const noexcept
Definition game_view_layout.h:77
const screen_rect & get_unit_info(const side player) const noexcept
Information about a unit.
Definition game_view_layout.cpp:234
const screen_rect & get_log(const side player) const noexcept
The area where the frame rate (in frames per seconds) is dsplayed.
Definition game_view_layout.cpp:213
const screen_rect & get_debug(const side player) const noexcept
Definition game_view_layout.cpp:208
const auto & get_board() const noexcept
Definition game_view_layout.h:71
const auto & get_background() const noexcept
The entire screen.
Definition game_view_layout.h:69
const in_game_controls_layout & get_controls(const side player) const noexcept
Definition game_view_layout.cpp:203
const navigation_controls_layout & get_navigation_controls(const side player) const noexcept
Definition game_view_layout.cpp:218
The layout for the controls in the game.
Definition in_game_controls_layout.h:34
The navigation controls for a player.
Definition navigation_controls_layout.h:25
The coordinate on a screen.
Definition screen_coordinate.h:12
A rectangle-shaped area on the screen.
Definition screen_rect.h:15
A chess square.
Definition square.h:58
double get_square_height(const game_view_layout &layout) noexcept
Get the height of a square.
Definition game_view_layout.cpp:224
int get_board_width(const game_view_layout &layout) noexcept
Get the width of the board in pixels.
Definition game_view_layout.cpp:197
void test_game_view_layout()
Test the game_view_layout class.
Definition game_view_layout.cpp:239
game_coordinate convert_to_game_coordinate(const screen_coordinate &coordinat, const game_view_layout &layout)
Convert an on-screen coordinat to an in-game coordinat.
Definition game_view_layout.cpp:127
screen_coordinate convert_to_screen_coordinate(const game_coordinate &coordinat, const game_view_layout &layout)
Convert an in-game coordinat to an on-screen coordinat.
Definition game_view_layout.cpp:152
int get_board_height(const game_view_layout &layout) noexcept
Get the height of the board in pixels.
Definition game_view_layout.cpp:192
std::ostream & operator<<(std::ostream &os, const game_view_layout &layout) noexcept
Definition game_view_layout.cpp:380
double get_square_width(const game_view_layout &layout) noexcept
Get the width of a square.
Definition game_view_layout.cpp:229
screen_rect convert_to_screen_rect(const game_rect &coordinat, const game_view_layout &layout)
Convert an in-game coordinat to an on-screen coordinat.
Definition game_view_layout.cpp:171
constexpr int get_default_margin_width() noexcept
Get the default margin width/size, in pixels.
Definition layout.h:7
screen_rect get_default_screen_rect() noexcept
Get the default screen rectangle.
Definition screen_rect.cpp:140
side
The side the player/piece is on.
Definition side.h:11