Example #1
0
class RPGApplication(PychanApplicationBase):
    """
	The main application.  It inherits fife.extensions.ApplicationBase.
	
	Implements ApplicationBase._pump().
	"""
    def __init__(self, TDS):
        super(RPGApplication, self).__init__(TDS)
        self._settings = TDS

        self._gamecontroller = GameController(self, self.engine,
                                              self._settings)

    def createListener(self):
        """
		@note: This function had to be overloaded otherwise the default
		listener would have been created.
		"""
        self._listener = ApplicationListener(self.engine, self._gamecontroller)
        return self._listener

    def requestQuit(self):
        """
		Sends the quit command to the application's listener.  We could set
		self.quitRequested to true also but this is a good example on how
		to build and dispatch a fife.Command.
		"""
        cmd = fife.Command()
        cmd.setSource(None)
        cmd.setCommandType(fife.CMD_QUIT_GAME)
        self.engine.getEventManager().dispatchCommand(cmd)

    def _pump(self):
        if self._listener.quit:
            self._gamecontroller.endGame()
            self.quit()
        else:
            self._gamecontroller.pump()

    def _getLogManager(self):
        return self._log

    logger = property(_getLogManager)
Example #2
0
class RPGApplication(ApplicationBase):
	"""
	The main application.  It inherits fife.extensions.ApplicationBase.
	
	Implements ApplicationBase._pump().
	"""
	def __init__(self, TDS):
		super(RPGApplication,self).__init__(TDS)
		self._settings = TDS
		
		self._gamecontroller = GameController(self, self.engine, self._settings)

	def createListener(self):
		"""
		@note: This function had to be overloaded otherwise the default
		listener would have been created.
		"""
		self._listener = ApplicationListener(self.engine, self._gamecontroller)
		return self._listener
		
	def requestQuit(self):
		"""
		Sends the quit command to the application's listener.  We could set
		self.quitRequested to true also but this is a good example on how
		to build and dispatch a fife.Command.
		"""
		cmd = fife.Command()
		cmd.setSource(None)
		cmd.setCommandType(fife.CMD_QUIT_GAME)
		self.engine.getEventManager().dispatchCommand(cmd)

	def _pump(self):
		if self._listener.quit:
			self._gamecontroller.endGame()
			self.quit()
		else:
			self._gamecontroller.pump()
			
			
	def _getLogManager(self):
		return self._log
		
	logger = property(_getLogManager)
Example #3
0
    def __init__(self, TDS):
        super(RPGApplication, self).__init__(TDS)
        self._settings = TDS

        self._gamecontroller = GameController(self, self.engine,
                                              self._settings)
Example #4
0
	def __init__(self, TDS):
		super(RPGApplication,self).__init__(TDS)
		self._settings = TDS
		
		self._gamecontroller = GameController(self, self.engine, self._settings)