les couleurs

This commit is contained in:
2025-02-25 19:21:08 +01:00
parent 23068b8e61
commit a26d699388
8 changed files with 99 additions and 59 deletions

38
src/Pieces/Color.cpp Normal file
View File

@@ -0,0 +1,38 @@
#include "Color.h"
static const Color C_NOTHING = {255, 255, 255};
static const Color C_OUT_OF_BOUNDS = C_NOTHING;
static const Color C_GARBAGE = {150, 150, 150};
static const Color C_PURPLE = {150, 0, 255};
static const Color C_ORANGE = {255, 150, 0};
static const Color C_CYAN = {0, 255, 0};
static const Color C_PINK = {255, 0, 200};
static const Color C_YELLOW = {255, 255, 0};
static const Color C_RED = {255, 0, 0};
static const Color C_BLUE = {0, 100, 255};
static const Color C_GREEN = {0, 255, 0};
static const Color colors[] = {
C_NOTHING,
C_OUT_OF_BOUNDS,
C_GARBAGE,
C_PURPLE,
C_ORANGE,
C_CYAN,
C_PINK,
C_YELLOW,
C_RED,
C_BLUE,
C_GREEN
};
const Color& getColor(ColorEnum color) {
return colors[color];
}
void setNextPieceColor(ColorEnum& color) {
if (color == ColorEnum::GREEN)
color = ColorEnum::PURPLE;
else
color = ColorEnum(color + 1);
}