Pref and screen resolution pb
by Crystal Noir · in Technical Issues · 07/24/2008 (12:19 am) · 8 replies
Hi,
I've already posted in the TGB section my problem, but it seems to be difficult to have and idea.
When I've read some stuff in the documention it seems to be the same way in TGE so, I try to ask my question here :)
here's the topic : http://www.garagegames.com/mg/forums/result.thread.php?qt=77339
Then, here's the question :
I have some questions about prefs files and resolution.
I've searched everywhere but I don't find answer that works for me.
On a projet, I want it to start with a particular resolution. By default, game starts with 800X600 resolution.
I want it to start with 1024 X 768 resolution directly.
In my search, I've found this :
$pref::Video::Resolution = "1024 768 32";
I try to code it in the default preference file but it doesn't work :( That's change nothing. In an other search, a topic talk about a prefs.cs file. I don't have this file...only the default preference file.
So my question is : How can I said to the engine to launch the project with the resolution I want directly ?
It's in TGB but if I understand some things, in TGE that 's similar.
So, have you got an idea ? I try to change the xml configuration file but it doesn't work, the engine reset the resolution to the default (80x600).
Thx in advance :)
PS : very sorry for my bad english ;)
I've already posted in the TGB section my problem, but it seems to be difficult to have and idea.
When I've read some stuff in the documention it seems to be the same way in TGE so, I try to ask my question here :)
here's the topic : http://www.garagegames.com/mg/forums/result.thread.php?qt=77339
Then, here's the question :
I have some questions about prefs files and resolution.
I've searched everywhere but I don't find answer that works for me.
On a projet, I want it to start with a particular resolution. By default, game starts with 800X600 resolution.
I want it to start with 1024 X 768 resolution directly.
In my search, I've found this :
$pref::Video::Resolution = "1024 768 32";
I try to code it in the default preference file but it doesn't work :( That's change nothing. In an other search, a topic talk about a prefs.cs file. I don't have this file...only the default preference file.
So my question is : How can I said to the engine to launch the project with the resolution I want directly ?
It's in TGB but if I understand some things, in TGE that 's similar.
So, have you got an idea ? I try to change the xml configuration file but it doesn't work, the engine reset the resolution to the default (80x600).
Thx in advance :)
PS : very sorry for my bad english ;)
#2
I've seen also $Pref::Video::windowedRes
It works with but I don't understand because the doc says that this command works only with mac lol.
I don't have any Prefs.cs file but the default configuration cs file and when I write in "$Pref::Video::Resolution......etc...etc..." it doesn't work ^^
07/24/2008 (4:28 am)
Yes when I set the design resolution it works but the engine start with 800 X 600 resolution and switch after...I've seen also $Pref::Video::windowedRes
It works with but I don't understand because the doc says that this command works only with mac lol.
I don't have any Prefs.cs file but the default configuration cs file and when I write in "$Pref::Video::Resolution......etc...etc..." it doesn't work ^^
#3
Inside it you will see these lines..
That is where it actually sets the resolution when TGB starts. You can change it like this...
That will definitely have TGB always start in that resolution. If you want to muck around in canvas.cs and properties.cs, perhaps step through _loadGameConfigurationData, you might find the real reason for the problem (and I suspect its a bug in TGB), but this "hack" will work.
07/24/2008 (4:54 am)
In Common/gamescripts/canvas.cs there is a function called initializeCanvas.Inside it you will see these lines..
%goodres = $Game::Resolution; setScreenMode( GetWord( %goodres, 0), GetWord( %goodres,1), GetWord( %goodres,2), false );
That is where it actually sets the resolution when TGB starts. You can change it like this...
%goodres = "1024 768 32"; setScreenMode( GetWord( %goodres, 0), GetWord( %goodres,1), GetWord( %goodres,2), false );
That will definitely have TGB always start in that resolution. If you want to muck around in canvas.cs and properties.cs, perhaps step through _loadGameConfigurationData, you might find the real reason for the problem (and I suspect its a bug in TGB), but this "hack" will work.
#4
07/24/2008 (12:48 pm)
May be because I've tried to setup $game::Resolution and it doesn't work ^^
#5
07/24/2008 (1:11 pm)
Did you follow the direction I gave in my last post? If that doesn't work I have no other suggestions.
#6
I search where the engine setup this variable.
An other idea : display a window at the start of the game that ask players to choose a resolution, but I don't know how to do this yet.
07/25/2008 (12:19 am)
Yes that's work but I don't understand why, when I setup the $game::resolution like $game::resolution = "1024 768 32"; that doesn't work.I search where the engine setup this variable.
An other idea : display a window at the start of the game that ask players to choose a resolution, but I don't know how to do this yet.
#7
That is where it loads the commonConfig.xml and assigns the resolution specified in it to $Game::Resolution. If it does not find a commonConfig.xml it sets $Game::Resolution to "800 600 32".
Just setting the variable $Game::Resolution does not actually change the resolution. The resolution is actually set by setScreenMode( ... ) in canvas.cs, the code I already pasted above.
You can look at options.cs and options.gui in common as an example of a gui that allows the user to change the resolution.
07/25/2008 (8:14 am)
Common/gamescripts/properties.cs is where $Game::Resolution is set. That is where it loads the commonConfig.xml and assigns the resolution specified in it to $Game::Resolution. If it does not find a commonConfig.xml it sets $Game::Resolution to "800 600 32".
Just setting the variable $Game::Resolution does not actually change the resolution. The resolution is actually set by setScreenMode( ... ) in canvas.cs, the code I already pasted above.
You can look at options.cs and options.gui in common as an example of a gui that allows the user to change the resolution.
#8
In add, If you change the code part witch setup the default data to 1024X768 and not 800 X 600 that doesn't work anymore ^^ (in the .cs default preference file).
I think the only solution is yours (start of this post).
07/26/2008 (1:49 am)
For the xml file : If you try to change the resolution in this file, the engine reset the resolution to the default (800X600)....In add, If you change the code part witch setup the default data to 1024X768 and not 800 X 600 that doesn't work anymore ^^ (in the .cs default preference file).
I think the only solution is yours (start of this post).
Associate James Ford
Sickhead Games
You could also find your game's appdata folder and change the xml config and prefs.cs (if you see one) in there to the correct resolution.
I think something might be broken atm because, as I said, when I set the design resolution in the editor it didn't seem to save.