Source code for

from abc import ABCMeta
from yyagl.gameobject import LogicColleague, GameObject
from yyagl.engine.engine import Engine

[docs]class GameLogic(LogicColleague):
[docs] def on_start(self): pass
[docs]class GameFacade:
[docs] def demand(self, tgt_state, *args): return self.fsm.demand(tgt_state, *args)
[docs]class GameBase(GameObject, GameFacade): # it doesn't manage the window __metaclass__ = ABCMeta def __init__(self, cfg, client_cls=None): self.logic = LogicColleague(self) self.eng = Engine(cfg, self.destroy, client_cls) GameObject.__init__(self)
[docs] def destroy(self): self.logic.destroy() GameObject.destroy(self) # self.eng = self.eng.destroy() self.eng.server.destroy() self.eng.client.destroy()
[docs]class Game(GameBase): # it adds the window
[docs] def run(self): self.logic.on_start()