Sunday, November 1, 2009

Aspect Ratios and forced perspective

Well now i changed all my page artwork to 1024x1024 pictures, they are as big a resolution as i can fit into this XNA product. But of course this leaves me with the aspect ratio problem, as my pages should be 1.5 times taller than wide. and obviously 1024x1024 is a square.

Simply by multiplying the render size of the width by 0.667f though i got the desired result and i was soo happy. It all fits in memory AND it is a power of two size so no issues with DXT or render performance, not like i had performance isues anyway, lol.

So i then run it on the Xbox and OMG i forgot that i am using the 1280x720 standard res, but i view my development on a normal 4:3 tv. Soo The nice Xbox scales the width for ya in a nice way. This sounds great and for my previous games it was AOK to have the pixels none square. This time however that is not the case. So what to do ?

I looked into the XNA graphics calls to see what i could find, the simple idea was to find out what aspect ratio the game was currently displaying in, and then use this float value to resize my pages. This went quite well and i find this nice Vieport part of the class with DisplayMode.AspectRatio. Wootilicious, it tells me either 1.333f or 1.777f. I now have my solution.

However i Did add the multiplier to the page width and it appears to work, but upon reflection i realised that Wide screen will now not work properly and my pages are gonna be Uber wide, DOH! Not sure atm what i will do, but probably not mess about with calculations, i will probably test to see if it is bigger than 1.444f and then just set it to 1.0f. Therefore maintaining the aspect ratio for wide screen or 4:3.

Now i need to go onto Trial mode and i should be done.

No comments:

Post a Comment