Tinman  1.0
animation.h
Go to the documentation of this file.
1 // Copyright (C) 2014 ISAAC LACOBA MOLINA
2 // Tinman author: Isaac Lacoba Molina
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
16 
17 #ifndef ANIMATION_H
18 #define ANIMATION_H
19 #include <memory>
20 #include <OgreAnimationState.h>
21 #include <OgreEntity.h>
22 #include <map>
23 #include <algorithm>
24 
25 class Animation {
26 public:
27  typedef std::shared_ptr<Animation> shared;
28  typedef std::function<void()> Callback;
29 
30  Animation();
31  ~Animation();
32 
33  void activate(Ogre::Entity* entity, std::string animation_name,
34  Animation::Callback callback);
35  void activate(Ogre::Entity* entity, std::string animation_name);
36 
37  void update(float deltaT);
38 
39 private:
40  std::map<Ogre::AnimationState*, Callback> active_animations_;
41 };
42 #endif
~Animation()
Definition: animation.cpp:23
std::shared_ptr< Animation > shared
Definition: animation.h:27
std::map< Ogre::AnimationState *, Callback > active_animations_
Definition: animation.h:40
Animation()
Definition: animation.cpp:19
void update(float deltaT)
Definition: animation.cpp:55
void activate(Ogre::Entity *entity, std::string animation_name, Animation::Callback callback)
Definition: animation.cpp:39
Definition: animation.h:25
std::function< void()> Callback
Definition: animation.h:28