Custom window sizes?
by Matt Grosse · in Torque Game Builder · 09/11/2007 (6:41 am) · 7 replies
How hard would it be to implement a custom window size for TGB? Like the ability to have your game run in a 500x500 window (or any arbitrary size). I guess I'd want the actually resolution to be one thing, while the window is some other set value.
#2
09/11/2007 (3:50 pm)
Actually I think I explained that wrong. As long as the window is a certain size, which you can set via the camera size settings, I should be good. The resolution just needs to stay powers of 2 to not appear distorted correct? Like camera size 50x50 - resolution 640x640 should keep the sprites in the correct proportions.
#3
But by default in your mainScreenGui the t2dSceneWindow fills the entire screen, which means if you change the game resolution it is automatically resizing your sceneWindow. You can change the resizing options of your sceneWindow, or put it in the middle of the screen with space above and below, it doesn't "have" to resize if you don't want it to.
You could get the resolution (extent of the sceneWindow), on startup and set your camera extent to match it, which would eliminate any distortion regardless of the resolution. Or you can get your camera extent and set the sceneWindow extent to match it.
09/11/2007 (4:05 pm)
I think you pretty much got it. But for a little clarification, the game resolution is not really important ... what you don't want is your sceneWindow extent to be different from your sceneCamera extent. But by default in your mainScreenGui the t2dSceneWindow fills the entire screen, which means if you change the game resolution it is automatically resizing your sceneWindow. You can change the resizing options of your sceneWindow, or put it in the middle of the screen with space above and below, it doesn't "have" to resize if you don't want it to.
You could get the resolution (extent of the sceneWindow), on startup and set your camera extent to match it, which would eliminate any distortion regardless of the resolution. Or you can get your camera extent and set the sceneWindow extent to match it.
#4
Also, is there a set minimum allowed resolution? I tried setting it lower than 640, but it kept resetting itself back to 640. And yes, this time I mean resolution :)
edit: Thanks for the help guys
09/11/2007 (5:17 pm)
Oh ok, so the extent settings of the sceneWindow were causing the distortion when I set weird window sizes. I'll play with the gui settings and see if I can get things looking correctly. My focus here is that the game is played in a small window.Also, is there a set minimum allowed resolution? I tried setting it lower than 640, but it kept resetting itself back to 640. And yes, this time I mean resolution :)
edit: Thanks for the help guys
#5
setscreenmode(%width,%height,%bit,%fullscreenmode);
09/11/2007 (5:56 pm)
Do you mean this functionsetscreenmode(%width,%height,%bit,%fullscreenmode);
#6
Either way what you need to mess with is the Extent / MinExtent / HorizResize / VertResize settings for your sceneWindow.
One trick is to set the extent and minExtent to be the same, so it never resizes, if thats what you want. The resizing options affect how the control's extent and positon change when its parent control's extent changes. In my puzzle game case, i set the horizResizing and vertResizing to "center", which means that its extent will not change but its position will be set to the center (whenever its parent's control's extent changes).
Well I couldn't find a description of the different resizing modes anywhere so..
Left: The control will reposition itself to remain the same distance from the right edge of its parent.
Right: The control will reposition itself to remain the same distance from the left edge of its parent.
Width: The control will change its width to remain in proportion to its parent's width.
Height: The control will change its height to remain in proportion to its parent's height.
Center: The control will reposition itself to remain in the center.
Relative: The control will change its width and height to remain in proportion to its parent.
09/12/2007 (9:42 am)
When you say, "the game is played in a small window", do you mean you have resized sceneWindow to take up a smaller portion of the gui screen? I have done this for my projects before, like a puzzle game, in which the sceneWindow takes up a small portion of the game-screen and the rest is just gui objects. Or do you mean the game itself has a small window?Either way what you need to mess with is the Extent / MinExtent / HorizResize / VertResize settings for your sceneWindow.
One trick is to set the extent and minExtent to be the same, so it never resizes, if thats what you want. The resizing options affect how the control's extent and positon change when its parent control's extent changes. In my puzzle game case, i set the horizResizing and vertResizing to "center", which means that its extent will not change but its position will be set to the center (whenever its parent's control's extent changes).
Well I couldn't find a description of the different resizing modes anywhere so..
Left: The control will reposition itself to remain the same distance from the right edge of its parent.
Right: The control will reposition itself to remain the same distance from the left edge of its parent.
Width: The control will change its width to remain in proportion to its parent's width.
Height: The control will change its height to remain in proportion to its parent's height.
Center: The control will reposition itself to remain in the center.
Relative: The control will change its width and height to remain in proportion to its parent.
#7
When I say played in a small window, I mean the entire TGB window is small - not just the area that the sceneWindow occupies. So the game will never be in fullscreen mode, and will only occupy a small area of your desktop space. Literally 500px by 500px for instance.
09/12/2007 (12:25 pm)
Thanks for those clarifications of the gui settings - gui creation/editing is definitely my weakest skill when it comes to TGB.When I say played in a small window, I mean the entire TGB window is small - not just the area that the sceneWindow occupies. So the game will never be in fullscreen mode, and will only occupy a small area of your desktop space. Literally 500px by 500px for instance.
Torque 3D Owner Jason Ravencroft