// Path: Tamagotchi/src/com/redditandroiddevelopers/tamagotchi/TamagotchiGame.java
// public class TamagotchiGame extends Game {
// 
//     private static final String TAG = "Tamagotchi:TamagotchiGame";
// 
//     public static final int STATE_MAIN_MENU = 0;
//     public static final int STATE_MAIN_GAME = 1;
//     public static final int STATE_PAUSED = 2;
//     public static final int STATE_SELECT_PET = 3;
//     public static final int STATE_MEMORIES = 4;
//     public static final int STATE_SETTINGS = 5;
//     public static final int NUM_SCREENS = 6;
// 
//     private CommonScreen[] screens;
//     private Stack<CommonScreen> screenHistory;
// 
//     private GameInput gameInput;
// 
//     public final TamagotchiConfiguration config;
//     public InputMultiplexer inputMultiplexer;
//     public AssetManager assetManager;
//     public TamagotchiAssets assets;
// 
//     public TamagotchiGame(TamagotchiConfiguration config) {
//         this.config = config;
//     }
// 
//     @Override
//     public void create() {
//         // do first-time configurations that should live as long as the
//         // application does
//         Gdx.app.setLogLevel(config.logLevel);
// 
//         // create screen objects we're going to need throughout
//         screens = new CommonScreen[] {
//                 new MainMenuScreen(this),
//                 new MainGameScreen(this),
//                 new PauseScreen(this),
//                 new CreatureCreationScreen(this), // TODO: implement
//                                                   // PetSelectionScreen
//                 new MemoriesScreen(this), // TODO: implement MemoriesScreen
//                 new SettingsScreen(this), // TODO: implement SettingsScreen
//         };
// 
//         screenHistory = new Stack<CommonScreen>();
// 
//         final Resolution resolution = new Resolution(Gdx.graphics.getWidth(),
//                 Gdx.graphics.getHeight(), "");
//         final ResolutionFileResolver resolver = new ResolutionFileResolver(
//                 new InternalFileHandleResolver(), resolution);
//         assetManager = new AssetManager();
//         assetManager.setLoader(Texture.class, new TextureLoader(resolver));
// 
//         assets = new TamagotchiAssets(assetManager);
// 
//         gameInput = new GameInput();
//         inputMultiplexer = new InputMultiplexer();
//         inputMultiplexer.addProcessor(gameInput);
//         Gdx.input.setCatchBackKey(true);
//         Gdx.input.setInputProcessor(inputMultiplexer);
// 
//         setScreen(new SplashScreen(this));
//     }
// 
//     @Override
//     public void render() {
//         // TODO FrameBuffer here?
// 
//         // actually render the current screen
//         super.render();
//     }
// 
//     /**
//      * Update the state, all updates outside of this class should use this
//      * method
//      * 
//      * @param state The int val of the new state
//      */
//     public void updateState(int state) {
//         if (state < 0 || state >= NUM_SCREENS) {
//             assert false;
//             throw new IllegalArgumentException("Invalid state value");
//         }
//         final CommonScreen screen = screens[state];
//         Gdx.app.debug(TAG, "Setting screen to " + screen.getClass().getSimpleName());
//         screenHistory.push(screen);
//         setScreen(screen);
//     }
// 
//     public void goToPreviousScreen() {
//         if (screenHistory.empty()) {
//             Gdx.app.log(TAG, "Screen history is empty!");
//             return;
//         }
// 
//         // first, pop the current screen
//         screenHistory.pop();
//         if (screenHistory.empty()) {
//             Gdx.app.log(TAG, "Game is closing now.");
//             // this means we are on the main screen and the application must
//             // exit.
//             Gdx.app.exit();
//         } else {
//             // finally, only peek into the previous screen
//             final CommonScreen prevScreen = screenHistory.peek();
//             Gdx.app.debug(TAG, "Going to a previous screen "
//                     + prevScreen.getClass().getSimpleName());
//             setScreen(prevScreen);
//         }
//     }
// 
//     @Override
//     public void dispose() {
//         super.dispose();
//         assetManager.dispose();
//         assetManager = null;
//         assets = null;
//         inputMultiplexer.removeProcessor(gameInput);
//         gameInput = null;
//         Gdx.input.setInputProcessor(null);
//         inputMultiplexer = null;
//     }
// 
//     public class GameInput extends InputAdapter {
// 
//         @Override
//         public boolean keyDown(int keycode) {
//             switch (keycode) {
//                 case Keys.BACK:
//                 case Keys.ESCAPE:
//                     goToPreviousScreen();
//                     return true;
//                 default:
//                     break;
//             }
//             return false;
//         }
// 
//     }
// 
// }


import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.ui.Image;
import com.redditandroiddevelopers.tamagotchi.TamagotchiGame;


package com.redditandroiddevelopers.tamagotchi.screens;


/**
 * A simple splash screen that is shown when the game is started. It
 * automatically transitions to the MainMenuScreen after 3 seconds.
 */
public class SplashScreen extends CommonScreen {

    private static final String TAG = "Tamagotchi:SplashScreen";

    public SplashScreen(TamagotchiGame game) {
        super(game);
    }

    @Override
    protected final Stage createStage(SpriteBatch batch) {
        return new Stage(game.config.stageWidth, game.config.stageHeight, false, batch);
    }

