I am new to AndEngine Game Development. I am trying to load and display a single sprite , But i got blank blcak screen without sprite on the screen. Here is the code:
public class MainActivity extends SimpleBaseGameActivity {
static final int CAMERA_WIDTH = 800;
static final int CAMERA_HEIGHT = 480;
private static final String TAG = "AndEngineTest";
private BitmapTextureAtlas mBitmapTextureAtlas;
private TextureRegion mPlayerTextureRegion;
@Override
public EngineOptions onCreateEngineOptions() {
Camera mCamera = new Camera(0, 0, CAMERA_WIDTH , CAMERA_HEIGHT);
return new EngineOptions(true,ScreenOrientation.LANDSCAPE_SENSOR,
new RatioResolutionPolicy(CAMERA_WIDTH, CAMERA_HEIGHT), mCamera);
}
@Override
protected void onCreateResources() {
mBitmapTextureAtlas = new BitmapTextureAtlas(this.getTextureManager(), 32, 32,
TextureOptions.BILINEAR_PREMULTIPLYALPHA);
mPlayerTextureRegion = BitmapTextureAtlasTextureRegionFactory.createFromAsset(this.mBitmapTextureAtlas, this, "gfx/face_box.png", 0, 0);
mBitmapTextureAtlas.load();
}
@Override
protected Scene onCreateScene() {
this.mEngine.unregisterUpdateHandler(new FPSLogger());
Scene scene = new Scene();
scene.setBackground(new Background(3f, 6f, 2f));
Sprite Player = new Sprite(32, 32, mPlayerTextureRegion, getVertexBufferObjectManager());
Camera mCamera = new Camera(0, 0, CAMERA_WIDTH , CAMERA_HEIGHT);
Player.setPosition(mCamera.getWidth()/2 - Player.getWidth()/2,
mCamera.getHeight() - Player.getHeight() - 10);
scene.attachChild(Player);
return scene;
}
Can anyone tell what is the mistake here ??? Any useful help will be appreciaed .