24 return std::get<0>(a) < std::get<0>(b);
35 auto lower_bound = cues.lower_bound({position,
nullptr});
36 auto upper_bound = cues.upper_bound({position + dt,
nullptr});
38 for (
auto iterator = lower_bound; iterator != upper_bound; ++iterator)
40 std::get<1>(*iterator)();
43 if (autoremove && lower_bound != upper_bound)
45 cues.erase(lower_bound, upper_bound);
68 auto lower_bound = cues.lower_bound({start,
nullptr});
69 auto upper_bound = cues.upper_bound({end,
nullptr});
70 cues.erase(lower_bound, upper_bound);
103 auto lower_bound = cues.lower_bound({start,
nullptr});
104 auto upper_bound = cues.upper_bound({end,
nullptr});
105 for (
auto iterator = lower_bound; iterator != upper_bound; ++iterator)
107 s.push_back(*iterator);
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.
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.
@ position
Vertex position (vec3)