You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
570 B

import abc
import pygame
from config.sys import *
class DrawableItem(metaclass=abc.ABCMeta):
@abc.abstractmethod
def draw(self, window: pygame.Surface):
pass
@staticmethod
def _get_relative_pos(pos: tuple[float, float]) -> tuple[float, float]:
return (SCREEN_WIDTH - TABLE_WIDTH) / 2 + pos[0], (SCREEN_HEIGHT - TABLE_HEIGHT) / 2 + pos[1]
@staticmethod
def _get_table_pos(pos: tuple[float, float]) -> tuple[float, float]:
return pos[0] - (SCREEN_WIDTH - TABLE_WIDTH) / 2, pos[1] - (SCREEN_HEIGHT - TABLE_HEIGHT) / 2