import pygame from ..elements import surface from pocket_friends.game_files.io.input_handler import InputHandler 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.title = pygame.image.load(resources_dir + '/images/debug/invalid.png').convert_alpha() self.next_surface = 'title' def update(self): self.preprocess() self.blit(self.title, (0, -4)) text = self.font.render('Frames: {0}'.format(self.frames), False, (64, 64, 64)) 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