My Project
UML Lab
|
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). | |
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.
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.
window | Reference to the SFML RenderWindow object where the piece will be drawn. |
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.
window | Reference to the SFML RenderWindow object where the piece will be drawn. |
|
friend |
Indicates if the piece is still alive (not captured).
sf::Color Piece::color |
Color of the piece (Red or Black).
bool Piece::isAlive |
bool Piece::isKing |
Indicates if the piece is a king (can move backwards).
int Piece::x |
x-coordinate of the piece on the board.
int Piece::y |
y-coordinate of the piece on the board.