User Tools

Site Tools


en:tutorials:changing_default_config_file_for_scroll

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

en:tutorials:changing_default_config_file_for_scroll [2017/12/19 01:53 (2 years ago)]
sausage created
en:tutorials:changing_default_config_file_for_scroll [2018/02/14 08:46 (2 years ago)]
Line 1: Line 1:
-====== Changing the default application configuration file for orx/Scroll ====== 
  
-The format for bootstrapping the starting config file is slightly different to a regular Orx application as [[tutorials:​changing_default_config_file|shown here]]. 
- 
-When an orx/Scroll game or application starts, the matching config data file is expected to reside in the same folder as the executable, and to have the same name as the executable. 
- 
-To change this, add a ''​Bootstrap''​ prototype to your Scroll header: 
- 
-<code cpp> 
-class MyGame : public Scroll<​MyGame>​ 
-{ 
-private: 
- virtual orxSTATUS Bootstrap() const; 
-        //Other function prototypes here 
- 
-}; 
-</​code>​ 
- 
-Note the use of ''​const''​ above. 
- 
-In your ''​Scroll''​ class, simply drop in the Bootstrap function: 
- 
-<code cpp> 
-orxSTATUS MyGame::​Bootstrap() const 
-{ 
- 
- // Add "​../​data/​config"​ to the list of locations that config files can be loaded from 
- orxResource_AddStorage(orxCONFIG_KZ_RESOURCE_GROUP,​ "​../​data/​config",​ orxFALSE); 
- 
- // Loads a specific config file  
- orxConfig_Load("​my-game-config.ini"​);​ 
- 
- return orxSTATUS_FAILURE;​ 
-} 
-</​code>​ 
- 
-Scroll will automatically pick up the ''​Bootstrap''​ function if it has been provided. 
- 
-<WRAP center round important 60%> 
-The return status is set to orxSTATUS_FAILURE. This effectively stops Orx from continuing to look for a default config, after the Bootstrap function has completed. If orxSTATUS_SUCCESS is returned, Orx will still try and load the default config located next to the executable 
-</​WRAP>​ 
- 
-Your Scroll application will now call its root .ini file from some other location relative to the .exe. 
en/tutorials/changing_default_config_file_for_scroll.txt ยท Last modified: 2018/02/14 08:46 (2 years ago) (external edit)