如何为所有设备设置精灵大小?我用这对精灵:所有设备的精灵大小
final Display display = getWindowManager().getDefaultDisplay();
CAMERA_WIDTH = display.getWidth();
CAMERA_HEIGHT = display.getHeight();
Log.e(Integer.toString(CAMERA_WIDTH), Integer.toString(CAMERA_HEIGHT));
camera = new BoundCamera(0, 0, CAMERA_WIDTH, CAMERA_HEIGHT);
return new EngineOptions(true, ScreenOrientation.LANDSCAPE_FIXED,
new RatioResolutionPolicy(CAMERA_WIDTH, CAMERA_HEIGHT), camera);
facebook = BitmapTextureAtlasTextureRegionFactory.createFromAsset(
this.mBitmapTextureAtlas, this, "facebook.png", 0, 0);
mHardware1[active] = new Sprite(pX, pY, facebook,
this.getVertexBufferObjectManager());
但是当我与小屏幕设备上运行的游戏,精灵大小保持不变。如何克服这一点?
如果您正在使用RatioResolutionPolicy那么你不”不必为此烦恼。 – Siddharth
m使用此最终显示display = getWindowManager()。getDefaultDisplay(); \t \t CAMERA_WIDTH = display.getWidth(); \t \t CAMERA_HEIGHT = display.getHeight(); \t \t Log.e(Integer.toString(CAMERA_WIDTH),Integer.toString(CAMERA_HEIGHT)); \t \t camera = new BoundCamera(0,0,CAMERA_WIDTH,CAMERA_HEIGHT); \t \t回报新EngineOptions(真,ScreenOrientation.LANDSCAPE_FIXED, \t \t \t \t新RatioResolutionPolicy(CAMERA_WIDTH,CAMERA_HEIGHT),摄像头); – raj
如果您想要在所有设备上获得相同的结果,请在设计人员开发800x480或1024x600等图形时使用CAMERA_WIDTH和CAMERA_HEIGHT。 – Siddharth