package com.example.AndEngineExample;
import org.anddev.andengine.engine.Engine;
import org.anddev.andengine.engine.camera.Camera;
import org.anddev.andengine.engine.options.EngineOptions;
import org.anddev.andengine.engine.options.resolutionpolicy.RatioResolutionPolicy;
import org.anddev.andengine.entity.scene.Scene;
import org.anddev.andengine.entity.scene.background.ColorBackground;
import org.anddev.andengine.entity.util.FPSLogger;
import org.anddev.andengine.ui.activity.BaseGameActivity;
public class LineActivity extends BaseGameActivity{
private int CAMERA_WIDTH = 720; //摄像机宽度
private int CAMERA_HEIGHT = 480;//摄像机高度
private Camera mCamera;
@Override
public Engine onLoadEngine() {
//创建摄像机
this.mCamera = new Camera(0, 0, CAMERA_WIDTH, CAMERA_HEIGHT);
//创建引擎选项
EngineOptions engineOptions=new EngineOptions(true, EngineOptions.ScreenOrientation.LANDSCAPE, new RatioResolutionPolicy(CAMERA_WIDTH, CAMERA_HEIGHT), this.mCamera);
//创建引擎并返回它
return new Engine(engineOptions);
}
@Override
public void onLoadResources() {
}
@Override
public Scene onLoadScene() {
//注册到周期更新回调
this.mEngine.registerUpdateHandler(new FPSLogger());
//建立场景对象
final Scene scene = new Scene(1);
//设置背景
scene.setBackground(new ColorBackground(0.09804f, 0.6274f, 0.8784f));
//返回场景对象
return scene;
}
@Override
public void onLoadComplete() {
}