timeline: add new functions: TM_IsEmpty, TM_IsBackgroundEmpty, TM_SkipDelay

This commit is contained in:
Sebastian Krzyszkowiak 2016-09-04 03:06:26 +02:00
parent 26843776a2
commit 8bebe6c5e2
2 changed files with 21 additions and 0 deletions

View file

@ -341,6 +341,21 @@ SYMBOL_EXPORT void TM_CleanBackgroundQueue(struct Timeline* timeline) {
timeline->background = NULL;
}
SYMBOL_EXPORT void TM_SkipDelay(struct Timeline* timeline) {
if (timeline->queue && timeline->queue->timer) {
al_stop_timer(timeline->queue->timer);
al_set_timer_speed(timeline->queue->timer, 0.01);
al_start_timer(timeline->queue->timer);
}
}
SYMBOL_EXPORT bool TM_IsEmpty(struct Timeline* timeline) {
return !timeline->queue;
}
SYMBOL_EXPORT bool TM_IsBackgroundEmpty(struct Timeline* timeline) {
return !timeline->background;
}
SYMBOL_EXPORT void TM_Destroy(struct Timeline* timeline) {
TM_CleanQueue(timeline);
TM_CleanBackgroundQueue(timeline);

View file

@ -96,5 +96,11 @@ struct TM_Arguments* TM_AddToArgs(struct TM_Arguments* args, int num, ...);
void* TM_GetArg(struct TM_Arguments *args, int num);
/*! \brief Destroy TM_Arguments queue. */
void TM_DestroyArgs(struct TM_Arguments* args);
/*! \brief Skip delay if it's currently the first action in the queue */
void TM_SkipDelay(struct Timeline*);
/*! \brief Checks if the main queue is empty */
bool TM_IsEmpty(struct Timeline* timeline);
/*! \brief Checks if the background queue is empty */
bool TM_IsBackgroundEmpty(struct Timeline* timeline);
#endif