コード例 #1
0
ファイル: controllerbase.py プロジェクト: parpg/parpg
 def __init__(self, 
              engine, 
              view, 
              model, 
              application):
     '''
     Constructor
     @param engine: Instance of the active fife engine
     @type engine: fife.Engine
     @param view: Instance of a GameSceneView
     @param type: parpg.GameSceneView
     @param model: The model that has the current gamestate
     @type model: parpg.GameModel
     @param application: The application that created this controller
     @type application: parpg.PARPGApplication
     @param settings: The current settings of the application
     @type settings: fife.extensions.fife_settings.Setting
     '''
     KeyListener.__init__(self, application.event_listener)        
     MouseListener.__init__(self, application.event_listener)
     CommandListener.__init__(self, application.event_listener)
     Mode.__init__(self, engine)
     self.event_manager = engine.getEventManager()
     self.view = view
     self.model = model
     self.application = application
コード例 #2
0
ファイル: controllerbase.py プロジェクト: parpg/parpg
 def pause(self, paused):
     """Stops receiving events"""
     if paused:
         KeyListener.detach(self)
         MouseListener.detach(self)
     else:
         KeyListener.attach(self, self.application.event_listener)
         MouseListener.attach(self, self.application.event_listener)
コード例 #3
0
ファイル: application.py プロジェクト: parpg/parpg
    def __init__(self, event_listener, engine, view, model):
        """Initialize the instance.
           @type engine: fife.engine
           @param engine: ???
           @type view: viewbase.ViewBase
           @param view: View that draws the current state
           @type model: GameModel
           @param model: The game model"""

        KeyListener.__init__(self, event_listener)
        MouseListener.__init__(self, event_listener)
        ConsoleExecuter.__init__(self, event_listener)
        CommandListener.__init__(self, event_listener)
        WidgetListener.__init__(self, event_listener)        
        self.engine = engine
        self.view = view
        self.model = model
        keyfilter = KeyFilter([fife.Key.ESCAPE])
        keyfilter.__disown__()        

        engine.getEventManager().setKeyFilter(keyfilter)
        self.quit = False
        self.about_window = None
        self.console = console.Console(self)