Android Open Source - BlockHopper Splash Scene






From Project

Back to project page BlockHopper.

License

The source code is released under:

Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION...

If you think the Android project BlockHopper 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.example.blockhopper;
//from  w  ww  .jav  a2 s .  c o  m
import org.andengine.engine.Engine;
import org.andengine.engine.camera.Camera;
import org.andengine.entity.scene.Scene;
import org.andengine.entity.scene.background.Background;
import org.andengine.entity.scene.background.SpriteBackground;
import org.andengine.entity.sprite.Sprite;
import org.andengine.entity.text.Text;
import org.andengine.entity.text.TextOptions;
import org.andengine.opengl.font.Font;
import org.andengine.opengl.font.FontFactory;
import org.andengine.opengl.texture.atlas.bitmap.BitmapTextureAtlas;
import org.andengine.opengl.texture.atlas.bitmap.BitmapTextureAtlasTextureRegionFactory;
import org.andengine.opengl.texture.region.ITextureRegion;
import org.andengine.ui.activity.BaseGameActivity;
import org.andengine.util.HorizontalAlign;
import org.andengine.util.color.Color;

import android.graphics.Typeface;

public class SplashScene {
  private Camera camera;
  private BaseGameActivity activity;
  private Engine eng;
  private Scene splashScene= new Scene();
  private Sprite splashicon;
  private BitmapTextureAtlas iconTexture;
  private ITextureRegion iconTextureRegion;
  
  public Scene getScene(){
    return splashScene;
  }
  
  public SplashScene(BaseGameActivity act, Engine eng, Camera cam){
    this.eng = eng;
    this.activity = act;
    this.camera = cam;
    
  }
  public void loadSplashScene(){
    BitmapTextureAtlasTextureRegionFactory.setAssetBasePath("gfx/");  //creating icon texture that 
    iconTexture = new BitmapTextureAtlas(this.activity.getTextureManager(),1024, 1024);
    iconTextureRegion = BitmapTextureAtlasTextureRegionFactory.createFromAsset(iconTexture, this.activity, "flashscreen.png",0,0);
    
    Font font = FontFactory.create(eng.getFontManager(), eng.getTextureManager(),512, 64, Typeface.create(Typeface.DEFAULT_BOLD, Typeface.BOLD), 64);
    font.load();  //creating and loading font for the title
    
    
    Text title = new Text(camera.getWidth()/2 - camera.getWidth()/4,  camera.getHeight()/2, font, "Block Hopper", new TextOptions(HorizontalAlign.CENTER), eng.getVertexBufferObjectManager());
    //creating title text
    splashScene.attachChild(title);
    iconTexture.load();

  }
  public void createSplashScene() {
    Sprite bckground = new Sprite(0,0,iconTextureRegion,this.eng.getVertexBufferObjectManager()); //setting background
    splashScene.setBackground(new SpriteBackground(bckground));



  }

}




Java Source Code List

com.example.blockhopper.BuildConfig.java
com.example.blockhopper.GameScene.java
com.example.blockhopper.HighScores.java
com.example.blockhopper.Levels.java
com.example.blockhopper.MainActivity.java
com.example.blockhopper.MenuScene.java
com.example.blockhopper.SplashScene.java