Professional Documents
Culture Documents
Brick H
Brick H
#define BRICK_H
#include "Enums.h"
#include "Position.h"
#include <vector>
#include <iomanip>
#include "Board.h"
/**
* @brief Represents a brick in the Tetris game.
*/
class Brick
{
public:
/**
* @brief
*/
Brick() = delete;
/**
* @brief Constructs a brick with the specified brickShape.
* @param shape The shape of the brick.
* @param board The game board on which the brick is placed.
*/
Brick(const BrickShape& shape , Board& board);
/**
* @brief Retrieves the shape of the brick.
* @return The shape of the brick.
*/
inline const BrickShape& getBrickShape() const {return shape;}
/**
* @brief Retrieves the absolute position of the brick.
* @return The absolute position of the brick.
*/
inline const Position& getAbsolutePosition() const {return
absolutePosition;}
/**
* @brief Retrieves the positions of the cells occupied by the brick.
* @return A vector containing the positions of the cells occupied by the
brick.
*/
inline const std::vector<Position>& getCellsPositions() const {return
cellsPositions;}
/**
* @brief Calculates the actual positions of the cells occupied by the
brick.
* @return A vector of positions occupied by the brick.
*/
std::vector<Position> calculateCellsPositions();
/**
* @brief Deleted to prevent assignment from nullptr.
*/
Brick& operator=(const std::nullptr_t) = delete;
/**
* @brief Destructor for the Brick class.
*/
~Brick();
private:
/**
* @brief Moves the brick in the specified direction on the board.
* @param dir The direction in which to move the brick.
* @return true if the brick moved
*/
bool moveBrick(const Direction& dir);
/**
* @brief Rotates the brick in the specified direction on the board.
* @param dir The direction in which to rotate the brick.
* @return true if the brick moved
*/
bool rotateBrick(const Direction& dir); // seulment droite ou gauche
} // Tetris
#endif // BRICK_H