[add] Added length property to sjplayer.Context.

This commit is contained in:
falsycat 2019-10-14 00:00:00 +00:00
parent 021bd8eca5
commit 3dbd498b8f

View File

@ -61,6 +61,11 @@ class Context {
Create(params.filter!(x => x.name == factory[0]), builder); Create(params.filter!(x => x.name == factory[0]), builder);
} }
length_ = 0;
foreach (ref param; params) {
length_ = length_.max(param.period.end);
}
elements_ = builder.elements[]; elements_ = builder.elements[];
drawers_ = builder.drawers[]; drawers_ = builder.drawers[];
controllers_ = builder.controllers[]; controllers_ = builder.controllers[];
@ -126,6 +131,10 @@ class Context {
@property inout(PostEffectControllerInterface) posteffect() inout { @property inout(PostEffectControllerInterface) posteffect() inout {
return posteffect_controller_; return posteffect_controller_;
} }
///
@property float length() const {
return length_;
}
private: private:
class Builder : ContextBuilderInterface { class Builder : ContextBuilderInterface {
@ -154,4 +163,6 @@ class Context {
ActorControllerInterface actor_controller_; ActorControllerInterface actor_controller_;
PostEffectControllerInterface posteffect_controller_; PostEffectControllerInterface posteffect_controller_;
float length_;
} }