Cleaned the timeline code up nicely.
This commit is contained in:
@ -72,6 +72,7 @@ bool timelineIsFinished(timeline_t *timeline) {
|
||||
timelineaction_t * timelineAddAction(timeline_t *timeline, float start,
|
||||
float duration
|
||||
) {
|
||||
if(timeline->actionCount == TIMELINE_ACTION_COUNT_MAX) return NULL;
|
||||
timelineaction_t *action = timeline->actions + (timeline->actionCount++);
|
||||
action->start = start, action->duration = duration;
|
||||
action->onStart = action->onEnd = action->onDuration = NULL;
|
||||
|
@ -6,10 +6,38 @@
|
||||
#pragma once
|
||||
#include <dawn/dawn.h>
|
||||
|
||||
/**
|
||||
* Initializes a timeline back to its default state.
|
||||
*
|
||||
* @param timeline Timeline to initialize.
|
||||
*/
|
||||
void timelineInit(timeline_t *timeline);
|
||||
|
||||
/**
|
||||
* Ticks the timeline. This can be done using any delta.
|
||||
*
|
||||
* @param timeline Timeline to tick
|
||||
* @param delta Delta to tick.
|
||||
*/
|
||||
void timelineUpdate(timeline_t *timeline, float delta);
|
||||
|
||||
/**
|
||||
* Returns true if every action in the timeline has finished.
|
||||
*
|
||||
* @param timeline Timeline to check
|
||||
* @return True if finished, otherwise false.
|
||||
*/
|
||||
bool timelineIsFinished(timeline_t *timeline);
|
||||
|
||||
/**
|
||||
* Adds an action to the timeline. This will initialize the action callbacks to
|
||||
* NULL, you will need to initialize your own callbacks.
|
||||
*
|
||||
* @param timeline Timeline to add to.
|
||||
* @param start Start time.
|
||||
* @param duration Duration time
|
||||
* @return Pointer to the timeline action or NULL if the list is full.
|
||||
*/
|
||||
timelineaction_t * timelineAddAction(timeline_t *timeline, float start,
|
||||
float duration
|
||||
);
|
Reference in New Issue
Block a user