config problems

edited May 2012 in Help request
hi, all.

I'm new to orx. I have a problem with the config system.
can orx reload when a config value changed at runtime?

I mean: after orx launched, I call orxConfig_LOAD(anotherfile) to override the default config values, such as Display::ScreenWidth, then orx will get it functional immediately (set new window width Automatically). Here screenwidth just for an example, it may be any key-value pairs.

sorry for my poor english, I'd try to explain it more clearly.

Comments

  • edited May 2012
    Hi bluesky and welcome here!

    So all the config values will be updated when you load another file (or change them with orxConfig_Set*). If you want them to be applied to whatever you're doing, it's on a per case basis.

    For the display mode, config values won't get re-reread beside the title. If you want to change the display mode, you'll have to use the orxDisplay_SetVideoMode() function (and the ones associated).

    Now if you change an attribute of an orxOBJECT, like its color, the next object you will create will have the new color, but not the objects that already exist.

    In your own code if you have:
    void Init()
    {
      // ...
      MyVar = orxConfig_GetS32("MyVar");
      // ...
    }
    
    void Run()
    {
      // ...
      orxLOG("MyVar: %ld", MyVar);
      orxLOG("MyRTVar: %ld", orxConfig_GetS32("MyVar"));
      // ...
    }
    

    The first log will always have the same value even if you change the content of the config for MyVar whereas the second one will always print the latest value.

    Does it answer your question?
  • edited May 2012
    thanks iarwain. I know that it's a lots of work to listen each value of the config. It would be great if orx will support this feature.
  • edited May 2012
    I was thinking of something like that for a long time, mostly for existing objects/structures that would handle config changes but it's not a small change and never found the time to do that so far.
Sign In or Register to comment.