Resolution starts incorrect [RESOLVED]
by Christian · in Torque 2D Beginner · 08/06/2013 (2:29 am) · 12 replies
Hi,
Is there any fix to the initial-resolution issue? When the game starts the resolution is off (have tried multiple varieties including default preferences and issue still persists).
When you resize the window, the resolution goes to the correct size (even if you resize the window a single nano-meter). Is there a command that can automatically do this so you don't have to manually drag the window-size each time?
Thanks,
Christian
P.S. this also is the same for button-clicking, buttons aren't clickable until that initial window resizing.
Is there any fix to the initial-resolution issue? When the game starts the resolution is off (have tried multiple varieties including default preferences and issue still persists).
When you resize the window, the resolution goes to the correct size (even if you resize the window a single nano-meter). Is there a command that can automatically do this so you don't have to manually drag the window-size each time?
Thanks,
Christian
P.S. this also is the same for button-clicking, buttons aren't clickable until that initial window resizing.
#2
It clearly creates the window from the preferences at startup. Skip that, and your issue should be at least partially solved!
08/06/2013 (10:56 am)
To bypass the auto-sizing which occurs at the start, take a look at the following functionfunction initializeCanvas(%windowName)
{
...
if ( $pref::Video::windowedRes !$= "" )
%resolution = $pref::Video::windowedRes;
else
%resolution = $pref::Video::defaultResolution;
...
}It clearly creates the window from the preferences at startup. Skip that, and your issue should be at least partially solved!
#3
Running windows 7. Desktop resolution is 1366 x 768. I've tried starting T2D with:
$pref::Video::defaultResolution = "1366 768 32"; //"768 1024 32"; //"640 1136 32"; //"1024 768 32";
$pref::Video::windowedRes = "1366 768 32"; // "768 1024 32"; // "640 1136 32"; //"1024 768 32";
Those and several others. They all seem to do the same thing (startup in a weird resolution and when window is resized, it goes to correct resolution).
Simon,
Doing that gives the error message 'Refreshing texture but no texture created' which doesn't start the game. I added some of the other stuff (excluding the ios preferences) and it does load, but still has the same issue at startup.
08/06/2013 (12:23 pm)
Michael,Running windows 7. Desktop resolution is 1366 x 768. I've tried starting T2D with:
$pref::Video::defaultResolution = "1366 768 32"; //"768 1024 32"; //"640 1136 32"; //"1024 768 32";
$pref::Video::windowedRes = "1366 768 32"; // "768 1024 32"; // "640 1136 32"; //"1024 768 32";
Those and several others. They all seem to do the same thing (startup in a weird resolution and when window is resized, it goes to correct resolution).
Simon,
Doing that gives the error message 'Refreshing texture but no texture created' which doesn't start the game. I added some of the other stuff (excluding the ios preferences) and it does load, but still has the same issue at startup.
#4
Alternatively, setting the $pref::Video::windowedRes value to something else (even weird custom resolutions) works fine as in the following example :
I'm editing this code in Torque2D\modules\AppCore\1\scripts\canvas.cc
This was tested in a clean install from the development branch as well as from a custom build just to make sure.
08/06/2013 (3:05 pm)
I've tested the following code and it works as expected, sizing the window to whatever resolution I choose :function initializeCanvas(%windowName)
{
...
if ( $pref::Video::windowedRes !$= "" )
%resolution = "800 600 32";
else
%resolution = "1366 768 32";
...
}Alternatively, setting the $pref::Video::windowedRes value to something else (even weird custom resolutions) works fine as in the following example :
$pref::Video::windowedRes = "320 800 32"; %resolution = $pref::Video::windowedRes;
I'm editing this code in Torque2D\modules\AppCore\1\scripts\canvas.cc
This was tested in a clean install from the development branch as well as from a custom build just to make sure.
#5
08/06/2013 (3:19 pm)
Be sure the preference are actually loaded before you initialize the canva, the example module might not do that correctly.
#6
Using
Does change the window size to whatever I put in that first value, but the resolution is still not changing. I can click the buttons actually like that, but I must click where they should be (after resizing the window) instead of where they actually show up on the screen.
This is an example of how it originally shows up and then after resizing the window (both are the same size window).

