Beispiel #1
0
 def init_display(self, res, fullscreen = None):
     display = pygame.display
     if fullscreen != False:
         screen = display.set_mode(self.res, pygame.FULLSCREEN, 32)
     else:
         screen = display.set_mode(self.res, pygame.DOUBLEBUF | pygame.RESIZABLE)
     SharedObjects.setScreen(screen)
     return display
Beispiel #2
0
 def update(self):
     SharedObjects.update()
     if self.timers.framerate.tick(self.fps):
         #print self.get_fps()
         #tick for animations etc.
         SharedObjects.setAnimationStep(self.timers.animation_timer.Update())
         #loop through events
         self.eventmanager.post()
         #draw stuff
         self.rendermanager.render(self.display, self.getScreen(), self.getFlushColor(), None)
Beispiel #3
0
 def _get_scaled_vect(self): #broken
     scale = SharedObjects.getScale()
     x0 = (self.start[0]/ scale)
     x1 = (self.current[0] / scale)
     y0 = (self.start[1]/ scale)
     y1 = (self.current[1]/ scale)
     return ((x1 - x0), (y1 - y0))
Beispiel #4
0
 def __init__(self):
     super(Game, self).__init__()
     #setup path in a new namespace
     self.paths = Paths()
     print( '%s \t Set Up Paths') %self
     #read variables into this class another way to do this
     self.read_conf(PathToString(os.path.join(self.paths.config, 'config.txt')))
     print( '%s \t Loaded Config File') %self
     self.timers = Timers(self.animstep)
     SharedObjects.setAnimationStep(self.animstep)
     SharedObjects.setScale(self.scale)
     SharedObjects.setDeltaTime(self.deltatime)
     print( '%s \t Set some variables') %self
     self.display = self.init_display(self.res, self.fullscreen)
     print( '%s \t Initialised Display') %self
     #EventManager
     self.eventmanager = EventManager()
     #RenderManager
     self.rendermanager = RenderManager()
     print( '%s \t Setup Event and Render Managers') %self