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;
40 player->play_stacked(*target_obj, *anim, speed);
42 player->play(*target_obj, *anim, speed);
47 player->play_stacked(*target, *anim, speed);
49 player->play(*target, *anim, speed);
54 Animate::Loader::Loader(Animate &a, Demo &d):
55 DataFile::DerivedObjectLoader<Animate, Action::Loader>(a, d)
57 a.player = &demo.get_animation_player();
58 add("animation", &Loader::animation);
59 add("stacked", &Animate::stacked);
60 add("target", &Loader::target);
63 void Animate::Loader::animation(const string &n)
65 obj.anim = &demo.get_resources().get<GL::Animation>(n);
68 void Animate::Loader::target(const string &n)
70 obj.target = &demo.get_thing<GL::Placeable>(n);
71 obj.target_obj = dynamic_cast<GL::AnimatedObject *>(obj.target);
74 } // namespace DemoScene