Jump to content
  • Advertisement
Sign in to follow this  
fuerchter

Custom keybinds/name input?

This topic is 2168 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi there
I've googled this topic for a bit but didn't come up with a good solution yet so I thought I might bring this up here:
Is there a way to write custom keybinds for an options menu (e.g. there is an entry for "Up" in the game and you can then rebind it for whatever key you like: w, t, up, enter etc...). I guess the menu has to check every single key for whether it was pressed during the rebind? (also I'd like to then save each individual bind to a config file but I'm going to read up on how to do that myself ;) ).

The same basically goes for entering a name, right? I mean, it also has to check every key and write the associated letter :S

I've seen people do that by writing out every Key, but I guess thats no graceful solution?
greetings

//EDIT:
Sorry for posting this ^^ I didn't know there was already a thread on this here -.- Edited by fuerchter

Share this post


Link to post
Share on other sites
Advertisement
The key is to define a list of actions that is needed by your game: up, down, left, right, jump, fire, etc.. and store on these actions the key selected:

Keys up, down, left, right, jump, fire;


Now when you enter your option menu to configure "jump" action (for example) you need to listen for keyboard pressed keys and, when is pressed only one key, you can store jump binding like this:

jump = Keyboard.GetState().GetPressedKeys()[0];


You need to take care to wait the release of the key used in the option menu to enter the "key selection mode" (if you use Enter you need to wait for Enter release to avoid to bind jump to enter key).

This link can help you (but I don't know your programming level):
http://joecrossdevel...yout-and-goals/

Check also this link, is usefull for GamePad/Mouse/Keyboard input design:
http://classes.soe.u...board-input.pdf

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!