ChessPlusPlus
WIP
cplusplus.com Community Project
|
Handles drawing graphics, such as pieces, trajectories, and boards. More...
#include <Graphics.hpp>
Public Member Functions | |
GraphicsHandler (sf::RenderWindow &display, config::ResourcesConfig &resc, config::BoardConfig &bc) | |
Constructs for a specific sf::RenderWindow given the resource and board configurations. More... | |
void | drawBackground () |
Draws the board background. More... | |
void | drawSpriteAtCell (sf::Sprite &s, std::size_t x, std::size_t y) |
Draws any sprite in the center of cell at (x, y). More... | |
void | drawPiece (piece::Piece const &p) |
Draws a piece at its real location. More... | |
void | drawPieceAt (piece::Piece const &p, sf::Vector2i const &pos) |
Draws a piece at a different location than it actually is. More... | |
void | drawTrajectory (piece::Piece const &p, bool enemy=false) |
Draws a piece's trajectory moves and capturing moves. More... | |
void | drawBoard (board::Board const &b) |
Draws a board and its pieces. More... | |
Handles drawing graphics, such as pieces, trajectories, and boards.
chesspp::gfx::GraphicsHandler::GraphicsHandler | ( | sf::RenderWindow & | display, |
config::ResourcesConfig & | resc, | ||
config::BoardConfig & | bc | ||
) |
Constructs for a specific sf::RenderWindow given the resource and board configurations.
display | The sf::RenderWindow, must outlive this instance. |
resc | The chesspp::config::ResourcesConfig, must outlive this instance. |
bc | The chesspp::config::BoardConfig, must outlive this instance. |
void chesspp::gfx::GraphicsHandler::drawBackground | ( | ) |
Draws the board background.
void chesspp::gfx::GraphicsHandler::drawBoard | ( | board::Board const & | b | ) |
Draws a board and its pieces.
b | The board to draw. |
void chesspp::gfx::GraphicsHandler::drawPiece | ( | piece::Piece const & | p | ) |
Draws a piece at its real location.
p | The piece to draw. |
void chesspp::gfx::GraphicsHandler::drawPieceAt | ( | piece::Piece const & | p, |
sf::Vector2i const & | pos | ||
) |
Draws a piece at a different location than it actually is.
p | The piece to draw. |
pos | The location to draw the piece at. |
void chesspp::gfx::GraphicsHandler::drawSpriteAtCell | ( | sf::Sprite & | s, |
std::size_t | x, | ||
std::size_t | y | ||
) |
Draws any sprite in the center of cell at (x, y).
s | The sprite to draw, centered on (x, y). Changes the sprite's position. |
void chesspp::gfx::GraphicsHandler::drawTrajectory | ( | piece::Piece const & | p, |
bool | enemy = false |
||
) |
Draws a piece's trajectory moves and capturing moves.
p | The piece for which to draw trajectory and capturings. |
enemy | true if the piece is an enemy piece, false otherwise. |