-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdrawable.py
30 lines (23 loc) · 848 Bytes
/
drawable.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
from abc import abstractmethod
import pygame
import config
class Drawable():
@property
@abstractmethod
def fields(self):
return self._fields
@fields.setter
def fields(self, to_set : list[[]]):
self._fields = to_set
def draw_single_block(self, screen : pygame.Surface, block_type : int, x_rect : int, y_rect : int) -> None:
"""Function responsible for drawing single block of gameboard"""
pygame.draw.rect(
screen,
config.COLORS_FOR_BLOCK[block_type],
(config.BOARD_WITH_BORDER_COORDS.left + x_rect * config.BLOCK_SIZE,
config.BOARD_WITH_BORDER_COORDS.top + y_rect * config.BLOCK_SIZE,
config.BLOCK_SIZE, config.BLOCK_SIZE)
)
@abstractmethod
def draw(self, surface : pygame.Surface) -> None:
pass