27 lines
880 B
Python
27 lines
880 B
Python
|
import pygame
|
||
|
from pocket_friends.elements import surface
|
||
|
|
||
|
|
||
|
class Surface(surface.GameSurface):
|
||
|
def __init__(self, game_res, resources_dir, game_fps, **kwargs):
|
||
|
super().__init__(game_res, resources_dir, game_fps)
|
||
|
self.frames = 1
|
||
|
self.game_fps = game_fps
|
||
|
self.delay = 1
|
||
|
self.font = pygame.font.Font(resources_dir + '/fonts/5Pts5.ttf', 10)
|
||
|
self.bg = pygame.image.load(self.resource_dir + '/images/dev_bg.png').convert_alpha()
|
||
|
|
||
|
def update(self):
|
||
|
self.preprocess()
|
||
|
|
||
|
text = self.font.render('f: {0}'.format(self.frames), False, (128, 128, 128))
|
||
|
self.blit(text, (3, 68))
|
||
|
|
||
|
self.frames += 1
|
||
|
self.frames %= self.game_fps
|
||
|
|
||
|
for event in pygame.event.get():
|
||
|
if event.type == pygame.KEYDOWN:
|
||
|
if event.key == pygame.K_b:
|
||
|
self.running = False
|