Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
modify options interface
07-18-2007, 02:56 PM,
mpo Wrote:I have added a button "Helmet" in the "Control Options" menù, then i have created a new menù called "Helmet Options" where i have put the options of the helmet. Now i have question about the recovery of the option selected in the menù:

I have seen that (tell me if wrong):
1)the options inserted are stored in the file VDrift.config
2)"settings.cpp" stores and recovers the settings from the file (VDrift.config)
3) settings.Get and settings.Set are used to recovery specific data
4)"game.cpp", between the other things, use settings.cpp to load the settings of the game.
5)Every widget has a method called "Save" that save the settings of that widget in the file VDrift.config (using Settings).
6) in "gui.cpp", the methd "Process Action" seem to be the method that is called when an option is modified, i have tried to put there the functions to set the parameters but it doesn't work.

I don't understand who, where and with which method, take the info from the menù and call (i suppose) "Settings" to store the info in VDrift.config
I need it because when these info are stored i have to use them to modify immediately the state of the helmet (one of the info is "connect/disconnect the helmet").

Sounds right. ProcessAction is a sort of special function. An action is usually something like "Start Game" or "MenuName" and process action will do the special function needed like start the game, or change menus to MenuName. You need to set up an if statement in ProcessAction to catch your action "ConnectHelmet" or whatever...but you do not want to put much code in there. You might want to write another class called helmet.cpp, in there you might have a function helmet.connect, that does all the real work. ProcessAction is just the point where this will be called.

As for getting/setting data values this should probably be in VAMOSWORLD::UpdateSettings (or the UpdateSettings function in whichever class you need to get the data from). Make sure you put local variables in that class and save the settings there. Otherwise you will end up with settings.Get being called a ton of times, and that's pretty slow.

I'm not sure why your stuff in ProcessAction isn't working, try adding some printouts using cout to make sure things are working like you're expecting them to.

Messages In This Thread
modify options interface - by mpo - 07-16-2007, 03:48 PM
[No subject] - by thelusiv - 07-16-2007, 04:04 PM
[No subject] - by mpo - 07-16-2007, 05:30 PM
[No subject] - by rookie1 - 07-17-2007, 07:17 AM
[No subject] - by mpo - 07-18-2007, 01:59 PM
[No subject] - by thelusiv - 07-18-2007, 02:56 PM
[No subject] - by mpo - 07-18-2007, 03:36 PM
[No subject] - by thelusiv - 07-18-2007, 03:42 PM

Forum Jump:

Users browsing this thread: 1 Guest(s)