pocket-friends/pocket_friends/surfaces/error_screen.py

29 lines
963 B
Python
Raw Normal View History

2023-05-12 17:34:13 -04:00
import pygame
from pocket_friends.elements import surface
2023-05-12 17:34:13 -04:00
class Surface(surface.GameSurface):
def __init__(self, game_res, resources_dir, game_fps, **kwargs):
super().__init__(game_res, resources_dir, game_fps)
2023-05-12 17:34:13 -04:00
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'
2023-05-12 17:34:13 -04:00
def update(self):
self.preprocess()
2023-05-12 17:34:13 -04:00
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:
2023-05-13 10:46:34 -04:00
if event.key == pygame.K_b:
2023-05-12 17:34:13 -04:00
self.running = False