Chess
Public Member Functions | Public Attributes | List of all members
Graphics Class Reference

Handles all SDL2 functionalities require to visualize the game. More...

#include <graphics.h>

Public Member Functions

 Graphics (const std::string &title)
 
void clear ()
 
void update ()
 
void draw_background ()
 
void draw_board ()
 
void draw_pieces (Chessboard &chessboard)
 
void highlight_tiles (const Chessboard &chessboard)
 
bool check_pixel_bounds (int x, int y) const
 
int pixel_to_board (const int &x, const int &y) const
 Conversion used to go from screen pixel coordinates to board indices.
 
std::pair< int, int > board_to_pixel (const int &i) const
 Conversion used to go from board indices to screen pixel coordinates.
 

Public Attributes

int selected_tile = -1
 
int king_in_check = -1
 
std::vector< int > previous_move
 
std::vector< int > possible_moves
 
bool show_possible_moves = false
 
const int grid_size = 8
 
const int screen_width = 1600
 
const int screen_height = 900
 
const int board_width = 728
 
const int upper_bound = 86
 
const int left_bound = 436
 
const int bottom_bound = 814
 
const int right_bound = 1164
 
const int tile_size = board_width / grid_size
 

Detailed Description

Handles all SDL2 functionalities require to visualize the game.


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