-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbase_game.py
More file actions
26 lines (22 loc) · 874 Bytes
/
Copy pathbase_game.py
File metadata and controls
26 lines (22 loc) · 874 Bytes
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
import pygame
from persian_utils import render_persian_text, reshape_persian
from main import resource_path
class BaseGame:
def __init__(self, screen):
self.screen = screen
self.running = True
# فونت عمومی برای بازیها
self.font = pygame.font.Font(resource_path("Vazirmatn-VariableFont_wght.ttf"), 24)
def draw_persian_text(self, text, color, pos, font=None):
"""متد کمکی برای رندر متن فارسی در هر بازی"""
f = font if font else self.font
surf = render_persian_text(f, text, color)
self.screen.blit(surf, pos)
def handle_events(self, events):
for event in events:
if event.type == pygame.QUIT:
self.running = False
def update(self):
pass
def draw(self):
pass