pl/mbogusz3/invaders/controller/InvadersController.java
/**
	 * Start the main game loop - begin processing events.
	 */
Start the main game loop - begin processing events.
Start the main game loop - begin processing events .
public void start() {
		InvadersEvent event;
		InvadersEventHandler eventHandler;
		System.out.println("Controller: starting main event loop");
		while (true) {
			try {
				event = eventQueue.take();
			} catch(Exception e) {
				System.out.print("Unexpected exception on event taking: " + e);
				continue;
			}
			try {
				eventHandler = this.eventHandlerMap.get(event.type);
				eventHandler.execute(event.payload);
			} catch(NullPointerException e) {
				System.out.println("Unknown event!");
			} catch(InvadersNewGameException e) {
				System.out.println("new game!");
				this.startTimer();
			} catch(InvadersExitException e) {
				System.out.println("Caught exit exception, ending!");
				break;
			} catch(Exception e) {
				System.out.println("Unexpected exception on event handling: " + e);
			}
		}
		this.stopTimer();
		System.exit(0);
	}
public void start ( ) { InvadersEvent event ; InvadersEventHandler eventHandler ; System . out . println ( "Controller: starting main event loop" ) ; while ( true ) { try { event = eventQueue . take ( ) ; } catch ( Exception e ) { System . out . print ( "Unexpected exception on event taking: " + e ) ; continue ; } try { eventHandler = this . eventHandlerMap . get ( event . type ) ; eventHandler . execute ( event . payload ) ; } catch ( NullPointerException e ) { System . out . println ( "Unknown event!" ) ; } catch ( InvadersNewGameException e ) { System . out . println ( "new game!" ) ; this . startTimer ( ) ; } catch ( InvadersExitException e ) { System . out . println ( "Caught exit exception, ending!" ) ; break ; } catch ( Exception e ) { System . out . println ( "Unexpected exception on event handling: " + e ) ; } } this . stopTimer ( ) ; System . exit ( 0 ) ; }
Start the main game loop - begin processing events.
Start the main game loop - begin processing events .