08/06/2013 (9:29 pm)
The preferences are loading 1st.Using
function initializeCanvas(%windowName)
{
...
if ( $pref::Video::windowedRes !$= "" )
%resolution = "800 600 32";
else
%resolution = "1366 768 32";
...
}Does change the window size to whatever I put in that first value, but the resolution is still not changing. I can click the buttons actually like that, but I must click where they should be (after resizing the window) instead of where they actually show up on the screen.
This is an example of how it originally shows up and then after resizing the window (both are the same size window).

#7
When I make tests on my 2 builds, however I resize the window, the gui elements are sized relatively to the window size and positioned relatively as well, the camera stretches or squashes to match the aspect ratio, etc.
Are the buttons you are using actual GuiButtons? Are they Sceneobject Sprites which detect clicks? Do they have collision shapes?
I'm really confused by this one.
08/06/2013 (9:59 pm)
If I follow you correctly, you say that when clicking the buttons in the bottom image, they don't respond. And that if you want to get the expected results, you must click where they should be (which means where they appear in the top image) Is that correct?When I make tests on my 2 builds, however I resize the window, the gui elements are sized relatively to the window size and positioned relatively as well, the camera stretches or squashes to match the aspect ratio, etc.
Are the buttons you are using actual GuiButtons? Are they Sceneobject Sprites which detect clicks? Do they have collision shapes?
I'm really confused by this one.
#8
Tried to make a video showing it, but it didn't turn out well.
If you have a free second and don't mind taking a look, here is the game: https://www.dropbox.com/s/sflf1o0fklaxldg/Pirate%20Warlords.zip (20mb zip).
08/06/2013 (10:20 pm)
The buttons are sprites. The buttons themselves aren't the issue, rather the result of the resolution issue.Tried to make a video showing it, but it didn't turn out well.
If you have a free second and don't mind taking a look, here is the game: https://www.dropbox.com/s/sflf1o0fklaxldg/Pirate%20Warlords.zip (20mb zip).
#9
As for the 'resolution', if the window size is set correctly, then your canvas will be at that resolution as well. Maybe you mean the Scene Objects aren't being rendered at the correct aspect ratio, positions or scales? In that case, that's the SceneWindow / camera which you should resize or zoom to match the aspect ratio of your window.
I look at the console and see an astounding amount of script errors; it makes it really hard to read through the console log and try to figure exactly what's wrong. Whenever the console issues a warning or worse, an error, you should really focus on fixing that before trying to fix other issues.
Also, SceneGroups can be anything from 0-31, numbers higher than that won't work. The same rule applies for SceneLayers, Collision Layers and groups.
08/06/2013 (10:54 pm)
Even when running the project with your .exe, if I stretch the screen in strange ways or if I specify a different resolution at startup, I can still click "Battle" every single time, taking me to the Pirate fight. Har! The other buttons don't work in all cases and clicking anywhere else on the screen just spams the console with errors.As for the 'resolution', if the window size is set correctly, then your canvas will be at that resolution as well. Maybe you mean the Scene Objects aren't being rendered at the correct aspect ratio, positions or scales? In that case, that's the SceneWindow / camera which you should resize or zoom to match the aspect ratio of your window.
I look at the console and see an astounding amount of script errors; it makes it really hard to read through the console log and try to figure exactly what's wrong. Whenever the console issues a warning or worse, an error, you should really focus on fixing that before trying to fix other issues.
Also, SceneGroups can be anything from 0-31, numbers higher than that won't work. The same rule applies for SceneLayers, Collision Layers and groups.
#10
I can stretch/resize it as much as I want and it works fine like yours, but I wonder why yours works at the start without stretching/resizing.
Yeah the script errors and SceneGroups I haven't gotten to yet.
Anyways thanks for taking the time to look at it.
08/06/2013 (11:08 pm)
That's weird.I can stretch/resize it as much as I want and it works fine like yours, but I wonder why yours works at the start without stretching/resizing.
Yeah the script errors and SceneGroups I haven't gotten to yet.
Anyways thanks for taking the time to look at it.
#11
I'd suggest cleaning the .dso's and testing it on another PC or Mac.
08/06/2013 (11:15 pm)
No clue. :)I'd suggest cleaning the .dso's and testing it on another PC or Mac.
#12
I guess it just needed something with more power.
Changing that line to:
11/08/2013 (9:47 pm)
New computer and Simon your original suggestion now works.I guess it just needed something with more power.
Changing that line to:
%resolution = "500 670 32";gives the desired result (although it's very weird to see resolution number like that).
Employee Michael Perry
ZombieShortbus