Welcome to the new platform of Programmers Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use it's exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
OK, I've got my 3D game runnign great, but you have to configure it each time you play, yech! I would like to store key configurations and such in ".ini" file format, but I don't know how to read that format. Here's a basic example of what I'd like to do:
//My Config File
FORWARD = VK_UP
BACKWARD = VK_DOWN
TURN_LEFT = VK_LEFT
TURN_RIGHT = VK_RIGHT
JUMP = 'A'
The reason I'd need to do this is because of the way I detect keyboard input. It is basically like this:
bool keys = FALSE;
//In The Callback...
keys[wParam] = TRUE;
keys[wParam] = FALSE;
//In The Main Loop...
Now, how would I properly read and write the ".ini" file format so that if a user adds or moves a line it will still read in properly? Like if I moved FORWARD = blah to the last line, I'd need it to read it in properly anyway. I was also thinking of using defines to read in the keys, something like this:
//My Config Reading Routine (Not Written)
Would that be a decent way to save memory since it wouldn't be creating a whole new slew of variables?
I posted here since the ".ini" format is a part of the Windoze OS, and I thought I could get the best help here. If this belongs elsewhere let me know. As always, thanks for the help.