refactor: reference tile size using config
This commit is contained in:
@@ -79,9 +79,9 @@ class Tetris:
|
|||||||
|
|
||||||
# draw all game objects
|
# draw all game objects
|
||||||
if self.well:
|
if self.well:
|
||||||
self.well.draw(self.screen, self.tile_size) # TODO Should it be doing taking in tile_size?
|
self.well.draw(self.screen)
|
||||||
if self.current_piece:
|
if self.current_piece:
|
||||||
self.current_piece.draw(self.screen, self.tile_size)
|
self.current_piece.draw(self.screen)
|
||||||
|
|
||||||
# update display
|
# update display
|
||||||
pygame.display.update()
|
pygame.display.update()
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
from typing import Tuple
|
from typing import Tuple
|
||||||
import pygame
|
import pygame
|
||||||
|
|
||||||
|
from util.ConfigurationManager import ConfigurationManager
|
||||||
|
|
||||||
class Entity:
|
class Entity:
|
||||||
def __init__(self, points: Tuple, color: str, border_color: str = None):
|
def __init__(self, points: Tuple, color: str, border_color: str = None):
|
||||||
self.points = points
|
self.points = points
|
||||||
@@ -10,7 +12,9 @@ class Entity:
|
|||||||
def update(self) -> None:
|
def update(self) -> None:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def draw(self, surface: pygame.Surface, tile_size) -> None:
|
def draw(self, surface: pygame.Surface) -> None:
|
||||||
|
tile_size = ConfigurationManager.configuration["engine"]["tile-size"]
|
||||||
|
|
||||||
for square in self.points:
|
for square in self.points:
|
||||||
pygame.draw.polygon(surface, pygame.Color(self.color), square, 0)
|
pygame.draw.polygon(surface, pygame.Color(self.color), square, 0)
|
||||||
if self.border_color:
|
if self.border_color:
|
||||||
|
|||||||
Reference in New Issue
Block a user