pocket-friends/pocket_friends/_development/surfaces/_black_screen.py

34 lines
1.1 KiB
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.game_fps = game_fps
self.frames = -3 * 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.fill((0, 0, 0))
text_1 = self.font.render('Press B', False, (64, 64, 64))
text_2 = self.font.render('to return', False, (64, 64, 64))
if self.frames < 0:
self.blit(text_1, (3, 20))
self.blit(text_2, (3, 40))
self.frames += 1
if self.frames > self.game_fps:
self.frames = 0
for event in pygame.event.get():
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_b:
self.running = False