Using custom config with ApplicationContext?

Problems building or running the engine, queries about how to use features etc.
Post Reply
mrgrumpy
Gnoblar
Posts: 1
Joined: Wed Aug 14, 2019 1:56 pm

Using custom config with ApplicationContext?

Post by mrgrumpy » Wed Aug 14, 2019 2:14 pm

I'm currently updating an old project to 1.12, and love the new simplified structure using ApplicationContext. However, my previous project was using a custom config file, replacing resources.cfg and ogre.cfg. This was implemented at runtime by creating a new root with no file paths, and setting the config options on the render system and adding resource locations to the resource group manager manually.

I'm afraid I'm a little lost on how something like this should be achieved using the ApplicationContext, and I feel like I'm missing something. I realise it's not possible to create a new root after calling:

Code: Select all

OgreBites::ApplicationContext::setup();
I've been exploring the reconfigure function, but can't find any way to prevent it from trying to use the usual .cfg files.

After spending the day on this, I thought it's time to ask for help - apologies if I'm missing something obvious.

Thanks in advance!

Ogre Version: :1.12:
Operating System: :Ubuntu:
Render System: :GL:
0 x

paroj
OGRE Team Member
OGRE Team Member
Posts: 878
Joined: Sun Mar 30, 2014 2:51 pm
x 177
Contact:

Re: Using custom config with ApplicationContext?

Post by paroj » Thu Aug 15, 2019 11:10 am

To achieve what you want, you should overload

- ApplicationContextBase::createRoot
- ApplicationContextBase::oneTimeConfig
- ApplicationContextBase::locateResources

take a look at ApplicationContextBase::initApp and ApplicationContextBase::setup to see the order in which these functions are called.
0 x

Post Reply