Skip to main content
gamedev.net
🔒 Locked

Tracking Input Question

Started by NickGravelyn 3 replies 450+ views
Original Post
NickGravelyn
NickGravelyn
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?
Drew_Benton
Drew_Benton
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!
NickGravelyn
NickGravelyn
Sweet. That is remarkable. That is exactly what I was looking for. Thanks.
Drew_Benton
Drew_Benton
No problem, I'm working on an updated version (need to take a break anyways), so check back later this weekend!
Drew_Benton
Drew_Benton
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.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.