I have a keyboard class registered as a singleton in my game engine, so my scripts can access key state. The interface looks like this:
if (keyboard.space)
{
doStuff();
}
The keys (in this case 'space') are implemented as property accessors that return a bool.
I'd like to be able to do something like this:
bind(@keyboard.space, @doStuff);
In this case, a pointer to the accessor would be stored along with a pointer to another function. The first function would be called continually, and if it returns true the second function would be called. I understand I could get the function object by declaration and set the calling object in the application, but I'd like to be able to do this with function and funcdefs.
So I'm wondering two things, actually:
- Are pointers to member functions possible currently, or might they be in a future version?
- If they are possible, would pointers to accessors need to be declared in long-form (@obj.get_prop), or would the short-form work as well (@obj.prop)?