Archived

This topic is now archived and is closed to further replies.

Naaga

Customizing Controls

Recommended Posts

My game project is at a very early stage of development. I want to get the control customizing part done now, so I don''t accidentally hardcode something like that somewhere. I figure I can just use a .ini file to describe the keys that map to different controls, and I can still use the same file when I get the actual in-game menu up and running. I could get it to work without a problem using one of a couple different methods. I just don''t know which would be better. Method 1: Describe the controls as text in the file. This makes it much easier to edit the file by hand. The problem is that I''d need a huge if-else block in my loading function to handle the text. That''s not fun to code; the function doesn''t look very good; the code is harder to maintain. Method 2: Use numbers in the file. I can store the keys by their DIK_ (Direct Input) value. The loading function is much better this way, but hand-editing the file becomes a pain. Please share your opinions on this issue with me.

Share this post


Link to post
Share on other sites
I would choose method #2.

I would provide a set of default keys in DIK_ values within the .ini and then allow remaping of keys within the game or program.

This will allow you to edit the .ini and not force the user to do the same.

Share this post


Link to post
Share on other sites