chessCAMO
Public Member Functions | List of all members
ChessGUI Class Reference

Public Member Functions

void formPieces (vector< Sprite > &pieces, const vector< Sprite > &pieceType, const vector< Piece * > &board)
 Forms the pieces for the current board representation. More...
 
void formReservoir (vector< Sprite > &reservoir, const vector< Sprite > &pieceType)
 Forms the piece reservoir. More...
 
void drawText (RenderWindow &window, Text &text_object, string message, int size, unsigned int pos_x, unsigned int pos_y, Font font, Color color, unsigned int style)
 Draws text to the screen according to the provided parameters. More...
 
void drawRect (RenderWindow &window, RectangleShape &rect_object, float width, float height, unsigned int pos_x, unsigned int pos_y, Color color, int out_thick, Color out_color)
 Draws a rectangle in the interface window. More...
 
void getLegalMoves (vector< int > &legalMoves, int src, Chess &chess)
 Gets the squares of legal moves. More...
 
void getSideToMoveSquares (vector< int > &sideSquares, Chess &chess)
 Gets the squares of all pieces that match the turn type. More...
 
void resetPosition (string file_status, string file_promotion, string message, int move_num, Chess &chess, vector< int > &sideSquares)
 Resets the position to the corresponding position indicated by 'move_num'. More...
 
void streamIO (string file_path, string message, bool draw_or_resign, Chess &chess)
 Writes data to an output stream (file) and reads in data from an input stream (file) as need. Used for promotion and warning messages. More...
 

Member Function Documentation

◆ formPieces()

void ChessGUI::formPieces ( vector< Sprite > &  pieces,
const vector< Sprite > &  pieceType,
const vector< Piece * > &  board 
)
inline

Forms the pieces for the current board representation.

Parameters
piecesThe pieces to draw on the board
[in]pieceTypeThe piece type from which the drawn piece image is obtained
[in]boardThe current board representation

◆ formReservoir()

void ChessGUI::formReservoir ( vector< Sprite > &  reservoir,
const vector< Sprite > &  pieceType 
)
inline

Forms the piece reservoir.

Parameters
reservoirThe piece reservoir
[in]pieceTypeThe piece type from which the drawn piece image is obtained

◆ drawText()

void ChessGUI::drawText ( RenderWindow &  window,
Text &  text_object,
string  message,
int  size,
unsigned int  pos_x,
unsigned int  pos_y,
Font  font,
Color  color,
unsigned int  style 
)
inline

Draws text to the screen according to the provided parameters.

Parameters
windowThe window on which to draw
text_objectThe text object that is used
[in]messageThe message to write
[in]sizeThe size of the characters
[in]pos_xThe x position on the screen
[in]pos_yThe y position on the screen
[in]fontThe font to use
[in]colorThe color that the text will be
[in]styleThe text's style

◆ drawRect()

void ChessGUI::drawRect ( RenderWindow &  window,
RectangleShape &  rect_object,
float  width,
float  height,
unsigned int  pos_x,
unsigned int  pos_y,
Color  color,
int  out_thick,
Color  out_color 
)
inline

Draws a rectangle in the interface window.

Parameters
windowThe window on which to draw
rect_objectThe rectangle object that is used
[in]widthThe width of the rectangle
[in]heightThe height of the rectangle
[in]pos_xThe x position on the screen
[in]pos_yThe y position on the screen
[in]colorThe color that the rectangle will be filled with
[in]out_thickThe outline thickness (negative values go toward the center of rectangle)
[in]out_colorThe outline color

◆ getLegalMoves()

void ChessGUI::getLegalMoves ( vector< int > &  legalMoves,
int  src,
Chess chess 
)
inline

Gets the squares of legal moves.

Parameters
legalMovesThe legal moves vector
[in]srcThe piece's source square
chessThe chess object
Precondition
None
Postcondition
A vector of legal moves squares by reference

◆ getSideToMoveSquares()

void ChessGUI::getSideToMoveSquares ( vector< int > &  sideSquares,
Chess chess 
)
inline

Gets the squares of all pieces that match the turn type.

Parameters
sideSquaresThe squares of the side whose turn it is currently.
chessThe chess object
Precondition
None
Postcondition
A vector of squares corresponding to pieces with same color as current turn by reference

◆ resetPosition()

void ChessGUI::resetPosition ( string  file_status,
string  file_promotion,
string  message,
int  move_num,
Chess chess,
vector< int > &  sideSquares 
)
inline

Resets the position to the corresponding position indicated by 'move_num'.

Parameters
[in]file_statusThe file path for status information
[in]file_promotionThe file path for promotion information
[in]messageThe message to use as a warning
[in]move_numThe move number to revert the position to
chessThe chess object
sideSquaresThe squares of pieces whose turn it will be (updated by reference)

◆ streamIO()

void ChessGUI::streamIO ( string  file_path,
string  message,
bool  draw_or_resign,
Chess chess 
)
inline

Writes data to an output stream (file) and reads in data from an input stream (file) as need. Used for promotion and warning messages.

Parameters
[in]file_pathThe file path to read/write from
[in]messageThe message to write
[in]draw_or_resignWhether to apply the drawOrResign function
chessThe chess object

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