diff options
author | Olivier Gayot <olivier.gayot@sigexec.com> | 2021-11-12 19:16:17 +0100 |
---|---|---|
committer | Olivier Gayot <olivier.gayot@sigexec.com> | 2021-11-12 19:16:17 +0100 |
commit | 75cafb53ccc32afab3f15dfb5634874fd9500c84 (patch) | |
tree | 4c7be3c1961b169844ac9cd2c71c71484c33a0ca /cameltris/screens | |
parent | f9666c85abb56b8fd1ce8b7574066543148c8316 (diff) |
Move colors in an enum in Color module
Signed-off-by: Olivier Gayot <olivier.gayot@sigexec.com>
Diffstat (limited to 'cameltris/screens')
-rw-r--r-- | cameltris/screens/in_game.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/cameltris/screens/in_game.py b/cameltris/screens/in_game.py index 87b080a..1ae20de 100644 --- a/cameltris/screens/in_game.py +++ b/cameltris/screens/in_game.py @@ -6,6 +6,7 @@ from typing import Callable, NoReturn, Optional import pygame +from ..color import Color from .screen import Screen from ..piece import * from ..playfield import PlayField @@ -186,7 +187,7 @@ class Player: self.pressing_down_countdown = None def refresh_piece_preview_canvas(self) -> None: - self.piece_preview_canvas.fill(black) + self.piece_preview_canvas.fill(Color.black.value) non_empty_rows = list() for row in self.next_piece.elements: @@ -209,7 +210,7 @@ class Player: self.piece_preview_canvas.blit(element, ((col_idx + x_offset) * 50 + 1, (row_idx + y_offset) * 50 + 1)) def refresh_grid_canvas(self) -> None: - self.grid_canvas.fill(black) + self.grid_canvas.fill(Color.black.value) for row_idx, row in enumerate(self.playfield.grid): for col_idx, element in enumerate(row): @@ -255,14 +256,14 @@ class InGame(Screen): def refresh_right_pane_canvas(self) -> None: for player in self.players: - player.level_canvas.fill(black) - player.score_canvas.fill(black) + 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, white), (0, 0)) - player.level_canvas.blit(score_font.render(f"{player.level:08d}", True, white), (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)) |