2023-05-11 09:58:44 -04:00
|
|
|
import pygame
|
|
|
|
|
|
|
|
|
|
|
|
class Surface(pygame.Surface):
|
2023-05-11 13:09:55 -04:00
|
|
|
def __init__(self, window_size, resources_dir, game_fps):
|
2023-05-11 09:58:44 -04:00
|
|
|
super().__init__(window_size, pygame.SRCALPHA)
|
2023-05-11 13:09:55 -04:00
|
|
|
self.name = 'title'
|
2023-05-11 09:58:44 -04:00
|
|
|
self.running = True
|
|
|
|
self.next_surface = None
|
2023-05-11 14:03:16 -04:00
|
|
|
self.clock = pygame.time.Clock()
|
2023-05-11 15:24:17 -04:00
|
|
|
self.additional_args = {}
|
2023-05-11 09:58:44 -04:00
|
|
|
|
2023-05-11 12:20:07 -04:00
|
|
|
self.bg = pygame.image.load(resources_dir + '/images/bg.png').convert_alpha()
|
|
|
|
self.title = pygame.image.load(resources_dir + '/images/title.png').convert_alpha()
|
2023-05-11 13:09:55 -04:00
|
|
|
self.frames = 1
|
|
|
|
self.game_fps = game_fps
|
|
|
|
self.delay = 1
|
2023-05-11 12:20:07 -04:00
|
|
|
|
2023-05-11 09:58:44 -04:00
|
|
|
def update(self):
|
2023-05-11 14:03:16 -04:00
|
|
|
self.clock.tick(self.game_fps)
|
2023-05-11 12:20:07 -04:00
|
|
|
self.blit(self.bg, (0, 0))
|
|
|
|
self.blit(self.title, (0, 0))
|
2023-05-11 09:58:44 -04:00
|
|
|
|
2023-05-11 13:09:55 -04:00
|
|
|
self.frames += 1
|
|
|
|
if self.frames > self.game_fps * self.delay:
|
|
|
|
self.next_surface = 'egg_select'
|
|
|
|
self.running = False
|