ajouté interface textuelle

This commit is contained in:
2025-03-02 23:36:20 +01:00
parent 857f90d646
commit 1033f3a64c
21 changed files with 646 additions and 113 deletions

View File

@@ -60,7 +60,7 @@ class GameBoard {
bool moveDown();
/**
* Tries rotating the piece and kicking it if necessary
* Tries rotating the piece and kicking it if necessary, if it's a 0° rotation, it will forcefully try kicking
* @return If it suceeded
*/
bool rotate(Rotation rotation);
@@ -89,7 +89,13 @@ class GameBoard {
* Checks is the active piece as a wall directly below one of its position
* @return If it touches a ground
*/
bool touchesGround();
bool touchesGround() const;
/**
* Computes what the piece position would be if it were to be dropped down as much as possible
* @return The lowest position before hitting a wall
*/
Position lowestPosition() const;
/**
* Locks the active piece into the board and clears lines if needed
@@ -103,34 +109,34 @@ class GameBoard {
void addGarbageRows(int number);
/**
* @return A copy of the board
* @return The board
*/
Board getBoard() const;
const Board& getBoard() const;
/**
* @return A copy of the active piece
* @return A pointer to the active piece, can be null
*/
Piece getActivePiece() const;
const std::shared_ptr<Piece>& getActivePiece() const;
/**
* @return A copy of the position of the active piece
* @return The position of the active piece
*/
Position getActivePiecePosition() const;
const Position& getActivePiecePosition() const;
/**
* @return A copy of the held piece
* @return A pointer to the held piece, can be null
*/
Piece getHeldPiece() const;
const std::shared_ptr<Piece>& getHeldPiece() const;
/**
* @return A copy of the next piece queue
* @return The next piece queue, can be empty
*/
std::vector<Piece> getNextPieces() const;
const std::vector<Piece>& getNextPieces() const;
private:
/**
* Checks if one of the active piece's positions touches a wall in the board
* @return If the active piece is in a wall
* @return If the active piece spawned in a wall
*/
bool activePieceInWall(const Position& shift = Position{0, 0}) const;