Reputation: 5652
I have to set a new sprite on background sprite. Background sprite has dimensions set according to dimension of device get through pixel format ..
I am using andengine and ratio Resolution as well but ..
Problem is little bit complex.. I tried to use pixel let say
Glaxy S3 ha *dimensions 720*1280 And required sprite location is (584,608)
so i set in manner ( CAMERA_WIDTH/1.233f,CAMERA_HEIGHT/2.112f)
BUT HTC experia has dimensions 320*480 So the required positions according to
( CAMERA_WIDTH/1.233f,CAMERA_HEIGHT/2.112f) is (2599.5,227.27)
but this wrong according to display... when i set it on (244,172) for experia its working perfect.... please help.
Upvotes: 0
Views: 100
Reputation: 1859
in the method :
public Engine onCreateEngine() {
this.camara = new Camera(0, 0, camara_width, camera_height);
return new EngineOptions(true, ScreenOrientation.LANDSCAPE,
new FillResolutionPolicy(), this.camara).setNeedsSound(true).setNeedsMusic(true);
}
the parameter "new FillResolutionPolicy()" auto resize the width and height you only need make for a one resolution and the app run in any smartphone
Upvotes: 2