public static void quitToMenu() {
        try {
            renderer.shutdown();
            game.setGameState(GameThread.STATE_STOPPED);
            game.join();
            if (networkConnection != null) {
                networkConnection.close();
                networkConnection.join();
            }
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }