1

I'm creating an Android application (a game, to be more precise) and using AndEngine.
My designer is working on the background images for the game and he need to know
what is the ideal size (width & height or a ratio?) for the background image.

Clarification: I want to target for variety of android-devices.

4

3 回答 3

2

I think the best thing to do is to pick a common screen size and then develop everything based on that size. If you use a RatioResolutionPolicy(CAMERA_WIDTH, CAMERA_HEIGHT), AndEngine will scale everything appropriately.

And with that in mind, I would consider what devices you want to run on and go with one of the larger choices - it's easier to scale down than up.

Personally, I develop on a 7" tablet which is 1024x600 and it works fine on my phone which is 800x480

于 2012-04-06T15:47:51.637 回答
0

You could generate by the device's width:

mWinMgr = (WindowManager)context.getSystemService(Context.WINDOW_SERVICE);
int displayWidth = mWinMgr.getDefaultDisplay().getWidth();

or you can use high resolution that fits all. It's not recommended though.

于 2012-04-06T14:53:28.963 回答
0

You could create the image as the largest size, and then save the image at different sizes that represent the average screen sizes for small, medium, and large devices, then use a switch statement to determine which one to load based on the screen size.

final Display myDisplay = getWindowManager().getDefaultDisplay();
int displayWidth = myDisplay.getWidth();
int displayHeight = myDisplay.getHeight();

This will tell you what your actual screen pixel size is. Even large images are tiny in PNG format a 1024x1024 image is less than 1.64 mb on average (depending on complexity). So if you do the average sizes you probably end up with 3-4 images at about 2mb total. Using the smallest image for the size of the screen will also speed up your app.

于 2012-04-12T17:15:45.337 回答