(Noob alert; i'm assuming i understand how OIS works well enough. I prolly have no idea what i'm talking about half of the time.)
One modification to OIS i'm thinking of coding is making the buffered callbacks (like mouseMoved and keyPressed) boost::function pointers instead of plain virtual functions, and making a RegisterCallback function which will boost::bind them.
Just a fancier way of interfacing OIS to client code. For example, I dont want my "InputListener" class (which inherits from OIS input listeners) to execute code as a result of input events, such as calling mouseMoved or keyPressed. Rather, I'd want my OIS listeners to pass the signal on to client code through function pointers
So i was just
1) Sharing thoughts. comments?
2) Suggestion to edit main OIS source code? just wondering if this kind of interfacing makes sense in general.
3) If i'll change my OIS code as described, is there anything else in OIS i should be aware of which may conflict with or depend on etc the things i'll be modifying? As of now, looks like i'll just be removing the virtual functions from the class declarations, add boost::functions named exactly like those functions, and add (non-virtual) RegisterCallback functions which do no more than assign the bound function. Something like this;
// in MouseListener class i'll replace the virtual functions with these
boost::function<void (const OIS::MouseEvent &)> mouseMoved;
boost::function<void (const OIS::MouseEvent &evt, OIS::MouseButtonID btn)> mousePressed;
boost::function<void (const OIS::MouseEvent &evt, OIS::MouseButtonID btn)> mouseReleased;
// in Mouse class i'll replace setEventCallback with
void registerCallback(const boost::function<void(const OIS::MouseEvent &)> & boundFunction);
void registerCallback(const boost::function<void(const OIS::MouseEvent &evt, OIS::MouseButtonID btn)> & boundFunction);
void registerCallback(const boost::function<void(const OIS::MouseEvent &evt, OIS::MouseButtonID btn)> & boundFunction);
// all they do is "mouseMoved = boundFunction;" (moved/pressed/released respectively)
// Users of OIS will implement mouseMoved / mousePressed / mouseReleased functions in their own client code, such as
void MyClass::MyFunctionLol(const OIS::MouseEvent & evt)
{
}
// then register callback insted of seteventcallback
p_Mouse->registerCallback(boost::bind(&MyClass::MyFunctionLol, this, _1));
*ducks*