Example2.java :  » Game » rogueandroid » com » stickycoding » RokonExamples » Android Open Source

Android Open Source » Game » rogueandroid 
rogueandroid » com » stickycoding » RokonExamples » Example2.java
package com.stickycoding.RokonExamples;

import com.stickycoding.Rokon.RokonActivity;
import com.stickycoding.Rokon.Texture;
import com.stickycoding.Rokon.TextureAtlas;
import com.stickycoding.Rokon.TextureManager;
import com.stickycoding.Rokon.Backgrounds.FixedBackground;

/**
 * @author Richard
 * Loading a Texture and applying it to a FixedBackground
 */
public class Example2 extends RokonActivity {
  
  public Texture backgroundTexture;
  public TextureAtlas atlas;
  
  public FixedBackground background;
  
    public void onCreate() {
        createEngine(480, 320, true);
    }

  @Override
  public void onLoad() {
    backgroundTexture = new Texture("graphics/backgrounds/beach.png");
    atlas = new TextureAtlas(512, 512);
    atlas.insert(backgroundTexture);
    TextureManager.load(atlas);
    background = new FixedBackground(backgroundTexture);
  }

  @Override
  public void onLoadComplete() {
    rokon.setBackground(background);
  }

  @Override
  public void onGameLoop() {

  } 
  
  @Override
  public void onRestart() {
    super.onRestart();
    rokon.unpause();
  }
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.