base.py 927B

1234567891011121314151617181920212223242526272829303132333435
  1. # coding: utf-8
  2. from sandbox.tile.simulation.subject import Man as ManSubject
  3. from sandbox.tile.gui.actor import Man as ManActor
  4. from synergine2_cocos2d.terminal import GameTerminal
  5. class CocosTerminal(GameTerminal):
  6. subscribed_events = [
  7. ]
  8. def __init__(self, *args, asynchronous: bool, map_dir_path: str, **kwargs):
  9. super().__init__(*args, **kwargs)
  10. self.asynchronous = asynchronous
  11. self.map_dir_path = map_dir_path
  12. def run(self):
  13. from sandbox.tile.gui.base import Game
  14. from synergine2_cocos2d.gui import SubjectMapper
  15. self.gui = Game(
  16. self.config,
  17. self.logger,
  18. self,
  19. map_dir_path=self.map_dir_path,
  20. )
  21. # TODO: Defind on some other place ?
  22. self.gui.subject_mapper_factory.register_mapper(
  23. ManSubject,
  24. SubjectMapper(ManActor),
  25. )
  26. self.gui.run()