-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
35 lines (24 loc) · 747 Bytes
/
main.py
File metadata and controls
35 lines (24 loc) · 747 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import pygame
from lib import ui
from lib.main_menu import MainMenu
from lib.scene import Scene
INITIAL_SCREEN_SIZE = 1000, 500
GAME_TITLE = "Your game name here"
current_scene: Scene
def scene_switcher(new_scene: Scene):
global current_scene
current_scene = new_scene
def main():
pygame.init()
pygame.display.set_caption(GAME_TITLE)
screen = pygame.display.set_mode(INITIAL_SCREEN_SIZE, pygame.RESIZABLE)
ui.initialise_font()
scene_switcher(MainMenu(scene_switcher, GAME_TITLE))
while current_scene.is_running:
current_scene.handle_events()
current_scene.update()
current_scene.render(screen)
pygame.display.flip()
pygame.quit()
if __name__ == '__main__':
main()