feat(game): update preview tetromino color

Preview color is dependant on chosen colorscheme in `settings.toml`.
This commit is contained in:
Kristofers Solo 2024-01-15 06:52:57 +02:00
parent 9e47d1bf2d
commit 5200a1458e
9 changed files with 7 additions and 4 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 256 B

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 371 B

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 371 B

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 262 B

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 321 B

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 321 B

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 320 B

After

Width:  |  Height:  |  Size: 4.3 KiB

View File

@ -30,7 +30,7 @@ class Preview(BaseScreen, SceenElement):
Args:
next_figures: Next figure.
"""
self.next_figure = next_figure
self.next_figure: Figure = next_figure
def draw(self) -> None:
"""Draw the preview on the preview surface."""
@ -51,9 +51,10 @@ class Preview(BaseScreen, SceenElement):
def _draw_figure(self) -> None:
"""Draw a single upcoming figure on the preview surface."""
figure_surface = self.next_figure.value.image
figure_surface: pygame.Surface = self.next_figure.value.image()
x = self.surface.get_width() / 2
y = self.surface.get_height() / 2
figure_surface.fill(self.next_figure.value.color, special_flags=pygame.BLEND_RGB_MULT)
rect = figure_surface.get_rect(center=(x, y))
self.surface.blit(figure_surface, rect)

View File

@ -22,9 +22,11 @@ class FigureConfig(NamedTuple):
color: str
filename: str
@property
def image(self) -> pygame.Surface:
# TODO: change colors of images
"""
Returns:
The image of the figure.
"""
return pygame.image.load(BASE_PATH / "assets" / "figures" / self.filename).convert_alpha()