mis en place la PR de simon sur les couleurs
This commit is contained in:
@@ -2,13 +2,16 @@
|
||||
|
||||
#include "Polyomino.h"
|
||||
#include "Rotation.h"
|
||||
#include "Block.h"
|
||||
#include "Color.h"
|
||||
|
||||
#include <Set>
|
||||
#include <String>
|
||||
#include <set>
|
||||
#include <string>
|
||||
|
||||
|
||||
Piece::Piece(const Polyomino& polyomino, Color color) : polyomino(polyomino), color(color) {
|
||||
Piece::Piece(const Polyomino& polyomino, Block blockType) :
|
||||
polyomino(polyomino),
|
||||
blockType(blockType) {
|
||||
}
|
||||
|
||||
void Piece::rotate(Rotation rotation) {
|
||||
@@ -20,19 +23,19 @@ void Piece::rotate(Rotation rotation) {
|
||||
this->polyomino.rotateCCW();
|
||||
}
|
||||
|
||||
std::set<Cell> Piece::getPositions() const {
|
||||
return this->polyomino.getCells();
|
||||
std::set<Position> Piece::getPositions() const {
|
||||
return this->polyomino.getPositions();
|
||||
}
|
||||
|
||||
int Piece::getLength() const {
|
||||
return this->polyomino.getLength();
|
||||
}
|
||||
|
||||
Color Piece::getColor() const {
|
||||
return this->color;
|
||||
Block Piece::getBlockType() const {
|
||||
return this->blockType;
|
||||
}
|
||||
|
||||
std::ostream& operator<<(std::ostream& os, const Piece& piece) {
|
||||
os << COLOR_CODES[piece.color] << piece.polyomino << COLOR_RESET;
|
||||
os << getConsoleColorCode(piece.blockType) << piece.polyomino << getResetConsoleColorCode();
|
||||
return os;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user