2023-02-28 09:50:34 -05:00
|
|
|
import pygame
|
|
|
|
import dvd_bounce.surfaces as surfaces
|
|
|
|
|
|
|
|
# Global variables
|
2024-11-07 12:40:25 -05:00
|
|
|
SCREEN_SIZE = (1920, 1080)
|
2023-02-28 09:50:34 -05:00
|
|
|
FPS = 60
|
|
|
|
VALID_SURFACES = [
|
|
|
|
'dvd_screen'
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
def main(windowed_mode=False):
|
|
|
|
"""
|
|
|
|
Main scene manager to display the scenes of the application
|
|
|
|
:param windowed_mode: boolean to start the game in windowed mode
|
|
|
|
"""
|
|
|
|
pygame.init()
|
|
|
|
clock = pygame.time.Clock()
|
|
|
|
if windowed_mode:
|
|
|
|
window = pygame.display.set_mode(SCREEN_SIZE)
|
|
|
|
else:
|
|
|
|
window = pygame.display.set_mode(SCREEN_SIZE, pygame.FULLSCREEN)
|
|
|
|
|
|
|
|
# Starts the program with the surface 'dial' as the default
|
|
|
|
surface = getattr(globals()['surfaces'], 'dvd_screen').Surface(SCREEN_SIZE)
|
|
|
|
running = True
|
|
|
|
while running:
|
|
|
|
clock.tick(FPS)
|
|
|
|
surface.update()
|
|
|
|
|
|
|
|
window.blit(surface, surface.get_rect())
|
|
|
|
|
|
|
|
if not surface.running:
|
|
|
|
if surface.quit:
|
|
|
|
break
|
|
|
|
# Switch the surface to a new surface
|
|
|
|
next_surface = surface.next_surface
|
|
|
|
if next_surface not in VALID_SURFACES:
|
|
|
|
raise Exception('Given surface is not a valid surface!')
|
|
|
|
surface = getattr(globals()['surfaces'], next_surface).Surface(SCREEN_SIZE)
|
|
|
|
|
|
|
|
pygame.display.flip()
|
|
|
|
pygame.quit()
|