Original Post
I am trying to design an input handler for SDL, the biggest problem with just checking for a keydown event is that once I do something else while still holding down the key it will no longer register as a keydown.
So I am trying to make a generic handler that I can register a function to a key using a map of SDLKey and a function pointer. Now this becomes the issue. I am trying to use boost and the functions that I will be binding will be member functions (such as for moving a camera or even rotating it).
Now I am not sure how to do this since to create the map I believe I need to know the arguments for the function pointer.
I want to be able to have a function in the input handler that just takes a pointer to whatever object that will have its member function called and then the function that will be called.
Now I was wondering if anyone could help me figure out how to do this, I have used boost before but only for threads and random numbers (generating fractals).
So I am trying to make a generic handler that I can register a function to a key using a map of SDLKey and a function pointer. Now this becomes the issue. I am trying to use boost and the functions that I will be binding will be member functions (such as for moving a camera or even rotating it).
Now I am not sure how to do this since to create the map I believe I need to know the arguments for the function pointer.
map<SDLKey, void(*)(<pointer to class that I am registering>, otherArgument(probably eventually boost::any) > I want to be able to have a function in the input handler that just takes a pointer to whatever object that will have its member function called and then the function that will be called.
class foo
{
public:
void MoveForward(float mag){...}
};
foo a;
keyHandler.bind(SDL_w, &foo::MoveForward, &a, <pointer to what data is sent>);
Now I was wondering if anyone could help me figure out how to do this, I have used boost before but only for threads and random numbers (generating fractals).