Example #1
0
   def update(self):
      global running

      for event in self.window.iter_events():
         if event.type == sf.Event.CLOSED:
            running = False
         if event.type == sf.Event.TEXT_ENTERED or \
            event.type == sf.Event.KEY_PRESSED or \
            event.type == sf.Event.KEY_RELEASED:
            Manager.handle_input(event)

      #get the amount of time passed since the last update
      delta = self.clock.elapsed_time.as_seconds()
      self.clock.restart()

      #process the manager
      Manager.update(delta)

      #clear the buffer
      self.window.clear(sf.Color.WHITE)

      Manager.render(self.window, delta)

      #flush to the display
      self.window.display()