-
Notifications
You must be signed in to change notification settings - Fork 0
/
SquareDanceMain.py
43 lines (31 loc) · 1.48 KB
/
SquareDanceMain.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
43
import os, sys
import pygame
from pygame.locals import *
from SquareDanceFactory import SquareFactory
from SquareEventManager import *
from SquareDanceController import *
from SquareDanceState import *
from SquareDanceSList import *
if not pygame.font: print 'NO FONTS!'
if not pygame.mixer: print 'NO SOUND!!'
gFactory = SquareFactory("config.txt")
#A class to handle the main loop of the game and initialization of API elements
class SquareDanceMain:
def __init__(self, width = 640, height=480):
pygame.init()
self.width = width
self.height = height
self.map = None
self.state = SquareDanceState()
self.evManager = SquareEventManager()
self.screen = pygame.display.set_mode((self.width, self.height))
self.menuSystem = SquareMenuController(self.evManager, self.state, gFactory.newSquareMenu(self.state, self.screen, self.width, self.height))
self.styleList = gFactory.newStyleList( self.screen, self.width, self.height)
self.sController = gFactory.newSquareController(self.evManager, self.styleList, self.screen, gFactory.createMap(self.width,self.height), self.state, gFactory.newScore())
self.CPUTicker = SquareCPUController(self.evManager, self.state)
self.KeyBoard = SquareKeyBoardController( self.evManager, self.state)
def MainLoop(self):
self.CPUTicker.Run()
if __name__ == "__main__":
Game = SquareDanceMain(1280, 720)
Game.MainLoop()