Game Development Community

Finding Screen Size

by Bob Blackmon · in Torque 2D Beginner · 02/25/2014 (8:06 pm) · 5 replies

How do I find the size of the window in windowed mode and/or fullscreen mode?
Alternatively, how can I prevent my sprites from stretching based off screen size?

About the author

Playing games is my hobby. Making games is my passion.

Recent Threads


#1
02/25/2014 (9:36 pm)
What you can do is take a screenshot and paste it in Paint and use the select tool to see the dimension. I haven't messed with T2D in awhile.
#2
02/26/2014 (2:06 am)
In canvas.cs you can see what your setting the resolution to

%resolution = "800 600 32";

I used that and mySceneWindow commands to stop my sprites when they were stretching:

mySceneWindow.setCameraPosition(0, 0);
    mySceneWindow.setCameraSize(112, 99);
    mySceneWindow.setCameraZoom(1);
    mySceneWindow.setCameraAngle(0);

Not sure if that's what you were looking for.
#3
02/26/2014 (4:11 am)
Here is a list of TorqueScript functions available to help you with video resolutions:

garagegames.github.io/Torque2D/TorqueScriptDocs/html/group__VideoFunctions.html

To prevent stretching, make sure the aspect ratios of your resolution match your camera view size.
#4
02/26/2014 (12:05 pm)
Thanks everyone. Mike, those functions were exactly what I was looking for.
#5
02/26/2014 (12:30 pm)
Awesome to see that every answer provided here was correct, just coming from different approaches to the problem.

Some days, I'm really proud of this community!