Skip to main content
gamedev.net
🔒 Locked

Userinput mapping?

Started by Gonzzor Dec 28, 2002 at 4:38 PM 0 replies 150+ views
Original Post
Gonzzor
Gonzzor
Hi... In a game I trying to create in C(++), I have spotted a little problem... Thaught I build a class that will handle all the userinput stuff, such as checking keyboard presses, and if pressed call a function. So I made myself a UserInput class that does this thing, it works great with functions that are global but when I was gonna call functions from an Instance of another class (Wich got its life about the same time the userinput class), it didn''t work. But then i realized that the instance of UserInput doesn''t know where that instance is, so I passed that information with the rest... Kind of worked but not exactly as I wanted, now I need a new instance of UserInput for every class that has a function that will be called when a user presses a key. That is kind of annoying because I lost the whole idea of having an Instance of a class to do all the work... So the question I have, Is there any way to make the Userinput without using some instance (I still need one, I know) of it or overload of functions, wich right now looks like the best way to solve the problem? The second question is this: Is this a good way of handling the userinput or is there any other ways? Hope you got the point of my problem and that someone has a idea of solving the problem... If you don''''t want to learn anything you are in really bad trouble...
If you don't want to learn anything you are in really bad trouble...

Topic Locked

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

Sign in to reply to this topic.