@Override
	public void startUp() {
		if (waitingGameScreen == null) {
			logger.error(new NullPointerException(),
					Helpers.concat("Tried starting game without there being default game screen given.",
							"Make sure to set it with setCurrentGameScreen(GameScreen gameScreen)"));
			Runtime.getRuntime().exit(0xDEADBEEF);
		}

		stateManager = new StateManager("gameScreenmanagerStateManager");

		// Called after a gamescreen has just been loaded. After it has faded
		// in, it will change to a state which will check whether or not it
		// needs to change the game screen again
		stateManager.addPossibleState(new State("fadeIn") {
			int alpha = 255;

			@Override
			public void logicUpdate(GameTime gameTime) {
				transitionColor = new Color(((alpha -= transitionSpeed) << 24) | desiredTransitionColor, true);
				if (alpha < transitionSpeed) {
					transitionColor = null;
					// change the alpha back to 255, for next time the game
					// screen is changed
					alpha = 255;
					setTransitionStateName("checkWaitingGameScreen");
				} else {
					setTransitionStateName(getName());
				}
			}
		});

		// Called when a request is made to replace the current game screen. It
		// will fade out first, and after fading out it will transition to a
		// state which will actually replace the gamescreen
		stateManager.addPossibleState(new State("fadeOut") {
			int alpha;

			@Override
			public void logicUpdate(GameTime gameTime) {
				if (alpha == 255)
					alpha = 0;
				transitionColor = new Color(((alpha += transitionSpeed) << 24) | desiredTransitionColor, true);
				if (alpha >= 255) {
					setTransitionStateName("changeCurrentGameScreen");
				} else {
					setTransitionStateName(getName());
				}
			}
		});

		// Called when there was a request to change the GameScreen, and the
		// current waitingGameScreen is not null. This method will attempt to
		// fire the GC when swapping game screens. This is where both the
		// 'startUp' (for the waitingGameScreen) and 'cleanUp' (from the
		// currentGameScreen) methods will be fired
		stateManager.addPossibleState(new State("changeCurrentGameScreen") {
			@Override
			public void logicUpdate(GameTime gameTime) {
				if (currentGameScreen != null) {
					// Call the clean up for the current layer, IE remove events
					// etc
					currentGameScreen.cleanUp();
					// Now is the best time to do GC. A well designed game
					// shouldn't have to do GC much, but it's better to run it
					// now rather than for it to be forcibly ran during an
					// important part of the game
					System.gc();
				}

				currentGameScreen = waitingGameScreen;
				// Call the start up for the layer, register events, reset
				// components etc
				currentGameScreen.startUp(gameTime);

				// / Remove the waiting game screen as it has been replaced
				waitingGameScreen = null;

				// fade in the screen now
				setTransitionStateName("fadeIn");
			}
		});

		// When in this state we busy check whether or not the waitinGameScreen
		// is null, and if it is, we should go the fade out state, which will
		// then eventually load the new gameScreen. We could possibly change
		// into the fadeOut transition when setGameScreen is called... But I
		// like this as it means that it will only consider a change game screen
		// after the animation etc has completed, which I think will stop a lot
		// of interface bugs (IE, user spam clicking a menu button)
		stateManager.addPossibleState(new State("checkWaitingGameScreen") {
			@Override
			public void logicUpdate(GameTime gameTime) {
				if (waitingGameScreen != null) {
					setTransitionStateName("fadeOut");
				} else {
					setTransitionStateName(getName());
				}
			}
		});

		stateManager.setStartingState("changeCurrentGameScreen");
	}