Android Open Source - square-libgdx Splash Screen






From Project

Back to project page square-libgdx.

License

The source code is released under:

GNU General Public License

If you think the Android project square-libgdx 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 screens;
/* w  w w  .  jav  a 2 s  . co  m*/

import com.denzyldick.square.SquareMain;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Screen;
import com.badlogic.gdx.assets.AssetManager;
import com.badlogic.gdx.graphics.GL10;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.Texture.TextureFilter;
import com.badlogic.gdx.graphics.g2d.Sprite;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.g2d.TextureRegion;


public class SplashScreen implements Screen {
  

  SquareMain game;
  
  private OrthographicCamera camera;
  private SpriteBatch batch;
  private Texture texture;
  private Sprite sprite;

  public SplashScreen(SquareMain game)
  {
    this.game = game;
  }
  @Override
  public void render(float delta) {
    // TODO Auto-generated method stub
    Gdx.gl.glClearColor(1,1,1,1);
    Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
    
    batch.setProjectionMatrix(camera.combined);
    batch.begin();
    sprite.draw(batch);
    batch.end();  
    if(game.manager.getProgress() == 1.0)
    {
      
      game.setScreen(game.menu);
    }
  }

  @Override
  public void resize(int width, int height) {
    // TODO Auto-generated method stub
    
  }

  @Override
  public void show() {
    
    float w = Gdx.graphics.getWidth();
    float h = Gdx.graphics.getHeight();
    
    camera = new OrthographicCamera(1, h/w);
    batch = new SpriteBatch();
    
    //the splashscreen background is the only class that doesn't use the assetmanager.
    texture = new Texture("data/splashscreenbackground.png");
    
    
    texture.setFilter(TextureFilter.Linear, TextureFilter.Linear);
  
    TextureRegion region = new TextureRegion(texture, 0, 0, 1080,720);
    
    sprite = new Sprite(region);
    sprite.setSize(0.9f, 0.9f * sprite.getHeight() / sprite.getWidth());
    sprite.setOrigin(sprite.getWidth()/2, sprite.getHeight()/2);
    sprite.setPosition(-sprite.getWidth()/2, -sprite.getHeight()/2);
    
  }

  @Override
  public void hide() {
    // TODO Auto-generated method stub
    
  }

  @Override
  public void pause() {
    // TODO Auto-generated method stub
    
  }

  @Override
  public void resume() {
    // TODO Auto-generated method stub
    
  }

  @Override
  public void dispose() {
    // TODO Auto-generated method stub
    
  }

}




Java Source Code List

actors.Square.java
com.denzyldick.square.Assets.java
com.denzyldick.square.BackgroundAnimation.java
com.denzyldick.square.File.java
com.denzyldick.square.Font.java
com.denzyldick.square.Main.java
com.denzyldick.square.SoundManager.java
com.denzyldick.square.SquareMain.java
com.denzyldick.square.StarManagement.java
com.denzyldick.square.client.GwtLauncher.java
com.denzyldick.square.json.JsonArray.java
com.denzyldick.square.json.JsonLiteral.java
com.denzyldick.square.json.JsonNumber.java
com.denzyldick.square.json.JsonObject.java
com.denzyldick.square.json.JsonParser.java
com.denzyldick.square.json.JsonString.java
com.denzyldick.square.json.JsonValue.java
com.denzyldick.square.json.JsonWriter.java
com.denzyldick.square.json.ParseException.java
com.realcode.square.MainActivity.java
screens.GameMenu.java
screens.GameScreen.java
screens.LostScreen.java
screens.MenuScreen.java
screens.OptionsScreen.java
screens.SplashScreen.java
screens.TutorialScreen.java
screens.WonScreen.java