Conquer Chess
Chess and Starcraft combined
Loading...
Searching...
No Matches
Functions
game_view.cpp File Reference
#include "game_view.h"
#include "board_layout.h"
#include "draw.h"
#include "draw_board.h"
#include "game.h"
#include "game_options.h"
#include "game_rect.h"
#include "game_resources.h"
#include "game_statistics_widget.h"
#include "game_view_layout.h"
#include "lobby_options.h"
#include "physical_controller.h"
#include "physical_controllers.h"
#include "replay.h"
#include "render_window.h"
#include "screen_coordinate.h"
#include "screen_rect.h"
#include "sfml_helper.h"
#include <SFML/Graphics.hpp>
#include <SFML/Graphics/Text.hpp>
#include <cassert>
#include <cmath>
#include <string>
#include <sstream>
Include dependency graph for game_view.cpp:

Functions

const physical_controllerget_physical_controller (const game_view &view, const side player_side)
 Get the controller for a certain side.
 
physical_controller_type get_physical_controller_type (const game_view &view, const side player_side)
 Get the controller type for a certain side.
 
std::string get_last_log_messages (const game_view &view, const side player) noexcept
 Get the last log messages for a player.
 
const game_view_layoutget_layout (const game_view &v) noexcept
 Get the layout.
 
const std::vector< piece > & get_pieces (const game_view &v) noexcept
 Get the pieces.
 
const game_coordinateget_cursor_pos (const game_view &view, const side player) noexcept
 Get the player position.
 
std::vector< std::string > get_controls_texts (const game_controller &c, const side player_side)
 Get the controls text for a player with a controller.
 
const in_game_timeget_time (const game_view &v) noexcept
 Get the time in the game.
 
void process_event (game_controller &c, const physical_controllers &pc, const sf::Event &event, const game_view_layout &layout)
 Process the event, by letting the controllers add actions to the game sf::Event -> controllers -> control_action.
 
void draw_board (game_view &view, const bool show_occupied)
 Show the board: squares, unit paths, pieces, health bars.
 
void draw_controls (game_view &view, const side player_side)
 Show the controls (e.g. for a unit) on-screen for a player.
 
void draw_game_statistics_widget (game_view &view)
 Show the game info, e.g. the time.
 
void draw_navigation_controls (game_view &view)
 Show the controls (e.g. for a unit) on-screen for a player.
 
void show_debug (game_view &view, const side player_side)
 Show debug info on-screen for a player.
 
void draw_log (game_view &view, const side player)
 Show the log on-screen, i.e. things the pieces say.
 
void draw_background (game_view &view)
 Show the map of the window.
 
void show_occupied_squares (game_view &view)
 Show the squares that are occupied on-screen Throws if this option is turned off.
 
void draw_pieces (game_view &view)
 Show the pieces of the board on-screen.
 
void draw_possible_moves (game_view &view)
 Show the possible moves for the selected pieces.
 
void draw_squares (game_view &view)
 Show the squares of the board on-screen.
 
void draw_cursor (game_view &view, const side player)
 Show the highlighted square under the cursor on-screen for a player.
 
void draw_unit_health_bars (game_view &view)
 Show the pieces' health bars on-screen.
 
void draw_unit_paths (game_view &view)
 Show the planned paths for the units on-screen.
 
void draw_unit_info (game_view &view, const side player_side)
 Show the selected unit(s) on-screen for a player.
 
void test_game_view ()
 OCLINT tests may be many.
 
bool would_be_valid (const game_view &view, chess_color player_color)
 Would it be a valid move if the user would press LMB or RMB?
 

Function Documentation

◆ draw_background()

void draw_background ( game_view view)

Show the map of the window.

◆ draw_board()

void draw_board ( game_view view,
const bool  show_occupied 
)

Show the board: squares, unit paths, pieces, health bars.

◆ draw_controls()

void draw_controls ( game_view view,
const side  player_side 
)

Show the controls (e.g. for a unit) on-screen for a player.

◆ draw_cursor()

void draw_cursor ( game_view view,
const side  player 
)

Show the highlighted square under the cursor on-screen for a player.

◆ draw_game_statistics_widget()

void draw_game_statistics_widget ( game_view view)

Show the game info, e.g. the time.

◆ draw_log()

void draw_log ( game_view view,
const side  player 
)

Show the log on-screen, i.e. things the pieces say.

◆ draw_navigation_controls()

void draw_navigation_controls ( game_view view)

Show the controls (e.g. for a unit) on-screen for a player.

◆ draw_pieces()

void draw_pieces ( game_view view)

Show the pieces of the board on-screen.

◆ draw_possible_moves()

void draw_possible_moves ( game_view view)

Show the possible moves for the selected pieces.

e.g. put crosses on squares that can be attacked. Does nothing if no pieces are selected

◆ draw_squares()

void draw_squares ( game_view view)

Show the squares of the board on-screen.

◆ draw_unit_health_bars()

void draw_unit_health_bars ( game_view view)

Show the pieces' health bars on-screen.

◆ draw_unit_info()

void draw_unit_info ( game_view view,
const side  player_side 
)

Show the selected unit(s) on-screen for a player.

◆ draw_unit_paths()

void draw_unit_paths ( game_view view)

Show the planned paths for the units on-screen.

◆ get_controls_texts()

std::vector< std::string > get_controls_texts ( const game_controller c,
const side  player_side 
)

Get the controls text for a player with a controller.

◆ get_cursor_pos()

const game_coordinate & get_cursor_pos ( const game_view view,
const side  player 
)
noexcept

Get the player position.

◆ get_last_log_messages()

std::string get_last_log_messages ( const game_view view,
const side  player 
)
noexcept

Get the last log messages for a player.

◆ get_layout()

const game_view_layout & get_layout ( const game_view v)
noexcept

Get the layout.

◆ get_physical_controller()

const physical_controller & get_physical_controller ( const game_view view,
const side  player_side 
)

Get the controller for a certain side.

◆ get_physical_controller_type()

physical_controller_type get_physical_controller_type ( const game_view view,
const side  player_side 
)

Get the controller type for a certain side.

◆ get_pieces()

const std::vector< piece > & get_pieces ( const game_view v)
noexcept

Get the pieces.

◆ get_time()

const in_game_time & get_time ( const game_view v)
noexcept

Get the time in the game.

◆ process_event()

void process_event ( game_controller c,
const physical_controllers pc,
const sf::Event &  event,
const game_view_layout layout 
)

Process the event, by letting the controllers add actions to the game sf::Event -> controllers -> control_action.

◆ show_debug()

void show_debug ( game_view view,
const side  player_side 
)

Show debug info on-screen for a player.

◆ show_occupied_squares()

void show_occupied_squares ( game_view view)

Show the squares that are occupied on-screen Throws if this option is turned off.

◆ test_game_view()

void test_game_view ( )

OCLINT tests may be many.

◆ would_be_valid()

bool would_be_valid ( const game_view view,
chess_color  player_color 
)

Would it be a valid move if the user would press LMB or RMB?