@Override
	public void update() {
		logger.trace("update: " + stateMachine.getState());
		switch (stateMachine.getState()) {
		case INGAME:
			start.dispose();
			game = new Game(penController, stateMachine);
			break;
		case MENU:
			start = new StartMenu(stateMachine);
			if (options != null) {
				options.dispose();
			}
			if (result != null) {
				result.dispose();
			}
			if (game != null) {
				game.dispose();
			}
			break;
		case OPTIONS:
			options = new OptionsMenu(penController, stateMachine);
			start.dispose();
			break;
		case RESULT:
			result = new ResultDialog(penController, stateMachine);
			game.dispose();
			//Reinit penController for next game
			this.penController = new PenController();
			break;
		default:
			assert(false);
			break;
		}
	}