IPhone screen orientation AND commonConfig.xml issues
by Pedro Vicente · in iTorque 2D · 04/29/2011 (3:26 am) · 2 replies
Hello everyone
Build: iTorque2d 1.4.1
It took me a whole day to find the answer to the question
ISSUE 1 (System: Mac, XCode4): How to set the IPhone screen orientation to Portrait?,
so I might as well post here the answer :)
This can be done in the Editor of course (iPhone Project Settings), but I wanted to see which file controls this. The file is
"\MyProjects\<My_game>projectFiles\commoncommonConfig.xml"
and the line that controls this is
(value 0 is landscape, 1 is portrait)
ISSUE 2 (Windows): multiple commonConfig.xml files
Now, since I develop mostly in Windows, initially I was using Torsion to see where in script this was set. This is done in main.cs
First, I started looking at the *wrong* commonConfig.xml file. For some reason, another commonConfig.xml was in
"\MyProjects\<My_game>\common\commonConfig.xml"
Not sure where this file came from. After deleting/renaming *both* files to see which commonConfig.xml was being read, then the mystery got deeper. The app was *still* reading a third commonConfig.xml !
A search in the Windows drives showed that after deleting the first 2, another one just showed up here
"C:\Users\<user_name>\AppData\Roaming\Independent\defaultName\common\commonConfig.xml"
This is because the app saves this file on exit
Problem is: Now I cannot make my app to reload my original
"\MyProjects\<My_game>\projectFiles\common\commonConfig.xml"
For some reason it always reads the one at
"C:\Users\<user_name>\AppData\Roaming\Independent\defaultName\common\commonConfig.xml"
And this of course causes my app not to run as intended :), since it attempts to load a non-existent level file (the default level file in the code, this time read from the new xml file. Confusing? It is )
--------Adding to Level game/data/levels/untitled.t2d
Error loading level game/data/levels/untitled.t2d. Invalid file.
So, my question is : How to make the app read the original commonConfig.xml ?
Build: iTorque2d 1.4.1
It took me a whole day to find the answer to the question
ISSUE 1 (System: Mac, XCode4): How to set the IPhone screen orientation to Portrait?,
so I might as well post here the answer :)
This can be done in the Editor of course (iPhone Project Settings), but I wanted to see which file controls this. The file is
"\MyProjects\<My_game>projectFiles\commoncommonConfig.xml"
and the line that controls this is
<iDeviceScreenOrientation>1</iDeviceScreenOrientation>
(value 0 is landscape, 1 is portrait)
ISSUE 2 (Windows): multiple commonConfig.xml files
Now, since I develop mostly in Windows, initially I was using Torsion to see where in script this was set. This is done in main.cs
_loadGameConfigurationData( expandFileName("./commonConfig.xml") );First, I started looking at the *wrong* commonConfig.xml file. For some reason, another commonConfig.xml was in
"\MyProjects\<My_game>\common\commonConfig.xml"
Not sure where this file came from. After deleting/renaming *both* files to see which commonConfig.xml was being read, then the mystery got deeper. The app was *still* reading a third commonConfig.xml !
A search in the Windows drives showed that after deleting the first 2, another one just showed up here
"C:\Users\<user_name>\AppData\Roaming\Independent\defaultName\common\commonConfig.xml"
This is because the app saves this file on exit
_saveGameConfigurationData( expandFileName("./commonConfig.xml") );Problem is: Now I cannot make my app to reload my original
"\MyProjects\<My_game>\projectFiles\common\commonConfig.xml"
For some reason it always reads the one at
"C:\Users\<user_name>\AppData\Roaming\Independent\defaultName\common\commonConfig.xml"
And this of course causes my app not to run as intended :), since it attempts to load a non-existent level file (the default level file in the code, this time read from the new xml file. Confusing? It is )
--------Adding to Level game/data/levels/untitled.t2d
Error loading level game/data/levels/untitled.t2d. Invalid file.
So, my question is : How to make the app read the original commonConfig.xml ?
#2
Related to this, I found a small bug in the script code in that deals with this. In main.cs there are these 2 function calls
and inside the function _loadGameConfigurationData there is, to deal with the case that no xml file was found
Now, this function does not exist. Probably it is meant to be _defaultGameconfigurationData().
The way I would do this would be
Not a bug that causes anything to break, but still a bug :-)
04/29/2011 (11:52 am)
@Michael. Thanks. Yes, the only way I got it to read the correct commonConfig.xml file was to delete the AppData folder. Note: just deleting the commonConfig.xml in the AppData folder won't do, since it keeps getting generated every time !Related to this, I found a small bug in the script code in that deals with this. In main.cs there are these 2 function calls
_defaultGameconfigurationData();
_loadGameConfigurationData( expandFileName("./commonConfig.xml") );and inside the function _loadGameConfigurationData there is, to deal with the case that no xml file was found
//we couldnt read the xml for some reason, _defaultGameConfiguration();
Now, this function does not exist. Probably it is meant to be _defaultGameconfigurationData().
The way I would do this would be
if ( _loadGameConfigurationData( expandFileName("./commonConfig.xml") ==false )
_defaultGameconfigurationData();Not a bug that causes anything to break, but still a bug :-)
Community Manager Michael Perry
ZombieShortbus
The one that shows up in "MyProjects<My_game>commoncommonConfig.xml" is due to a bug and can be deleted. When working on Windows, the engine will sometimes place settings in the AppData folder, which is an OS standard. If you delete everything but the projectFiles/common/commonConfig.xml, everything should work.
When it comes down to the final output, which is on an iOS device, it will only look for projectFiles/common/commonConfig.xml