My Project
UML Lab
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Friends | List of all members
Piece Class Reference

Represents a checker piece on the board. More...

#include <piece.h>

Public Member Functions

 Piece ()
 Default constructor for the Piece class.
 
void Draw (sf::RenderWindow &window)
 Renders the checker piece on the screen.
 

Public Attributes

bool isKing
 Indicates if the piece is a king (can move backwards).
 
bool isAlive
 
int x
 x-coordinate of the piece on the board.
 
int y
 y-coordinate of the piece on the board.
 
sf::Color color
 Color of the piece (Red or Black).
 

Friends

class Board
 Indicates if the piece is still alive (not captured).
 

Detailed Description

Represents a checker piece on the board.

This class stores the state of a checker piece, including its position, color, whether it's a king, and whether it's still in play. It also provides functionality to draw the piece on the screen.

Constructor & Destructor Documentation

◆ Piece()

Piece::Piece ( )

Default constructor for the Piece class.

Renders the checker piece on the screen.

This function draws a circle shape representing the checker piece within the specified SFML RenderWindow. The piece is only drawn if it is alive (isAlive). If the piece is a king, an additional yellow outline is added to distinguish it.

Parameters
windowReference to the SFML RenderWindow object where the piece will be drawn.

Member Function Documentation

◆ Draw()

void Piece::Draw ( sf::RenderWindow & window)

Renders the checker piece on the screen.

This function draws a circle shape representing the checker piece within the specified SFML RenderWindow. The piece is only drawn if it is alive (isAlive). If the piece is a king, an additional yellow outline is added to distinguish it.

Parameters
windowReference to the SFML RenderWindow object where the piece will be drawn.

Friends And Related Symbol Documentation

◆ Board

friend class Board
friend

Indicates if the piece is still alive (not captured).

Member Data Documentation

◆ color

sf::Color Piece::color

Color of the piece (Red or Black).

◆ isAlive

bool Piece::isAlive

◆ isKing

bool Piece::isKing

Indicates if the piece is a king (can move backwards).

◆ x

int Piece::x

x-coordinate of the piece on the board.

◆ y

int Piece::y

y-coordinate of the piece on the board.


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