我對Android遊戲開發非常陌生,而且我正面臨有關屏幕圖像背景的問題。AndEngine完整圖像背景(寬度和高度)
這是我的一個擴展滿級代碼SimpleBaseGameActivity
修訂版攝像頭的寬度和高度對應於圖像尺寸
private final int CAMERA_WIDTH = 480;//800;
private final int CAMERA_HEIGHT = 836; //1280;
private Camera mCamera;
//Background variables
private TextureRegion region;
private Scene mScene;
@Override
public EngineOptions onCreateEngineOptions() {
this.mCamera = new Camera(0,0,CAMERA_WIDTH,CAMERA_HEIGHT);
return new EngineOptions(true, ScreenOrientation.PORTRAIT_SENSOR, new RatioResolutionPolicy(CAMERA_WIDTH, CAMERA_HEIGHT), this.mCamera);
}
@Override
protected void onCreateResources() throws IOException {
BitmapTextureAtlas atlas = new BitmapTextureAtlas(this.getTextureManager(),CAMERA_WIDTH+CAMERA_WIDTH,CAMERA_HEIGHT+CAMERA_HEIGHT);
this.region = BitmapTextureAtlasTextureRegionFactory.createFromAsset(atlas,this,"snow_bg.png",0,0);
atlas.load();
}
@Override
protected Scene onCreateScene() {
this.mEngine.registerUpdateHandler(new FPSLogger());
this.mScene = new Scene();
Sprite sprite = new Sprite(0,0,region,this.getVertexBufferObjectManager());
this.mScene.setBackground(new SpriteBackground(sprite));
return this.mScene;
}
,我現在面臨的問題是,背景圖片,這是不全面屏幕。我一直在尋找如何在AndEngine
中拉伸圖像背景,但我還沒有找到任何好的資源。
這是屏幕截圖。
但圖像全屏視圖
請給我一些建議我應該怎樣做或示例代碼來實現我的目標。
在此先感謝。
感謝您的想法先生,加上1給你.. –