Created
December 4, 2013 07:37
-
-
Save massimomusante/7783696 to your computer and use it in GitHub Desktop.
My first Andengine activity
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.musante.demo.demoandengine; | |
import org.andengine.engine.camera.Camera; | |
import org.andengine.engine.options.EngineOptions; | |
import org.andengine.engine.options.ScreenOrientation; | |
import org.andengine.engine.options.resolutionpolicy.RatioResolutionPolicy; | |
import org.andengine.entity.scene.Scene; | |
import org.andengine.entity.scene.background.Background; | |
import org.andengine.entity.util.FPSLogger; | |
import org.andengine.ui.activity.SimpleBaseGameActivity; | |
public class AndEngineActivity extends SimpleBaseGameActivity | |
{ | |
static final int CAMERA_WIDTH = 800; | |
static final int CAMERA_HEIGHT = 480; | |
@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() | |
{ | |
// ... | |
} | |
@Override | |
protected Scene onCreateScene() | |
{ | |
this.mEngine.registerUpdateHandler(new FPSLogger()); | |
Scene scene = new Scene(); | |
scene.setBackground(new Background(0.09804f, 0.6274f, 0)); | |
return scene; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment