Пример #1
0
class GameEngine:
   
   def __init__(self):
      
      #initialise pygame environment
      pygame.init()
      
      #create controllers
      self.cpu_spinner = CPUSpinner(FPS)
      self.pygame_events_manager = PygameEventsManager()
      
      #create model
      self.model = Model(SCREEN_SIZE)
      self.model.change_state(GameState(self.model))
      
      #create views
      self.pygame_view = PygameView(GAME_NAME, SCREEN_SIZE, BG_COLOR)
      
      
   #--------------------------------------------------------------------------
      
   def start(self):
      
      #start the cpu spinner
      self.cpu_spinner.run()
Пример #2
0
class GameEngine:
    def __init__(self):
        # print 'gameengine init' # DEBUG
        # initialize pygame environment
        pygame.init()

        # create controllers
        self.cpu_spinner = CPUSpinner(FPS)  # regulate frame speed
        self.pygame_events_manager = PygameEventsManager(
        )  # translate keyboard inputs to Events

        # create views
        self.pygame_view = PygameView(GAME_NAME, SCREEN_SIZE,
                                      BG_COLOR)  # create screen

        # init model
        Model.change_state(
            IntroState(SCREEN_SIZE)
        )  # establish GameState, which is a derived class of State, as the current state

    #--------------------------------------------------------------------------

    def start(self):
        # print 'self.cpu_spinner.run()' # DEBUG
        # start the cpu spinner
        self.cpu_spinner.run()
Пример #3
0
 def __init__(self):
    
    #initialise pygame environment
    pygame.init()
    
    #create controllers
    self.cpu_spinner = CPUSpinner(FPS)
    self.pygame_events_manager = PygameEventsManager()
    
    #init model
    Model.change_state(GameState())
    
    #create views
    self.pygame_view = PygameView(GAME_NAME, SCREEN_SIZE, BG_COLOR)
Пример #4
0
 def __init__(self):
    
    #initialise pygame environment
    pygame.init()
    
    #create system events manager
    self.system_event_manager = SystemEventManager()
    
    #create controllers
    self.cpu_spinner = CPUSpinner(self.system_event_manager,FPS)
    self.pygame_events_manager = \
                            PygameEventsManager(self.system_event_manager)
    
    #create model
    self.model = Model(self.system_event_manager,SCREEN_SIZE)
    self.model.change_state(GameState(self.model,FPS))
    
    #create views
    self.pygame_view = PygameView(self.system_event_manager,GAME_NAME, \
                                                 SCREEN_SIZE, BG_COLOR)