Android Open Source - SnowLand Loading






From Project

Back to project page SnowLand.

License

The source code is released under:

GNU General Public License

If you think the Android project SnowLand 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.walrus.game;
/* w  w w .j a v  a2s . c o  m*/
import android.graphics.Color;
import android.graphics.Paint;

import com.walrus.core.LevelGenerator;
import com.walrus.framework.Game;
import com.walrus.framework.Graphics;
import com.walrus.framework.Screen;
import com.walrus.gui.TextArea;

public class Loading extends Screen{
  private Thread lvlGen;
  private Paint paint; 
  private TextArea title;
  private int oper=5, k=2;
  private float size=40, szinc=(float) 0.3;
  private int[] color = new int[3];
  public Loading(Game game, int size, int maxMoves){
    super(game);
    paint = new Paint(); 
    paint.setTextSize(50); paint.setAntiAlias(true);
    color[0]=51; color[1]=181; color[2]=229;
    paint.setColor(Color.rgb(51,181,229));
    paint.setTypeface(Assets.font);
    title = new TextArea(Assets.screenWidth/2, Assets.screenHeight/2, "Generating map...", paint);
    lvlGen = new LevelGenerator(25, size, size, maxMoves);
    lvlGen.start();
  }   

  @Override
  public void update(float deltaTime) {
    // TODO Auto-generated method stub
    color[k]+=oper;
    if(color[k]>=255){
      color[k]=255; oper*=-1; 
    }else if(color[k]<=0){
      color[k]=0; oper*=-1; 
    }
    size+=szinc;
    if(size>=50) szinc*=-1;
    if(size<=30) szinc*=-1;
    title.getPaint().setColor(Color.rgb(color[0],color[1],color[2]));
    //title.getPaint().setTextSize(size);
    paint(deltaTime);
    if(((LevelGenerator) lvlGen).isGenerationComplete()){
      game.setScreen(new GameScreen(game, (LevelGenerator) lvlGen));
      lvlGen=null;
    }
  }
  

  @Override
  public void paint(float deltaTime) {
    // TODO Auto-generated method stub
    Graphics g = game.getGraphics();
    g.clearScreen(0);
    g.drawString(title.getText(), title.getTxtX(), title.getTxtY(), title.getPaint());
  }

  @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
    
  }

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




Java Source Code List

com.walrus.core.LevelGenerator.java
com.walrus.core.Move.java
com.walrus.framework.Audio.java
com.walrus.framework.FileIO.java
com.walrus.framework.Game.java
com.walrus.framework.Graphics.java
com.walrus.framework.Image.java
com.walrus.framework.Input.java
com.walrus.framework.Music.java
com.walrus.framework.Pool.java
com.walrus.framework.Screen.java
com.walrus.framework.Sound.java
com.walrus.framework.implementation.AndroidAudio.java
com.walrus.framework.implementation.AndroidFastRenderView.java
com.walrus.framework.implementation.AndroidFileIO.java
com.walrus.framework.implementation.AndroidGame.java
com.walrus.framework.implementation.AndroidGraphics.java
com.walrus.framework.implementation.AndroidImage.java
com.walrus.framework.implementation.AndroidInput.java
com.walrus.framework.implementation.AndroidMusic.java
com.walrus.framework.implementation.AndroidSound.java
com.walrus.framework.implementation.MultiTouchHandler.java
com.walrus.framework.implementation.SingleTouchHandler.java
com.walrus.framework.implementation.TouchHandler.java
com.walrus.game.Animation.java
com.walrus.game.Assets.java
com.walrus.game.Background.java
com.walrus.game.CopyOfGameScreen.java
com.walrus.game.Entity.java
com.walrus.game.GameBoot.java
com.walrus.game.GameScreen.java
com.walrus.game.LoadingScreen.java
com.walrus.game.Loading.java
com.walrus.game.MainMenuScreen.java
com.walrus.game.SplashLoadingScreen.java
com.walrus.game.TileMatrixFactory.java
com.walrus.game.Tile.java
com.walrus.gui.ArrowSelector.java
com.walrus.gui.Button.java
com.walrus.gui.GridSpatiator.java
com.walrus.gui.SlidingBackground.java
com.walrus.gui.TextArea.java