SHARE
TWEET

Untitled

a guest Sep 17th, 2014 180 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public class SplashScreen implements Screen {
  2.     private float time=0;
  3.     private BitmapFont font;
  4.     private SpriteBatch batch;
  5.     private GOW game;
  6.     private boolean test;
  7.  
  8.     public SplashScreen(GOW game){
  9.         this.game=game;
  10.  
  11.     }
  12.         @Override
  13.     public void show() {
  14.  
  15.             font=Asset.font;
  16.             batch = new SpriteBatch();
  17.  
  18.             new Thread(new Runnable() {
  19.                 @Override
  20.                 public void run() {
  21.                                 Asset.initDict(); // long operation
  22.                                 test=true;
  23.                     }
  24.             }).start();
  25.             Asset.initGraphs(); // fast operation
  26.     }
  27.  
  28.     @Override
  29.     public void render(float delta) {
  30.         boolean end= gradient(delta);
  31.         Gdx.gl.glClearColor(time*1f, 0.0f, 0, 1);
  32.         Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
  33.         batch.begin();
  34.         if(end&test){
  35.             game.setScreen(new TrainScreen());
  36.         }
  37.         batch.end();
  38.     }
  39.  
  40.     private boolean gradient(float delta){
  41.         if(time<4f) {
  42.             time += delta;
  43.             if(time>4f) {
  44.                 time = 4f;
  45.             }
  46.             return false;
  47.         }
  48.         return true;
  49.  
  50.     }
  51.  
  52.     @Override
  53.     public void resize(int width, int height) {
  54.  
  55.     }
  56.  
  57.     @Override
  58.     public void hide() {
  59.  
  60.     }
  61.  
  62.     @Override
  63.     public void pause() {
  64.  
  65.     }
  66.  
  67.     @Override
  68.     public void resume() {
  69.  
  70.     }
  71.  
  72.     @Override
  73.     public void dispose() {
  74.  
  75.     }
  76. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top