-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
42 lines (31 loc) · 1.06 KB
/
main.py
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
36
37
38
39
40
41
42
import os
import pygame
os.chdir(os.path.abspath(os.path.dirname(__file__)))
import sys
sys.path.append(os.path.abspath(os.path.dirname(__file__)))
from assets.game_constants import SCREEN_HEIGHT, SCREEN_WIDTH
from menus.menu_context import MenuContext
# Initialize Pygame
pygame.init()
# Create the screen -- Width, Height
# TODO: Get rid of hardcode later or move to config file
pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT))
# Set Window Title
pygame.display.set_caption("Colt Express")
# Initialize menu state machine
menu = MenuContext()
# Game Loop
running = True
while running:
# Debug Print
print("entering primary game loop")
# Draw Menus (State Design Pattern -- State Machine)
menu.draw_menu()
# If there is an event affecting the game, we do something
for event in pygame.event.get():
# If Pygame receives a quit signal.
if event.type == pygame.QUIT:
print("Quit received")
exit()
# Redraws the screen. Not too sure if this is needed here for now, but meh
pygame.display.update()