Conquer Chess
Chess and Starcraft combined
Loading...
Searching...
No Matches
Public Member Functions | Friends | List of all members
game_controller Class Reference

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_coordinateget_cursor_pos (const side player_side) const noexcept
 Get the a player's cursor position.
 
const gameget_game () const noexcept
 Get the game.
 
gameget_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_controllerget_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
 

Detailed Description

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.

Parameters
ga (state of a) game} to play on
loa lobby_options} to know who is who, e.g.. who is white

Constructor & Destructor Documentation

◆ game_controller()

game_controller::game_controller ( const game g = game(),
const lobby_options lo = lobby_options() 
)
explicit

Member Function Documentation

◆ add_user_input()

void game_controller::add_user_input ( const user_input a)

Add a user input. These will be processed in 'game::tick'.

◆ apply_user_inputs_to_game()

void game_controller::apply_user_inputs_to_game ( )

Process all actions and apply these on the game.

◆ get_cursor_pos()

const game_coordinate & game_controller::get_cursor_pos ( const side  player_side) const
noexcept

Get the a player's cursor position.

◆ get_game() [1/2]

const game & game_controller::get_game ( ) const
inlinenoexcept

Get the game.

◆ get_game() [2/2]

game & game_controller::get_game ( )
inlinenoexcept

Get the game.

◆ get_lobby_options()

const auto & game_controller::get_lobby_options ( ) const
inlinenoexcept

Get the game.

◆ get_physical_controller()

const physical_controller & game_controller::get_physical_controller ( const side  player_side) const
noexcept

Get a player's physical controller.

◆ get_selected_piece_id()

const std::optional< piece_id > & game_controller::get_selected_piece_id ( const side  s) const
noexcept

Get the selected squares, if any.

◆ get_user_inputs()

const auto & game_controller::get_user_inputs ( ) const
inlinenoexcept

Get the game users' inputs.

◆ set_cursor_pos()

void game_controller::set_cursor_pos ( const game_coordinate pos,
const side  player_side 
)
noexcept

Set a player's cursor's position.

◆ set_selected_piece_id()

void game_controller::set_selected_piece_id ( const side  s,
const std::optional< piece_id > &  selected_piece_id 
)
noexcept

Set the selected square, if any.

◆ tick()

void game_controller::tick ( const delta_t dt = delta_t(1.0))

Make the game go forward.

Friends And Related Symbol Documentation

◆ game_view

friend class game_view
friend

The documentation for this class was generated from the following files: