Jump to content
  • Advertisement
Sign in to follow this  

Tracking Input Question

This topic is 4434 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

What is considered an efficient and easy to use method of tracking keyboard and mouse input? I'm using SDL and currently use a long list of bool values to find out what key/mouse button is pressed. The problem with this method is that I have to call extern bool for every key I want to use in that file. I'd like to replace this messy method with a simple function, but can't figure out how to save and recall the information. I could use an array, but the indices themselves would get hard to keep track of. My ideal end result would be something as easy as: bool IsDown('a'); or bool IsDown(MOUSE_LEFT); Any ideas?

Share this post


Link to post
Share on other sites
Advertisement
I have written a SDL Input class a while back that might just be what you are after. I should say that it is a lot of code, but once you get used to it, it should be everything that you need, input wise. You can take a look at the code and demo here on this thread. The demo example is commented to give you an idea of what you can do so take a look at that too.

If you have any questions on it, feel free to ask! I have not had time to write up a full page of documentation and usage, but that is still on my todo list. If I get it done this weekend, I'll post again. I'm sure I have a more recent version, but gotta find that. Good luck!

Share this post


Link to post
Share on other sites
Ok guys, I've made a big page of the new code and tutorials for using cInput. I'm still working on it, but for now, that should be almost everything you need to know to use the library. Right now it's a Word->HTML page, so a few things are kinda messy and some links don't forward correctly. I'll be fixing that soon too.

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!