Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
modify options interface
07-16-2007, 03:48 PM,
#1
modify options interface
I have interfaced Vdrift with an helmet for the virtual reality, but now i need to implement an interface to set some parameters (set visuality, sensibility..).
I have watched the code, but i have some difficulties in understanding which files i have to modify to, for example, insert into the options/controls interface, a button called "helmet", that it sends me in an other window where i can set these parameters of the helmet.
Another solution could be use a predefined combination of keyboard buttons that set the parameters.
Any idea or observation is good for me..

thanks.
Reply
07-16-2007, 04:04 PM,
#2
 
To learn about adding options to VDrift first read these:
http://wiki.vdrift.net/Options.config
http://wiki.vdrift.net/Menu_system

As for the part of the code you need to change to get these options working, I'm not sure as I don't know what you mean by visuality and sensibility. Could you explain a little further?
Reply
07-16-2007, 05:30 PM,
#3
 
Thanks a lot for the info, for sensibility i mean the velocity of the movement, how fast is the rotation when you turn the head (like the mouse option in the so); other parameter could be a default position settable from the user. I have to see with my teacher, what he want to do..

thanks still for your support!! Big Grin
Reply
07-17-2007, 07:17 AM,
#4
 
I guess you will need to program your 'virtual helmet' input to control the orientation of the in game camera. The in game camera update code is inside function VAMOSWORLD::Update(), in src/vamosworld.cpp, line 750.
Reply
07-18-2007, 01:59 PM,
#5
 
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").
Reply
07-18-2007, 02:56 PM,
#6
 
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.
Reply
07-18-2007, 03:36 PM,
#7
 
Just another question, i don't understand where i have to pu the call to ProcessAction; i have tried to modify the field "action" in the button "ok" of the menù (menù of the helmet), there i have set "Connect Helmet" instead of the name of the previous menù, but it don't work.
To be more clear: in the file that contains the structure of the helmet menù, there's a button "ok", in the option "action" of it i have put "Connect Helmet" instead of the name of the previous menù, but it don't works. What i have miisunderstood?
Reply
07-18-2007, 03:42 PM,
#8
 
Well did you set up an if clause in the ProcessAction function thus?
Code:
else if( action == "ConnectHelmet" ) { /* helmet connection code */ }
Try adding one of those with something simple like
Code:
cout << "Connect Helmet action found" << endl;
so that you can see if it's working. I think the variable is called action, not looking at the code right now...

Also please make your action name (set in the button "action" setting as you describe) a single word in CamelCase as all the others are done. This is just a style thing...I'm pretty sure it should work either way.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)