Android Open Source - Gallery97 Loading Screen






From Project

Back to project page Gallery97.

License

The source code is released under:

GNU General Public License

If you think the Android project Gallery97 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 pl.kacprzak.klub97;
//from  w  w  w  . ja va2 s . c  om
import android.util.Log;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.GL10;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.Sprite;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.g3d.Model;
import com.badlogic.gdx.graphics.g3d.ModelInstance;


public class LoadingScreen extends AbstractScreen {

  Texture tex;
  Sprite circle;
  SpriteBatch batch;
  float degrees = 10f;
  
  public LoadingScreen(MieszkanieStart game) {
    super(game);
    
    Log.e("my log", "Loading screen created.");
    tex = new Texture(Gdx.files.internal("data/circle.png"));
    batch = new SpriteBatch();
    circle = new Sprite(tex);
    
  }

  @Override
  public void render(float arg0) {
    
    Gdx.gl.glViewport(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
        Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
        
    if(tex != null){
      batch.begin();
      batch.setColor(Color.WHITE);
      circle.setPosition(Gdx.graphics.getWidth()/2-tex.getWidth()/2, 
          Gdx.graphics.getHeight()/2 - tex.getHeight()/2);
      circle.rotate(-degrees);
      circle.draw(batch);
      batch.end();
    }
    
    if (game.manager.update() && game.isLoading) {
      doneLoading();
    }
  }

  private void doneLoading() {
    
    Log.e("my log", "Done loading.");
    
    game.model = game.manager.get("data/attempt.g3db", Model.class);
    
    game.instance = new ModelInstance(game.model);
    
    game.isLoading = false;
    game.setScreen(new MieszkanieScreen(game));
    
  }

  @Override
  public void dispose() {
    batch.dispose();
  }

  @Override
  public void hide() {
  }

  @Override
  public void pause() {
  }

  @Override
  public void resize(int arg0, int arg1) {
  }

  @Override
  public void resume() {
  }

  @Override
  public void show() {
  }

}




Java Source Code List

pl.kacprzak.klub97.AbstractScreen.java
pl.kacprzak.klub97.GdxApp.java
pl.kacprzak.klub97.InputListener.java
pl.kacprzak.klub97.LoadingScreen.java
pl.kacprzak.klub97.MieszkanieScreen.java
pl.kacprzak.klub97.MieszkanieStart.java
pl.kacprzak.klub97.MovementEngine.java