示例#1
0
    /// <summary>
    /// 
    /// </summary>
    private void _run()
    {
      //initialize the game params first
      GameParameters.Initialize((int)_viewFramework.GetScreenDimension().X, (int)_viewFramework.GetScreenDimension().Y);
      
      GameLogger.Initialize(Console.Out);
      EventBus eventBus = new EventBus();
      EventFactory eventFactory = new EventFactory();
      EventMonitor eventMonitor = new EventMonitor(eventFactory,eventBus);
      //this thread will be blocked at GetIGameSpriteFactory() until ContentManager is initialized
      GameObjectFactory gameObjectFactory = new GameObjectFactory(eventMonitor, _viewFramework.GetIGameSpriteFactory());
      GameObjectContainer gameObjects = new GameObjectContainer();
      MainEventProcessor mainEventListener = new MainEventProcessor(gameObjects, gameObjectFactory, eventBus);
      GameModel gameModel = new GameModel(gameObjects, gameObjectFactory);
      GameController gameController = new GameController(eventBus, gameModel, eventFactory, _viewFramework);

      //controller runs forever-loop
      gameController.Run();
    }
 public GameObjectFactory(EventMonitor eventMonitor, IGameSpriteFactory gameSpriteFactory)
 {
   _eventMonitor = eventMonitor;
   _spriteFactory = gameSpriteFactory;
 }