true t"> Need help with torqueSettings.xml | Torque X 2D | Forums | Community | GarageGames.com

Game Development Community

Need help with torqueSettings.xml

by Aivan Monceller · in Torque X 2D · 10/19/2008 (1:47 am) · 5 replies

Where is torqueSettings.xml loaded. The txscene is loaded in Game.cs file but where is the settings loaded.

<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<TorqueEngineSettings>
	<SimulateFences>true</SimulateFences>
	<UseFixedTimeStep>true</UseFixedTimeStep>
	<EnableAudio>false</EnableAudio>
	<GraphicsClearSettings>
		<ClearColor valueOf="Microsoft.Xna.Framework.Graphics.Color.Black"/>
	</GraphicsClearSettings>
	<WindowsGraphicsManagerSettings>
		<PreferMultiSampling>false</PreferMultiSampling>
		<PreferredBackBufferHeight>768</PreferredBackBufferHeight>
		<PreferredBackBufferWidth>1024</PreferredBackBufferWidth>
	</WindowsGraphicsManagerSettings>
	<XboxGraphicsManagerSettings>
		<PreferMultiSampling>false</PreferMultiSampling>
		<UseDisplaySizeForBackbuffer>true</UseDisplaySizeForBackbuffer>
	</XboxGraphicsManagerSettings>
</TorqueEngineSettings>

#1
10/19/2008 (8:24 am)
TorqueSettings.xml is loaded in TorqueEngineComponent.

I'm assuming you want to get rid of it.

In your Game.cs,

add

protected override void SetupEngineComponent()
{
    // load settings
    //TorqueConsole.Echo("Loading settings file...");
    //Engine.LoadSettings("torqueSettings.xml");
}

To change settings in code, in Game.cs, use
Engine.Settings.WindowsGraphicsManagerSettings.IsFullScreen = true; //or whatever
These changes should be made before the TorqueEngineComponent is initialized.
#2
10/19/2008 (9:09 am)
Thank you. So, I need a function override. Got that mate, not new in programming but new in torque thanks for the help you saved me lots of time.
#3
10/20/2008 (3:17 am)
Btw, can't get it to full screen I was expecting the window would run on fullscreen with the code
Engine.Settings.WindowsGraphicsManagerSettings.IsFullScreen = true;

Where should I place the function exactly (sorry). Because, everytime I press F6(Build Solution) the game window pops out even without running debug. (This happens when I place the code you've given).
I placed it on top of BeginRun().
#4
10/20/2008 (4:35 am)
Ok, I've tracked down the problem.
In theory, the above should have worked but tracing through the code I found that the engine settings are copied to the GraphicsManager in LoadSettings. Since we are bypassing LoadSettings, we also bypass copying the settings to the graphics manager.

Unfortunately, the copy code is in LoadSettings and not called as a separate method so we could call it ourselves. I guess the designers never really thought about bypassing LoadSettings.

All is not lost however as we can manually copy the settings ourselves.
The following works (note, besides IsFullScreen, you should also set whatever other settings you want in a similar way):
protected override void SetupEngineComponent()
{
    // load settings    
    //TorqueConsole.Echo("Loading settings file...");    
    //Engine.LoadSettings("torqueSettings.xml");
 
    //manually set engine settiings here
    Engine.Settings.WindowsGraphicsManagerSettings.IsFullScreen = true;
 
    //manually copy settings to graphics manager here
    //Note: if you have the engine source code, you can refactor LoadSettings to
    //extract the copy code as a separate method that you could call here instead.
    GraphicsDeviceManager.IsFullScreen = true;
}
#5
10/20/2008 (8:38 pm)
A big thanks.