![]() |
Conquer Chess
Chess and Starcraft combined
|
The class that acts as a controller for game}. More...
#include <game_controller.h>
Public Member Functions | |
| game_controller (const game &g=game(), const lobby_options &lo=lobby_options()) | |
| void | add_user_input (const user_input &a) |
| Add a user input. These will be processed in 'game::tick'. | |
| void | apply_user_inputs_to_game () |
| Process all actions and apply these on the game. | |
| const game_coordinate & | get_cursor_pos (const side player_side) const noexcept |
| Get the a player's cursor position. | |
| const game & | get_game () const noexcept |
| Get the game. | |
| game & | get_game () noexcept |
| Get the game. | |
| const auto & | get_lobby_options () const noexcept |
| Get the game. | |
| const std::optional< piece_id > & | get_selected_piece_id (const side s) const noexcept |
| Get the selected squares, if any. | |
| const auto & | get_user_inputs () const noexcept |
| Get the game users' inputs. | |
| const physical_controller & | get_physical_controller (const side player_side) const noexcept |
| Get a player's physical controller. | |
| void | set_cursor_pos (const game_coordinate &pos, const side player_side) noexcept |
| Set a player's cursor's position. | |
| void | set_selected_piece_id (const side s, const std::optional< piece_id > &selected_piece_id) noexcept |
| Set the selected square, if any. | |
| void | tick (const delta_t &dt=delta_t(1.0)) |
| Make the game go forward. | |
Friends | |
| class | game_view |
The class that acts as a controller for game}.
This can be thought of as a virtual person that plays the game for you.
This class does:
The most important member function is apply_user_inputs_to_game}, where the user inputs are converted to actions, which are then applied.
| g | a (state of a) game} to play on |
| lo | a lobby_options} to know who is who, e.g.. who is white |
|
explicit |
| void game_controller::add_user_input | ( | const user_input & | a | ) |
Add a user input. These will be processed in 'game::tick'.
| void game_controller::apply_user_inputs_to_game | ( | ) |
Process all actions and apply these on the game.
|
noexcept |
Get the a player's cursor position.
|
inlinenoexcept |
Get the game.
|
inlinenoexcept |
Get the game.
|
inlinenoexcept |
Get the game.
|
noexcept |
Get a player's physical controller.
|
noexcept |
Get the selected squares, if any.
|
inlinenoexcept |
Get the game users' inputs.
|
noexcept |
Set a player's cursor's position.
|
noexcept |
Set the selected square, if any.
|
friend |