TGB startup resolution
by Steve D · in Torque Game Builder · 07/21/2010 (4:04 am) · 7 replies
Hello everyone, I have a somewhat annoying problem that maybe someone can help me with. When my TGB game starts up, a black window (TGB) appears that is clearly in 640x480 resolution. After a pause of maybe 2 or 3 seconds it goes to the resolution I am setting it in script and the main game window appears. I am using the setScreenMode very early in the startup process to change it to a more suitable resolution.
Obviously, seeing the game sit there for a few seconds is annoying. I have a scripted system to change the resolution of the game, which loads resolution settings from a file, but is there a way to make it go right to the desired resolution instead of sitting there for a few seconds in 640x480?
Any advice or tips would be awesome!
Obviously, seeing the game sit there for a few seconds is annoying. I have a scripted system to change the resolution of the game, which loads resolution settings from a file, but is there a way to make it go right to the desired resolution instead of sitting there for a few seconds in 640x480?
Any advice or tips would be awesome!
#2
It gets called before _initializeproject, and the file.openForRead() works just fine. (from the appdata\roaming\company\product user directory). Are you sure that you're looking for / putting the file in the right directory?
08/10/2010 (5:00 pm)
I've got my "loadfullscreen();" call in my main.cs, outside of any function calls, right near the top... (just after setting the Company and Product names.)It gets called before _initializeproject, and the file.openForRead() works just fine. (from the appdata\roaming\company\product user directory). Are you sure that you're looking for / putting the file in the right directory?
#3
%fo = new fileobject();
%file = "~/resolution.sav";
%ret = %fo.OpenForRead(%file);
%ret ends up being false. Also, after the last line it's saying illegal coe block in the output, not sure if that's only because it doesn't work
08/10/2010 (9:55 pm)
Hi Tim, that's good to know, what path are you using for the OpenForRead? I have this -%fo = new fileobject();
%file = "~/resolution.sav";
%ret = %fo.OpenForRead(%file);
%ret ends up being false. Also, after the last line it's saying illegal coe block in the output, not sure if that's only because it doesn't work
#4
08/11/2010 (4:20 am)
Mine looks like so, with no path at all:if(!($file.OpenForRead("screen.prf")))
{
$file.close();
pbp("Tried opening screen prefs, but failed.\n");
savefullscreen(1);
return 0;
}
else
#5
So I suspect that's your issue.
08/11/2010 (4:23 am)
When I tried typing in $file.openforread("~/screen.prf"), it says:Quote:
getPrefsPAth - Filename (~/screen.prf) cannot be relative.
So I suspect that's your issue.
#6
Here is my SetCompany
setCompanyAndProduct(BlackWaterGames,RoadGangs);
And here is the path with of the file I am trying to read
C:\Users\steve\AppData\Roaming\BlackWaterGames\RoadGangs\game
Which all looks correct to me but yet it won't open the file, resolution.sav. I tried to open a few other files in that directory with the same result so I can't possibly see how it works for you and not for me!
08/11/2010 (1:35 pm)
I tried what you posted, just the file name and it still doesn't work grrrHere is my SetCompany
setCompanyAndProduct(BlackWaterGames,RoadGangs);
And here is the path with of the file I am trying to read
C:\Users\steve\AppData\Roaming\BlackWaterGames\RoadGangs\game
Which all looks correct to me but yet it won't open the file, resolution.sav. I tried to open a few other files in that directory with the same result so I can't possibly see how it works for you and not for me!
#7
The only difference between mine and yours is "" marks in the names, like:
setCompanyAndProduct("Ghost Ship Studios","GameName");
That might do it.
-Tim
08/11/2010 (4:11 pm)
Did you confirm that the directory is being created and that the file is actually where it is supposed to be? The only difference between mine and yours is "" marks in the names, like:
setCompanyAndProduct("Ghost Ship Studios","GameName");
That might do it.
-Tim
Torque Owner Steve D
The problem now is loading from a saved file. Anywhere in that function, even after executing the SetCompanyAndProduct command, any %file.OpenForRead returns false. So in other words it still needs to switch between a default resolution and the one that the user saved as a preference.
When the very next function executes, initializeProject() in main.cs, any %file.OpenForRead returns true and a saved file can be read.
Anyone know how to get a OpenForRead to work as soon as TGB starts up or any other ideas? I know this is an obscure question but I find it hard to believe nobody else hasn't experienced this, what is your solution?
Thanks in advance!