UGDK  0.5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
mediaplayer.h
Go to the documentation of this file.
1 #ifndef UGDK_ACTION_MEDIAPLAYER_H_
2 #define UGDK_ACTION_MEDIAPLAYER_H_
3 
4 #include <ugdk/action.h>
5 
6 #include <vector>
7 #include <functional>
8 
9 #define DEFAULT_PERIOD 0.1
10 
11 namespace ugdk {
12 namespace action {
13 
14 class MediaManager;
15 
16 /*TODO
17  * Represents a sprite's current animation.
18  *
19  * An AnimationManager object contains a sequence of information describing a sprite's visual behavior
20  * (animation spreadsheet frames, position, rotation, transparency, etc) throughout a corresponding sequence
21  * of the game's update frames. This per-frame information is represented by the class
22  * AnimationManager::AnimationFrame, and the sequence of this information by the AnimationManager::Animation
23  * type.
24  *
25  * Also, an AnimationManager object contains a set of all the possible animations the sprite may need.
26  * This set is represented by the AnimationSet class. Thus, a sprite needs but one AnimationManager object
27  * to access any of the animations it requires, as long as these are all properly registered
28  * in the AnimationSet object given to the AnimationManager object.
29  */
30 class MediaPlayer {
31  public:
32  MediaPlayer();
33  virtual ~MediaPlayer();
34 
35  virtual void Update(double dt) = 0;
36 
38 
41  void AddObserver(Observer* observer);
42 
43  void AddTickFunction(std::function<void (void)> tick);
44 
46 
47  protected:
48  void notifyAllObservers();
49 
50  private:
51  std::vector<Observer *> observers_;
52  std::vector< std::function<void (void)> > ticks_;
53  MediaManager* manager_;
54 
55  friend class MediaManager;
56 };
57 
58 } /* namespace action */
59 } /* namespace ugdk */
60 
61 #endif /* UGDK_ACTION_MEDIAPLAYER_H_ */
62 
63 
Definition: mediamanager.h:11
Definition: mediaplayer.h:30
Definition: animation.h:11
void AddTickFunction(std::function< void(void)> tick)
Definition: observer.h:8
void ChangeMediaManager(MediaManager *)
virtual void Update(double dt)=0
void AddObserver(Observer *observer)
Add a observer object to the animation.