@Test public void testCreate() throws Exception { GameEventManager theEventManager = new GameEventManager(mock(Logger.class)); GameScene theScene = mock(GameScene.class); GameView theView = mock(GameView.class); GameRuntime theRuntime = mock(GameRuntime.class); when(theRuntime.getEventManager()).thenReturn(theEventManager); GameLoopFactory theFactory = new GameLoopFactory(); GameLoop theLoop = theFactory.create(theScene, theView, theRuntime); assertSame(theScene, theLoop.getScene()); assertSame(theView, theLoop.getHumanGameView()); assertFalse(theLoop.isShutdown()); theEventManager.fire(new SceneShutdown()); assertTrue(theLoop.isShutdown()); }
public GameLoop create(GameScene aGameScene, GameView aHumanGameView, GameRuntime aRuntime) { final GameLoop theLoop = new GameLoop(aGameScene, aHumanGameView, aRuntime); aRuntime.getEventManager().register(null, SceneShutdown.TYPE, new GameEventListener<SceneShutdown>() { @Override public void handleGameEvent(SceneShutdown aEvent) { theLoop.shutdown(); } }); return theLoop; }
GameLoopFactory { public GameLoop create(GameScene aGameScene, GameView aHumanGameView, GameRuntime aRuntime) { final GameLoop theLoop = new GameLoop(aGameScene, aHumanGameView, aRuntime); aRuntime.getEventManager().register(null, SceneShutdown.TYPE, new GameEventListener<SceneShutdown>() { @Override public void handleGameEvent(SceneShutdown aEvent) { theLoop.shutdown(); } }); return theLoop; } }
GameLoopFactory { public GameLoop create(GameScene aGameScene, GameView aHumanGameView, GameRuntime aRuntime) { final GameLoop theLoop = new GameLoop(aGameScene, aHumanGameView, aRuntime); aRuntime.getEventManager().register(null, SceneShutdown.TYPE, new GameEventListener<SceneShutdown>() { @Override public void handleGameEvent(SceneShutdown aEvent) { theLoop.shutdown(); } }); return theLoop; }  }
GameLoopFactory { public GameLoop create(GameScene aGameScene, GameView aHumanGameView, GameRuntime aRuntime) { final GameLoop theLoop = new GameLoop(aGameScene, aHumanGameView, aRuntime); aRuntime.getEventManager().register(null, SceneShutdown.TYPE, new GameEventListener<SceneShutdown>() { @Override public void handleGameEvent(SceneShutdown aEvent) { theLoop.shutdown(); } }); return theLoop; }  GameLoop create(GameScene aGameScene, GameView aHumanGameView, GameRuntime aRuntime); }
GameLoopFactory { public GameLoop create(GameScene aGameScene, GameView aHumanGameView, GameRuntime aRuntime) { final GameLoop theLoop = new GameLoop(aGameScene, aHumanGameView, aRuntime); aRuntime.getEventManager().register(null, SceneShutdown.TYPE, new GameEventListener<SceneShutdown>() { @Override public void handleGameEvent(SceneShutdown aEvent) { theLoop.shutdown(); } }); return theLoop; }  GameLoop create(GameScene aGameScene, GameView aHumanGameView, GameRuntime aRuntime);  }