I used Spine-c and wrote my own C++ rendering engine on top of it. My question is, what is the best practice for getting the spine event callbacks back to the interested object? Basically I have a situation like:
class Entity
{
Entity();
void start_spine_animation();
void spine_event_callback(spAnimationState* state, spEventType type, spTrackEntry* entry, spEvent* event);
};
I want to call myEntity.start_spine_animation() then get control back to the spine_event_callback() when the event fires. However, the event callback is a function pointer which would not be appropriate for an object's member function.
Should I modify Spine-c so that the event callback operates on a pointer to an abstract class that implements the callback function (which would be a common C++ or obj-c way to do it), or handle the control a different way using the original "global" version of the callback function pointer?