EZ
Up Prev Next Contents


4.2 Timer Events

There are two lists of timers in the EZwgl, a list of repeating timers and a list of one-time timers. The second list is an ordered list sorted according to the timeouts while the first one is not sorted.

EZ_Timer *EZ_CreateTimer(long sec, long usec,

int repetition, EZ_CallBack callback

void *pdata, int idata)

This function creates a timer and returns the allocated timer data structure. If repetition is 0, the timer created is put in the one-time timer list and will be fired exactly once if at all. If repetition is nonzero, the timer is inserted into the repeating timer list and it will be fired exactly repetition times or indefinitely depending on whether repetition is positive or not.

EZ_Timer *EZ_ResetTimer(EZ_Timer *timer,

long sec, long usec,

int repetition, EZ_CallBack callback

void *pdata, int idata)

If timer is a valid timer, this function reset the parameters for timer and returns timer. Otherwise, it calls EZ_CreateTimer to create a timer and returns the result.

EZ_Timer *EZ_CancelTimer(EZ_Timer *timer)

This function cancels the specified timer.

EZ_Timer *EZ_RestartTimer(EZ_Timer *timer)

This function alters the state of timer. It resets the starting time of timer to the current time.

EZ_Timer *EZ_SetTimerPtrData(EZ_Timer *timer, void *data)

This function sets the pointer data stored in timer's data structure.

EZ_Timer *EZ_SetTimerIntData(EZ_Timer *timer, int idata)

This function sets the integer data stored in timer's data structure.

EZ_Timer *EZ_SetTimerClientData(EZ_Timer *timer,

void *pdata, int idata)

This function fills the two client data slots in the timer data structure. The effect is the same as calling the two previous functions with the appropiate parameters.

EZ_Timer *EZ_SetTimerCallBack(EZ_Timer *timer,

EZ_CallBack callback, void *data)

This function sets the call back for timer.

EZ_Timer *EZ_GetTimerState(EZ_Timer *timer,

long *sec, long *usec, int *repetition)

This function returns the current state of timer.

The next three function returns client data registered to a timer.

EZ_Timer *EZ_GetTimerPtrData(EZ_Timer *timer,void **dat)

EZ_Timer *EZ_GetTimerIntData(EZ_Timer *timer, int *dat)

EZ_Timer *EZ_GetTimerClientData(EZ_Timer *timer,

void **pdata_ret, int * idata_ret)


HTML Documentation Maintainance:Arturo Espinosa <arturo@nuclecu.unam.mx>