feat(game): update preview tetromino color
Preview color is dependant on chosen colorscheme in `settings.toml`.
|
Before Width: | Height: | Size: 256 B After Width: | Height: | Size: 4.2 KiB |
|
Before Width: | Height: | Size: 371 B After Width: | Height: | Size: 4.3 KiB |
|
Before Width: | Height: | Size: 371 B After Width: | Height: | Size: 4.3 KiB |
|
Before Width: | Height: | Size: 262 B After Width: | Height: | Size: 4.2 KiB |
|
Before Width: | Height: | Size: 321 B After Width: | Height: | Size: 4.3 KiB |
|
Before Width: | Height: | Size: 321 B After Width: | Height: | Size: 4.3 KiB |
|
Before Width: | Height: | Size: 320 B After Width: | Height: | Size: 4.3 KiB |
@ -30,7 +30,7 @@ class Preview(BaseScreen, SceenElement):
|
|||||||
Args:
|
Args:
|
||||||
next_figures: Next figure.
|
next_figures: Next figure.
|
||||||
"""
|
"""
|
||||||
self.next_figure = next_figure
|
self.next_figure: Figure = next_figure
|
||||||
|
|
||||||
def draw(self) -> None:
|
def draw(self) -> None:
|
||||||
"""Draw the preview on the preview surface."""
|
"""Draw the preview on the preview surface."""
|
||||||
@ -51,9 +51,10 @@ class Preview(BaseScreen, SceenElement):
|
|||||||
|
|
||||||
def _draw_figure(self) -> None:
|
def _draw_figure(self) -> None:
|
||||||
"""Draw a single upcoming figure on the preview surface."""
|
"""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
|
x = self.surface.get_width() / 2
|
||||||
y = self.surface.get_height() / 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))
|
rect = figure_surface.get_rect(center=(x, y))
|
||||||
self.surface.blit(figure_surface, rect)
|
self.surface.blit(figure_surface, rect)
|
||||||
|
|
||||||
|
|||||||
@ -22,9 +22,11 @@ class FigureConfig(NamedTuple):
|
|||||||
color: str
|
color: str
|
||||||
filename: str
|
filename: str
|
||||||
|
|
||||||
@property
|
|
||||||
def image(self) -> pygame.Surface:
|
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()
|
return pygame.image.load(BASE_PATH / "assets" / "figures" / self.filename).convert_alpha()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||