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)
33 float speed = (d ? (anim->get_duration()/Time::sec)/d : 1.0f);
34 player->play(*target, *anim, speed);
38 Animate::Loader::Loader(Animate &a, Demo &d):
39 DataFile::DerivedObjectLoader<Animate, Action::Loader>(a, d)
41 a.player = &demo.get_animation_player();
42 add("animation", &Loader::animation);
43 add("target", &Loader::target);
46 void Animate::Loader::animation(const string &n)
48 obj.anim = &demo.get_resources().get<GL::Animation>(n);
51 void Animate::Loader::target(const string &n)
53 obj.target = &demo.get_thing<GL::Placeable>(n);
56 } // namespace DemoScene