Image Scaling for Different Screen Sizes

Started by
2 comments, last by Zakwayda 4 years, 6 months ago

I'm working on my first Android game and I have a few questions.

I need to scale the graphics for different screen sizes/resolutions. I'm working in 16:9 and plan to use letter boxing to maintain this aspect ratio.

Everything is fine for standard screen resolutions. Going from 320:180 to 640:360, one pixel just becomes four. I'm a little confused though as to what happens when you letterbox on a screen with a unusual resolution.

Say, just for exsample, my original graphics are 160:90. Then to fit the devise I stretch everything by 1.1 and end up with a final resolution of 176:99. Its still 16:9 but now everything is a mess.

If I had a sprite that used to be at x-33 y-33 it's new location would now be at x-36.3 y-36.3. Would I just drop the 0.3 of a pixel, round down and accept that it's no longer in its exact position? 

Secondly what exactly happens when you stretch images by an amount like 1.1? How dose it decide what pixels to add to the image to make it bigger? 

Advertisement

In 3d games it involves aspect ratio utilizing the screen ratio, inside the projection matrix. It will alllow user to simply see more or less of the space in direction he has bigger the screen. On mobiles it can flip any time so projection matrix updates.

What projection do you use if any?

In addition to JohnnyCode's questions, what are you using for rendering graphics? OpenGL?

This topic is closed to new replies.

Advertisement