Game Development Community

Setting the camera for a specific resolution

by Sean Monahan · in Torque X 2D · 07/11/2008 (9:28 am) · 2 replies

I'm trying to setup my camera for 720p (1280x720px) and I'm not quite sure how to go about this. I read this forum thread (http://www.garagegames.com/mg/forums/result.thread.php?qt=69091) and I'm still a bit lost.

My understanding is that camera X and Y set the center of the camera. Camera width and height then set the aspect ratio of the camera as well as the actual pixel dimensions of the camera. The tricky part is that the width and height are somehow relative to objects in the scene (the link I posted mentions this).


So a few questions:

1. Are my assumptions, posted above, correct?
1.1 If not, please correct me.

2. How do I determine the pixel dimensions of the camera from the width and height? Based on my understanding from the link I posted, I would set something like a 16x16px block to be my base object and then do some math to determine that 1280/16 = 80 and 720/16 = 45. I would then set my width to 20 and my height to 11.25 to get a 1280x720px screen.

Somehow, this doesn't seem right. Also, when I test the game on Windows the game window is certainly not set to 1280x720px as that would fill most of my display rather than the third or so it does.

As for software, I'm using Torque X Builder 2.0.0.0.

Any input is greatly appreciated.

Thanks!

#1
07/11/2008 (11:35 pm)
The fastest way to do this is to open your game's torqueSettings.xml file and set the following values:

<PreferredBackBufferHeight>720</PreferredBackBufferHeight>
<PreferredBackBufferWidth>1280</PreferredBackBufferWidth>

The TXB builder will always show a 1024x768 layout, that will never change, but your game should run at 1280x720.

John K.
#2
07/12/2008 (7:40 am)
Changing the settings you mentioned worked like a charm. I loaded up the sample level from the platform started kit and the window is now at 720p. I did notice that things were stretched a tad so I changed the camera's width and height from 100x75 (4:3) to 160x90 (16:9). Now it looks perfect.

Thanks!