Welcome Guest [Log In] [Register]
Viewing Single Post From: Epee Engine Events
Alan
Administrator
[ *  *  * ]
ANIMATION_EVENT

An animation frame even has occurred
frame events can be set by calling SetFrameEvent(int _frame)

only one frame can be set to be thrown at a time.
After the event is thrown you will have to reset the event frame by calling SetFrameEvent, if you want another event to be thrown when that frame is displayed again.
The frame event is cleared after the event is thrown

sdl event structure when an animation event is posted

event.type: SDL_USEREVENT
event.user.code: ANIMATION_EVENT
event.user.data1: pointer to the instance of the animation object that posted the event;
event.user.data2 = Not used


to find out what frame caused the event call GetFrameEvent or GetCurrentFrame

example:
SDL_Event event;
int eventFrame=0
//poll for events using event
//if event is SDL_USEREVENT and code is ANIMATION_EVENT

eventFrame=((*Animation)event.user.data1).GetFrameEvent()
or
eventFrame = ((*Animation)event.user.data1).GetCurrentFrame()
Offline Profile Quote Post
Epee Engine Events · Documentation