Android Open Source - LittlerIvis Info Screen






From Project

Back to project page LittlerIvis.

License

The source code is released under:

GNU General Public License

If you think the Android project LittlerIvis listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.RosalilaStudio.LittlerIves.Screens;
//from   www  .jav  a  2s  .c o m
import com.RosalilaStudio.LittlerIves.GlobalNPCs;
import com.RosalilaStudio.LittlerIves.LittlerIvis;
import com.RosalilaStudio.LittlerIves.Path;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.InputListener;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.ui.Image;

public class InfoScreen extends AbstractScreen {
  private Stage stage;

  public InfoScreen(LittlerIvis game) {
    super(game);
    
  }

  @Override
  public void show() {
    stage = new Stage(game.getView(), game.getSb());
    stage.getViewport().update(game.getWidth(), game.getHeight());
    Gdx.input.setInputProcessor(stage);
    
    final Image info[] = new Image[2];
    if(GlobalNPCs.level!=5){
      info[0] = genSliptImage(game.MANAGER.get(Path.I.getPath("intro"+GlobalNPCs.level+".png"), Texture.class), game.getWidth(), game.getHeight());
      info[0].addListener(new InputListener(){
        @Override
        public boolean touchDown(InputEvent event, float x, float y,
            int pointer, int button) {
          game.setScreen(game.PLAY);
          return true;
        }
      });
      stage.addActor(info[0]);
    }else{
      info[1] = genSliptImage(game.MANAGER.get(Path.I.getPath("intro"+GlobalNPCs.level+"a.png"), Texture.class), game.getWidth(), game.getHeight());
      info[1].addListener(new InputListener(){
        @Override
        public boolean touchDown(InputEvent event, float x, float y,
            int pointer, int button) {
          info[1].setVisible(false);
          return true;
        }
      });
      
      info[0] = genSliptImage(game.MANAGER.get(Path.I.getPath("intro"+GlobalNPCs.level+"b.png"), Texture.class), game.getWidth(), game.getHeight());
      info[0].addListener(new InputListener(){
        @Override
        public boolean touchDown(InputEvent event, float x, float y,
            int pointer, int button) {
          game.setScreen(game.PLAY);
          return true;
        }
      });
      stage.addActor(info[0]);
      stage.addActor(info[1]);
    }
    
  }

  @Override
  public void render(float delta) {
    Gdx.gl.glClearColor(0, 0, 0, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    
    stage.draw();
    stage.act();
  }
  
  @Override
  public void hide() {
    Gdx.input.setInputProcessor(null);
  }
  
  @Override
  public void resize(int width, int height) {
    stage.getViewport().update(game.getWidth(), game.getHeight());
  }
  
  private Image genSliptImage(Texture txt, int width, int height){
    TextureRegion region = new TextureRegion(txt, width, height);
    return new Image(region);
  }

}




Java Source Code List

com.RosalilaStudio.LittlerIves.GlobalNPCs.java
com.RosalilaStudio.LittlerIves.IOSLauncher.java
com.RosalilaStudio.LittlerIves.LittlerIvis.java
com.RosalilaStudio.LittlerIves.Path.java
com.RosalilaStudio.LittlerIves.State.java
com.RosalilaStudio.LittlerIves.Characters.Character.java
com.RosalilaStudio.LittlerIves.Listeners.InputDYAListener.java
com.RosalilaStudio.LittlerIves.Screens.AbstractScreen.java
com.RosalilaStudio.LittlerIves.Screens.InfoScreen.java
com.RosalilaStudio.LittlerIves.Screens.MenuScreen.java
com.RosalilaStudio.LittlerIves.Screens.PlayScreen.java
com.RosalilaStudio.LittlerIves.android.AndroidLauncher.java
com.RosalilaStudio.LittlerIves.client.HtmlLauncher.java
com.RosalilaStudio.LittlerIves.desktop.DesktopLauncher.java