16 Animate::Animate(GL::Placeable &t, const GL::Animation &a, GL::AnimationPlayer &p):
22 void Animate::validate() const
25 throw logic_error("null target");
27 throw logic_error("null animation");
29 throw logic_error("null player");
32 void Animate::start(float, float d)
35 if(!anim->is_looping() && d)
36 speed = (anim->get_duration()/Time::sec)/d;
38 player->play_stacked(*target, *anim, speed);
40 player->play(*target, *anim, speed);
44 Animate::Loader::Loader(Animate &a, Demo &d):
45 DataFile::DerivedObjectLoader<Animate, Action::Loader>(a, d)
47 a.player = &demo.get_animation_player();
48 add("animation", &Loader::animation);
49 add("stacked", &Animate::stacked);
50 add("target", &Loader::target);
53 void Animate::Loader::animation(const string &n)
55 obj.anim = &demo.get_resources().get<GL::Animation>(n);
58 void Animate::Loader::target(const string &n)
60 obj.target = &demo.get_thing<GL::Placeable>(n);
63 } // namespace DemoScene