summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Gayot <olivier.gayot@sigexec.com>2021-11-15 22:06:43 +0100
committerOlivier Gayot <olivier.gayot@sigexec.com>2021-11-15 22:06:43 +0100
commit8382b7923ddc57b80409c01e212fe716c9d22357 (patch)
tree58283992842d907a44ad56cb4b6dfc9b950bd9b8
parentf4049ca3bbd79c2c6568e519cde92836cc79769a (diff)
Change enum constants to uppercase
Signed-off-by: Olivier Gayot <olivier.gayot@sigexec.com>
-rw-r--r--cameltris/color.py18
-rw-r--r--cameltris/piece.py14
-rw-r--r--cameltris/player.py4
-rw-r--r--cameltris/screens/in_game.py8
4 files changed, 22 insertions, 22 deletions
diff --git a/cameltris/color.py b/cameltris/color.py
index 3fc2f9d..ac3e660 100644
--- a/cameltris/color.py
+++ b/cameltris/color.py
@@ -2,12 +2,12 @@ from enum import Enum
class Color(Enum):
- black = (0, 0, 0)
- white = (0xff, 0xff, 0xff)
- brown = (163, 75, 31)
- blue = (30, 34, 164)
- green = (30, 164, 59)
- red = (164, 30, 30)
- purple = (126, 30, 164)
- yellow = (164, 164, 30)
- cyan = (30, 164, 150)
+ BLACK = (0, 0, 0)
+ WHITE = (0XFF, 0XFF, 0XFF)
+ BROWN = (163, 75, 31)
+ BLUE = (30, 34, 164)
+ GREEN = (30, 164, 59)
+ RED = (164, 30, 30)
+ PURPLE = (126, 30, 164)
+ YELLOW = (164, 164, 30)
+ CYAN = (30, 164, 150)
diff --git a/cameltris/piece.py b/cameltris/piece.py
index 3636fbd..33adc37 100644
--- a/cameltris/piece.py
+++ b/cameltris/piece.py
@@ -33,7 +33,7 @@ class ZPiece(Piece):
def __init__(self):
super().__init__()
- self.square.fill(Color.blue.value)
+ self.square.fill(Color.BLUE.value)
self.elements = (self.square, self.square, None), (None, self.square, self.square), (None, None, None)
self.vertical = False
@@ -56,7 +56,7 @@ class SPiece(Piece):
def __init__(self):
super().__init__()
- self.square.fill(Color.green.value)
+ self.square.fill(Color.GREEN.value)
self.elements = (None, None, None), (None, self.square, self.square), (self.square, self.square, None)
self.vertical = False
@@ -79,7 +79,7 @@ class SquarePiece(Piece):
def __init__(self):
super().__init__()
- self.square.fill(Color.brown.value)
+ self.square.fill(Color.BROWN.value)
self.elements = ((self.square, self.square), (self.square, self.square))
@@ -87,7 +87,7 @@ class IPiece(Piece):
def __init__(self):
super().__init__()
- self.square.fill(Color.red.value)
+ self.square.fill(Color.RED.value)
self.elements = (None, None, None, None), (None, None, None, None), (self.square, self.square, self.square, self.square), (None, None, None, None)
self.vertical = False
@@ -110,7 +110,7 @@ class LPiece(Piece):
def __init__(self):
super().__init__()
- self.square.fill(Color.cyan.value)
+ self.square.fill(Color.CYAN.value)
self.elements = (None, None, None), (self.square, self.square, self.square), (None, None, self.square)
@@ -118,7 +118,7 @@ class JPiece(Piece):
def __init__(self):
super().__init__()
- self.square.fill(Color.purple.value)
+ self.square.fill(Color.PURPLE.value)
self.elements = (None, None, None), (self.square, self.square, self.square), (self.square, None, None)
@@ -126,5 +126,5 @@ class TPiece(Piece):
def __init__(self):
super().__init__()
- self.square.fill(Color.yellow.value)
+ self.square.fill(Color.YELLOW.value)
self.elements = (None, None, None), (self.square, self.square, self.square), (None, self.square, None)
diff --git a/cameltris/player.py b/cameltris/player.py
index 88d62d4..cc7c11a 100644
--- a/cameltris/player.py
+++ b/cameltris/player.py
@@ -228,7 +228,7 @@ class Player:
def refresh_piece_preview_canvas(self) -> None:
""" Refresh the display of the next piece """
- self.piece_preview_canvas.fill(Color.black.value)
+ self.piece_preview_canvas.fill(Color.BLACK.value)
non_empty_rows = list()
for row in self.next_piece.elements:
@@ -259,7 +259,7 @@ class Player:
assert self.current_piece.coord is not None
- self.grid_canvas.fill(Color.black.value)
+ self.grid_canvas.fill(Color.BLACK.value)
for row_idx, row in enumerate(self.playfield.grid):
for col_idx, element in enumerate(row):
diff --git a/cameltris/screens/in_game.py b/cameltris/screens/in_game.py
index bed8643..840c0b9 100644
--- a/cameltris/screens/in_game.py
+++ b/cameltris/screens/in_game.py
@@ -47,14 +47,14 @@ class InGame(Screen):
def refresh_right_pane_canvas(self) -> None:
for player in self.players:
- player.level_canvas.fill(Color.black.value)
- player.score_canvas.fill(Color.black.value)
+ player.level_canvas.fill(Color.BLACK.value)
+ player.score_canvas.fill(Color.BLACK.value)
if pygame.font:
score_font = pygame.font.Font(None, 56)
- player.score_canvas.blit(score_font.render(f"{player.score:08d}", True, Color.white.value), (0, 0))
- player.level_canvas.blit(score_font.render(f"{player.level:08d}", True, Color.white.value), (0, 0))
+ player.score_canvas.blit(score_font.render(f"{player.score:08d}", True, Color.WHITE.value), (0, 0))
+ player.level_canvas.blit(score_font.render(f"{player.level:08d}", True, Color.WHITE.value), (0, 0))
right_pane_canvas.blit(player.score_canvas, (2, 10))
right_pane_canvas.blit(player.level_canvas, (2, 70))