    @Override
    public final void show() {
        super.show();

        // load Reddit alien texture
        final Image splashLogo = new Image(new Texture(Gdx.files.internal("RedditAlien.png")));
        splashLogo.x = getCenterX(splashLogo.getRegion().getTexture());

// Path: Tamagotchi/src/com/redditandroiddevelopers/tamagotchi/TamagotchiGame.java
// public class TamagotchiGame extends Game {
// 
//     private static final String TAG = "Tamagotchi:TamagotchiGame";
// 
//     public static final int STATE_MAIN_MENU = 0;
//     public static final int STATE_MAIN_GAME = 1;
//     public static final int STATE_PAUSED = 2;
//     public static final int STATE_SELECT_PET = 3;
//     public static final int STATE_MEMORIES = 4;
//     public static final int STATE_SETTINGS = 5;
//     public static final int NUM_SCREENS = 6;
// 
//     private CommonScreen[] screens;
//     private Stack<CommonScreen> screenHistory;
// 
//     private GameInput gameInput;
// 
//     public final TamagotchiConfiguration config;
//     public InputMultiplexer inputMultiplexer;
//     public AssetManager assetManager;
//     public TamagotchiAssets assets;
// 
//     public TamagotchiGame(TamagotchiConfiguration config) {
//         this.config = config;
//     }
// 
//     @Override
//     public void create() {
//         // do first-time configurations that should live as long as the
//         // application does
//         Gdx.app.setLogLevel(config.logLevel);
// 
//         // create screen objects we're going to need throughout
//         screens = new CommonScreen[] {
//                 new MainMenuScreen(this),
//                 new MainGameScreen(this),
//                 new PauseScreen(this),
//                 new CreatureCreationScreen(this), // TODO: implement
//                                                   // PetSelectionScreen
//                 new MemoriesScreen(this), // TODO: implement MemoriesScreen
//                 new SettingsScreen(this), // TODO: implement SettingsScreen
//         };
// 
//         screenHistory = new Stack<CommonScreen>();
// 
//         final Resolution resolution = new Resolution(Gdx.graphics.getWidth(),
//                 Gdx.graphics.getHeight(), "");
//         final ResolutionFileResolver resolver = new ResolutionFileResolver(
//                 new InternalFileHandleResolver(), resolution);
//         assetManager = new AssetManager();
//         assetManager.setLoader(Texture.class, new TextureLoader(resolver));
// 
//         assets = new TamagotchiAssets(assetManager);
// 
//         gameInput = new GameInput();
//         inputMultiplexer = new InputMultiplexer();
//         inputMultiplexer.addProcessor(gameInput);
//         Gdx.input.setCatchBackKey(true);
//         Gdx.input.setInputProcessor(inputMultiplexer);
// 
//         setScreen(new SplashScreen(this));
//     }
// 
//     @Override
//     public void render() {
//         // TODO FrameBuffer here?
// 
//         // actually render the current screen
//         super.render();
//     }
// 
//     /**
//      * Update the state, all updates outside of this class should use this
//      * method
//      * 
//      * @param state The int val of the new state
//      */
//     public void updateState(int state) {
//         if (state < 0 || state >= NUM_SCREENS) {
//             assert false;
//             throw new IllegalArgumentException("Invalid state value");
//         }
//         final CommonScreen screen = screens[state];
//         Gdx.app.debug(TAG, "Setting screen to " + screen.getClass().getSimpleName());
//         screenHistory.push(screen);
//         setScreen(screen);
//     }
// 
//     public void goToPreviousScreen() {
//         if (screenHistory.empty()) {
//             Gdx.app.log(TAG, "Screen history is empty!");
//             return;
//         }
// 
//         // first, pop the current screen
//         screenHistory.pop();
//         if (screenHistory.empty()) {
//             Gdx.app.log(TAG, "Game is closing now.");
//             // this means we are on the main screen and the application must
//             // exit.
//             Gdx.app.exit();
//         } else {
//             // finally, only peek into the previous screen
//             final CommonScreen prevScreen = screenHistory.peek();
//             Gdx.app.debug(TAG, "Going to a previous screen "
//                     + prevScreen.getClass().getSimpleName());
//             setScreen(prevScreen);
//         }
//     }
// 
//     @Override
//     public void dispose() {
//         super.dispose();
//         assetManager.dispose();
//         assetManager = null;
//         assets = null;
//         inputMultiplexer.removeProcessor(gameInput);
//         gameInput = null;
//         Gdx.input.setInputProcessor(null);
//         inputMultiplexer = null;
//     }
// 
//     public class GameInput extends InputAdapter {
// 
//         @Override
//         public boolean keyDown(int keycode) {
//             switch (keycode) {
//                 case Keys.BACK:
//                 case Keys.ESCAPE:
//                     goToPreviousScreen();
//                     return true;
//                 default:
//                     break;
//             }
//             return false;
//         }
// 
//     }
// 
// }


// Path: Tamagotchi/src/com/redditandroiddevelopers/tamagotchi/screens/SplashScreen.java
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.ui.Image;
import com.redditandroiddevelopers.tamagotchi.TamagotchiGame;


package com.redditandroiddevelopers.tamagotchi.screens;


/**
 * A simple splash screen that is shown when the game is started. It
 * automatically transitions to the MainMenuScreen after 3 seconds.
 */
public class SplashScreen extends CommonScreen {

    private static final String TAG = "Tamagotchi:SplashScreen";

    public SplashScreen(TamagotchiGame game) {
        super(game);
    }

    @Override
    protected final Stage createStage(SpriteBatch batch) {
        return new Stage(game.config.stageWidth, game.config.stageHeight, false, batch);
    }

    @Override
    public final void show() {
        super.show();

        // load Reddit alien texture
        final Image splashLogo = new Image(new Texture(Gdx.files.internal("RedditAlien.png")));
        splashLogo.x = getCenterX(splashLogo.getRegion().getTexture());

        splashLogo.y = getCenterY(splashLogo.getRegion().getTexture());
