20 #ifndef ANTKEEPER_TIMELINE_HPP
21 #define ANTKEEPER_TIMELINE_HPP
34 typedef std::tuple<float, std::function<void()>>
cue;
121 std::multiset<
cue, std::function<bool(
const cue&,
const cue&)>> cues;
Timeline which executes cues (scheduled functions) when advanced over their respective positions in t...
void add_cue(const cue &c)
Adds a cue to the timeline.
void seek(float t)
Sets the timeline position to t.
timeline()
Creates a timeline.
void remove_cue(const cue &c)
Removes a cue from the timeline.
void remove_sequence(const sequence &s)
Removes a sequence of cues from the timeline.
sequence get_cues(float start, float end) const
Returns all the cues on [start, end).
void advance(float dt)
Advances the timeline position (t) by dt, triggering any cues scheduled between t and dt.
std::list< cue > sequence
List of cues.
float get_position() const
Returns the current position in time on the timeline.
void set_autoremove(bool enabled)
If enabled, cues will be automatically removed from the timeline when they are triggered.
void clear()
Removes all cues from the timeline.
void remove_cues(float start, float end)
Removes all cues on [start, end).
std::tuple< float, std::function< void()> > cue
Scheduled function consisting of a time and function object.
void add_sequence(const sequence &s)
Adds a sequence of cues to the timeline.