I want to use one image for all screen, but if i load bigger image than screen size it is not visible. image size is 1280x720, screen size is 960x540. What can i do?
Code:
public EngineOptions onCreateEngineOptions() {
final DisplayMetrics displayMetrics = new DisplayMetrics();
WindowManager wm = (WindowManager)getSystemService(WINDOW_SERVICE);
wm.getDefaultDisplay().getMetrics(displayMetrics);
wm.getDefaultDisplay().getRotation();
CAMERA_WIDTH = displayMetrics.widthPixels;
CAMERA_HEIGHT = displayMetrics.heightPixels;
this.mCamera = new Camera(0, 0, CAMERA_WIDTH, CAMERA_HEIGHT);
return new EngineOptions(true, ScreenOrientation.PORTRAIT_FIXED, new FillResolutionPolicy(), this.mCamera);}
next:
public void onCreateResources(OnCreateResourcesCallback createResourcesCallback) throws Exception {
final BuildableBitmapTextureAtlas bitmapTextureAtlas = new BuildableBitmapTextureAtlas(
mEngine.getTextureManager(), CAMERA_WIDTH, CAMERA_HEIGHT,
TextureOptions.BILINEAR);
mTextureRegion = BitmapTextureAtlasTextureRegionFactory
.createFromAsset(bitmapTextureAtlas, this, "gfx/h720x1280a.png");
}
Its better to make scale it to support all screens:
place this factor as scale to your background sprite.It will support to all devices.