ajouté interface textuelle
This commit is contained in:
@@ -12,6 +12,8 @@
|
||||
Piece::Piece(const Polyomino& polyomino, Block blockType) :
|
||||
polyomino(polyomino),
|
||||
blockType(blockType) {
|
||||
|
||||
this->rotationState = NONE;
|
||||
}
|
||||
|
||||
void Piece::rotate(Rotation rotation) {
|
||||
@@ -21,9 +23,22 @@ void Piece::rotate(Rotation rotation) {
|
||||
this->polyomino.rotate180();
|
||||
if (rotation == COUNTERCLOCKWISE)
|
||||
this->polyomino.rotateCCW();
|
||||
|
||||
this->rotationState += rotation;
|
||||
}
|
||||
|
||||
std::set<Position> Piece::getPositions() const {
|
||||
void Piece::defaultRotation() {
|
||||
if (this->rotationState == CLOCKWISE)
|
||||
this->polyomino.rotateCCW();
|
||||
if (this->rotationState == DOUBLE)
|
||||
this->polyomino.rotate180();
|
||||
if (this->rotationState == COUNTERCLOCKWISE)
|
||||
this->polyomino.rotateCW();
|
||||
|
||||
this->rotationState = NONE;
|
||||
}
|
||||
|
||||
const std::set<Position>& Piece::getPositions() const {
|
||||
return this->polyomino.getPositions();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user