0
\$\begingroup\$

In my(Android) game, all of my sprites are scaled against to a particular ratio (this 'guide' ratio stays the same regardless of the actual ratio of the screen on which they are to be displayed) - these sprites are then displayed on screens of different ratios.

This way, the game can run full screen on any device, it simply means that more/less of the game is visible on some devices than it is on others.

However, I can't work out how to diaplay a large (full-screen) image on different devices.

The only thing I can think of is to simply create the original image for the larger display and the crop it down to fit other ratios. Something like this:

enter image description here

So here, the image on the right is how the picture will show on the original device (full-screen with no cropping), the device on the left has a smaller width. But what if this runs on a device with a larger screen?

In this case is it simply a case of (uniformly) stretching the image until it fills the screen?

Would be grateful for some guidance.

\$\endgroup\$
  • \$\begingroup\$ Stretch the image as much as necessary, then crop it. \$\endgroup\$ – user253751 Aug 18 '15 at 10:25
1
\$\begingroup\$

I think you don't have to make it full screen on all devices. Nowadays most of the modern devices uses 1920x1080 ratio. So making game run on that ratio will make it run full screen more than half of the devices. And in other devices you can scale your image until one of dimensions match and center it on screen. This way there will be empty places around your image but at least all of your image will be visible.

\$\endgroup\$
  • \$\begingroup\$ Thanks @Senhor but I'm targeting Gingerbread so many many old devices and I'm after trying to avoid the 'blank spaces' you mention. This is the background over which the action takes place and the action is full screen on all devices so having blank spaces would be odd to say the least. Cheers! \$\endgroup\$ – BungleBonce Aug 18 '15 at 10:45
  • 1
    \$\begingroup\$ Then you can separate your background components, have separate png for sun, mountains and may be cloud. You can fill the background with sky.png than place other stuff to fill the screen in amount you need. Also this way you can create a parallax effect \$\endgroup\$ – Arda Kara Aug 18 '15 at 10:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.