yash0924 / rokon

Automatically exported from code.google.com/p/rokon
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Aspect Ratio behaviour #147

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
use setGameSize(480,320);
run application on a device with a resolution of 800x480

What is the expected output?
http://christianboutin.com/temp/droid_expected.jpg
which is a stretched version of the original:
http://christianboutin.com/temp/default.jpg

What do you see instead?
http://christianboutin.com/temp/droid.jpg

What version of Rokon are you using?
trunk

On which version of Android are you experiencing this?
2.2 Froyo

Please provide any additional information below.
When the size of the game area is of a certain ratio, like 1.5 (480x320) and 
you run it on a 800x480 screen, I think a ratio-consistent area of 720x480 
"device pixels" (1.5) with black bars left and right would be best to maintain 
the same experience (games like Devilry Huntress and Jewellust do that).  What 
I get instead is a game area of 800x480 device pixels, and so the gameSize is 
actually 533x320.  So everything is shifted left and I get a gap area on the 
right, although the fixed background is stretched over the entire 800x480 area, 
messing up its aspect ratio.

Original issue reported on code.google.com by christia...@gmail.com on 23 Aug 2010 at 12:44

Attachments:

GoogleCodeExporter commented 9 years ago
*note, the 480x320 is a screengrab from the emulator, the droid.jpg is a 
photograph of the game on my droid so it's far from pixel-perfect but you can 
see that the cropped slimes on the right are now entirely visible, and you can 
see far behind them.  The droid_expected.jpg is a Gimp mockup.

Original comment by christia...@gmail.com on 23 Aug 2010 at 12:48

GoogleCodeExporter commented 9 years ago
It's going to be tweaked a little with the next update, but to achieve what 
you're after:

Use a Window, give that 480x320 dimensions. Use window.centre, to position it 
in the middle of what you should be looking at

Use a Sprite instead of a FixedBackground, on the bottom layer (add an extra if 
necessary). FixedBackground ignores any windows.

From your twitter, you're using the trunk version?

If so;
setGameSize(width, height) adjusts for aspect ratio.

Do something like this:

float width = 480, height = 320;
setGameSize(width, height);
width = getGameWidth();
height = getGameHeight();

And you'll notice width before and after, is different. 

Use window.centre(width / 2, height / 2), and it will be as you are looking for 
(if you really want to chop off black bits, put a Black empty Sprite ontop or 
something?)

This is how I manage it in Drop Block.

For anyone else : it's bugged if you try and do it in portrait right now 
though, I think ^_^

Original comment by rtaylor205@gmail.com on 23 Aug 2010 at 8:55