Window size in iTGB
by Mark Schmidt · in iTorque 2D · 01/28/2009 (3:54 pm) · 23 replies
I'm either missing something here or it's just broken. I hope its the former and not the latter. I like hitting the "Play" button from within TGB to test a scene. However, I can't seem to figure out how to change that window size so it emulates the iPhone better. I want a Portrait resolution, but changing everything I can find doesn't seem to do anything. It always jumps to 800x600. Any hints?
About the author
#2
<Resolution>800 600 32</Resolution>
when I run it. I've tried everything including closing iTGB, editing that file, opening iTGB and running only to see it revert back to that.
01/28/2009 (4:30 pm)
I do that but it always gets overwritten to say:<Resolution>800 600 32</Resolution>
when I run it. I've tried everything including closing iTGB, editing that file, opening iTGB and running only to see it revert back to that.
#3
01/28/2009 (5:18 pm)
do a search in your project for $game::resolution and see if it gets changed anywhere, I think it defaults to "800 600" in the default TGB project template.
#4
Those are for iphone only.
if you test run on desktop, you can hope for 640x480 as minimum size of a 3D context, potentially its 800x600 depending on the card
to replicate iphone I would suggest to use 960x640 (-> 480x320) or 640x960 (320x480)
01/28/2009 (5:45 pm)
you can not run on desktop with that sizes.Those are for iphone only.
if you test run on desktop, you can hope for 640x480 as minimum size of a 3D context, potentially its 800x600 depending on the card
to replicate iphone I would suggest to use 960x640 (-> 480x320) or 640x960 (320x480)
#5
Here's my filthy work-around:
Put black borders around the sides of your game, limiting the viewable area to 480x320 and run this code when the level loads:
if ($platform $= "iPhone")
{
setRes(480, 320, 32);
sceneWindow2D.setCurrentCameraPosition(0, 0, 480, 320);
}
else
{
setRes(640, 480, 32);
sceneWindow2D.setCurrentCameraPosition(0, 0, 640, 480);
}
01/28/2009 (8:23 pm)
The last version of iTGB ran at 480x320 or 320x480 but that's been broken (along with multi-touch, and saving preferences) in the latest version (iTGB 1.1) so now it can't run at lower than 640x480.Here's my filthy work-around:
Put black borders around the sides of your game, limiting the viewable area to 480x320 and run this code when the level loads:
if ($platform $= "iPhone")
{
setRes(480, 320, 32);
sceneWindow2D.setCurrentCameraPosition(0, 0, 480, 320);
}
else
{
setRes(640, 480, 32);
sceneWindow2D.setCurrentCameraPosition(0, 0, 640, 480);
}
#6
01/28/2009 (9:09 pm)
Okay, I haven't played around with iTGB yet so I don't know if this will work or not, but look in the file common\gameScripts\properties.cs. The final function in that file is _defaultGameConfigurationData(). Look and see is $Game::Resolution is set to "800 600 32". It is a quick easy change and maybe that will solve your problem.
#7
01/29/2009 (2:18 am)
Did a new version get released? I can set the editing pref to 320x480 and that stays. The project resolution size always defaults to 800x600, that I do have to set at 320x480 every time, until I looked up the code that changes this default. I can't remember offhand but I searched for 800 600 to find it in the scripts.
#8
the most current is 1.1 which has been around a while now.
01/29/2009 (4:11 am)
No, not anywhen recently.the most current is 1.1 which has been around a while now.
#9
02/03/2009 (2:06 am)
I'm having a hell of a time getting my game running even in the simulator. I can't get it to display correctly. Even if I edit the commonconfig.xml and put in <ScreenOrientation>Landscape</ScreenOrientation> it still shows up in portrait when I run the simulator or on the device. Is this a bug and are none of these issues worked out?
#10
you need to set it in the prefs.cs and in the XML and both should mention 480x320 as resolution for landscape
02/03/2009 (2:36 am)
Sounds like you didn't set the resolution right.you need to set it in the prefs.cs and in the XML and both should mention 480x320 as resolution for landscape
#11
If i change <Resolution>320 480 32</Resolution> then it does work (by work i mean display the full screen but obviously it does not look right b/c it squashes everything)
Are there any more tricks. it is very frustrating.
02/04/2009 (1:46 pm)
I am having the same problem as Wenceslao. I have modified $Game::Resolution and <ScreenOrientation>Landscape</ScreenOrientation> and <Resolution>480 320 32</Resolution> and the simulator always appears in portrait mode but the app runs in landscape (white bars on left and bottom). If i use the mouse it appears about 100 pix below my acutal mouse click. If i change <Resolution>320 480 32</Resolution> then it does work (by work i mean display the full screen but obviously it does not look right b/c it squashes everything)
Are there any more tricks. it is very frustrating.
#12
Use XCode and put a breakpoint on setScreenMode() and see when it gets called. That's the function that sets the resolution.
Another thing to try is put call setScreenMode( 480, 320, 32 ); somewhere in your script after your game has loaded. That should set things right, it's a not a solution, but if it works it'll prove that your resolution is still being set wrong.
Lastly, check your prefs.cs, it may be saving your $game::resolution and overwriting it when loading, especially if you have used exportPrefs().
02/04/2009 (3:45 pm)
Jugding by your "symptoms", it sounds like you game app has transitioned into Landscape mode, but the resolution is still off.Use XCode and put a breakpoint on setScreenMode() and see when it gets called. That's the function that sets the resolution.
Another thing to try is put call setScreenMode( 480, 320, 32 ); somewhere in your script after your game has loaded. That should set things right, it's a not a solution, but if it works it'll prove that your resolution is still being set wrong.
Lastly, check your prefs.cs, it may be saving your $game::resolution and overwriting it when loading, especially if you have used exportPrefs().
#13
For example: C:\Documents and Settings\Ender\Application Data\GarageGames\TorqueGameBuilder
If you installed TGB 1.7.4, then iTGB 1.0, then iTGB 1.1, there is a chance the editor is referencing the saved settings from 1.7.4.
Delete the contents of this folder, then make all of the local script and XML settings suggested in this thread.
Sorry for the confusion.
02/07/2009 (12:29 pm)
@Everyone - There is a good chance that the problem stems from previous installations of TGB and iTGB. The base TGB engine creates and stores settings in a user's OS "home".For example: C:\Documents and Settings\Ender\Application Data\GarageGames\TorqueGameBuilder
If you installed TGB 1.7.4, then iTGB 1.0, then iTGB 1.1, there is a chance the editor is referencing the saved settings from 1.7.4.
Delete the contents of this folder, then make all of the local script and XML settings suggested in this thread.
Sorry for the confusion.
#14
In fact, after changing the xml code and then opening iTGB then going back, the code has defaulted back to 800 600. I double checked, changed settings again. Maybe im missing something?
You would think that that iTorque would set the default 480x320 with out referencing any other install. This issue is causing a lot of time and frustration on my end and has brought in engine development to a stand still. I'm really not much of a programmer so I don't know how complicated this is for you. I appreciate all the work you guys have done so far.
It is my opinion that that iTGB should give you a resolution setting option in the Create section when setting up the directory (much like page layout programs) so that you can "at least" set it portrait or landscape from the get go. So that your default camera and the game it self is in the 3:2 aspect ratio.
I was able to get the editors camera to stay but the design resolution keeps resetting to 800x600.
02/08/2009 (2:28 pm)
@ Michael Perry I what you said, deleting folder contents and changing files related to the resolution, this and it didn't seem to help. In fact, after changing the xml code and then opening iTGB then going back, the code has defaulted back to 800 600. I double checked, changed settings again. Maybe im missing something?
You would think that that iTorque would set the default 480x320 with out referencing any other install. This issue is causing a lot of time and frustration on my end and has brought in engine development to a stand still. I'm really not much of a programmer so I don't know how complicated this is for you. I appreciate all the work you guys have done so far.
It is my opinion that that iTGB should give you a resolution setting option in the Create section when setting up the directory (much like page layout programs) so that you can "at least" set it portrait or landscape from the get go. So that your default camera and the game it self is in the 3:2 aspect ratio.
I was able to get the editors camera to stay but the design resolution keeps resetting to 800x600.
#15
Obviously this should be fairly easy to change in code, just wanted to make sure there wasn't some reason why it was set up this way in the first place.
02/10/2009 (1:14 pm)
Everytime iTGB is shut down, the editor resolution gets reset to 800x600, even if it is set to 480x320 and then the project is saved. Is there any way around this? Happens on both the PC and Mac. Obviously this should be fairly easy to change in code, just wanted to make sure there wasn't some reason why it was set up this way in the first place.
#16
02/10/2009 (7:50 pm)
Geoff - that's a bug in the latest version. It shouldn't do that.
#17
02/19/2009 (10:09 pm)
If it is a bug in the latest version, has anyone found a way around it because I am still stuck with it resetting to 800x600.
#18
But I agree that this definitely should NOT affect the iPhone App related settings, as it is only related to the tgbgame & editor.
02/20/2009 (6:07 am)
Chances are good that your graphic card just does not allow you to have a resolution smaller than 800x600 for the 3D window. Especially on windows.But I agree that this definitely should NOT affect the iPhone App related settings, as it is only related to the tgbgame & editor.
#19
02/20/2009 (12:44 pm)
I locked the file (based on someone's suggestion) and it works fine for me now.
#20
C:\\Documents and Settings\\Kevin\\Application Data\\GarageGames\\TorqueGameBuilder\\levelEditorPrefs.cs
You can edit the two variables $levelEditor::DesignResolutionX and $levelEditor::DesignResolutionY to the values you want. In my case I changed them to 480x320.
There are a couple of things coming together to cause this problem.
First, TGB and iTGB are both referencing this same levelEditorPrefs.cs file. So it was created by TGB with the design resolution vars set to 800x600.
And second, the exportVariables routine (in console\\Dictionary.cc) is commented out in the iTGB engine so that iTGB does not update levelEditorPres.cs like it is supposed to in the function destroyLevelEditor in the file tgb\\tools\\levelEditor\\main.cs.
I'm guessing the exportVariables was commented out because where/how files can be written on the iPhone device? I haven't played with iTGB yet, but I want to eventually.
Oh, I did the preceding on my windows machine, but the levelEditorPrefs file must be stored somewhere else on a Mac.
02/20/2009 (2:15 pm)
I just took a quick look at this to see if I could find out what was going on. The design resolution is saved in a file called levelEditorPrefs.cs. The folder that it is in is based upon the user's data directory along with company and app name. On my computer the location is:C:\\Documents and Settings\\Kevin\\Application Data\\GarageGames\\TorqueGameBuilder\\levelEditorPrefs.cs
You can edit the two variables $levelEditor::DesignResolutionX and $levelEditor::DesignResolutionY to the values you want. In my case I changed them to 480x320.
There are a couple of things coming together to cause this problem.
First, TGB and iTGB are both referencing this same levelEditorPrefs.cs file. So it was created by TGB with the design resolution vars set to 800x600.
And second, the exportVariables routine (in console\\Dictionary.cc) is commented out in the iTGB engine so that iTGB does not update levelEditorPres.cs like it is supposed to in the function destroyLevelEditor in the file tgb\\tools\\levelEditor\\main.cs.
I'm guessing the exportVariables was commented out because where/how files can be written on the iPhone device? I haven't played with iTGB yet, but I want to eventually.
Oh, I did the preceding on my windows machine, but the levelEditorPrefs file must be stored somewhere else on a Mac.
Torque 3D Owner Mat Valadez
Default Studio Name
<resolution>320 480 32</resolution>