15 Animate::Animate(GL::Placeable &t, const GL::Animation &a, GL::AnimationPlayer &p):
21 void Animate::validate() const
24 throw logic_error("null target");
26 throw logic_error("null animation");
28 throw logic_error("null player");
31 void Animate::start(float, float d)
34 if(!anim->is_looping() && d)
35 speed = (anim->get_duration()/Time::sec)/d;
36 player->play(*target, *anim, speed);
40 Animate::Loader::Loader(Animate &a, Demo &d):
41 DataFile::DerivedObjectLoader<Animate, Action::Loader>(a, d)
43 a.player = &demo.get_animation_player();
44 add("animation", &Loader::animation);
45 add("target", &Loader::target);
48 void Animate::Loader::animation(const string &n)
50 obj.anim = &demo.get_resources().get<GL::Animation>(n);
53 void Animate::Loader::target(const string &n)
55 obj.target = &demo.get_thing<GL::Placeable>(n);
58 } // namespace DemoScene