From: Mikko Rasa Date: Sat, 8 Jun 2019 15:53:50 +0000 (+0300) Subject: Add statement for easily offsetting a group of segments X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=589ab3169f3f09cc3ae8f9e12965fd59ffb70c76;p=libs%2Fdemoscene.git Add statement for easily offsetting a group of segments --- diff --git a/source/sequencer.cpp b/source/sequencer.cpp index 5aa0823..19c4041 100644 --- a/source/sequencer.cpp +++ b/source/sequencer.cpp @@ -1,6 +1,7 @@ #include #include #include +#include #include "animate.h" #include "fadeoverlay.h" #include "sequencer.h" @@ -140,13 +141,21 @@ void Sequencer::update_next_event() Sequencer::Loader::Loader(Sequencer &s, Demo &d): DataFile::ObjectLoader(s), - demo(d) + demo(d), + base_beat(0.0f) { + add("base", &Loader::base); add("define_action", &Loader::define_action); add("instant", &Loader::instant); add("segment", &Loader::segment); } +void Sequencer::Loader::base(float b) +{ + SetForScope set_base(base_beat, base_beat+b); + load_sub_with(*this); +} + void Sequencer::Loader::define_action(const string &n) { ActionDefLoader ldr(obj, demo); @@ -161,7 +170,7 @@ void Sequencer::Loader::instant(float beat) void Sequencer::Loader::segment(float start, float end) { - SegmentLoader ldr(obj, start, end, demo); + SegmentLoader ldr(obj, base_beat+start, base_beat+end, demo); load_sub_with(ldr); } diff --git a/source/sequencer.h b/source/sequencer.h index 6e98402..1cd1ebc 100644 --- a/source/sequencer.h +++ b/source/sequencer.h @@ -22,11 +22,13 @@ public: { private: Demo &demo; + float base_beat; public: Loader(Sequencer &, Demo &); private: + void base(float); void define_action(const std::string &); void instant(float); void segment(float, float);