Просмотр исходного кода

Added comment to void addListener(AnimationClip::Listener listener, unsigned long eventTime).
Code clean up.

Kieran Cunney 14 лет назад
Родитель
Сommit
71219533c8
1 измененных файлов с 24 добавлено и 14 удалено
  1. 24 14
      gameplay/src/AnimationClip.h

+ 24 - 14
gameplay/src/AnimationClip.h

@@ -192,20 +192,29 @@ public:
     void crossFade(AnimationClip* clip, unsigned long duration);
 
     /**
-     * Adds a animation begin listener.
+     * Adds an animation begin listener.
      *
-     * @param listener The listener to be called when an animation clip begins.
+     * @param listener The listener to be called when an AnimationClip begins.
      */
     void addBeginListener(AnimationClip::Listener* listener);
 
     /**
-     * Adds a animation end listener.
+     * Adds an animation end listener.
      *
-     * @param listener The listener to be called when an animation clip ends.
+     * @param listener The listener to be called when an AnimationClip ends.
      */
     void addEndListener(AnimationClip::Listener* listener);
 
-    void addListener(AnimationClip::Listener* listener, unsigned long time);
+    /**
+     * Adds an animation listener to be called back at the specified eventTime during the playback 
+     * of the AnimationClip.
+     *
+     * @param listener The listener to be called when the AnimationClip reaches the 
+     *      specified time in its playback.
+     * @param eventTime The time the listener will be called during the playback of the AnimationClip. 
+     *      Must be between 0 and the duration of the AnimationClip.
+     */
+    void addListener(AnimationClip::Listener* listener, unsigned long eventTime);
 
 private:
 
@@ -244,6 +253,15 @@ private:
      */
     void onEnd();
 
+    /**
+     * A list that keeps a pointer to the next listener event to be triggered.
+     */
+    struct ListenerList
+    {
+        std::list<Listener*> _list;
+        std::list<Listener*>::iterator _listItr;
+    };
+
     std::string _id;                                // AnimationClip ID.
     Animation* _animation;                          // The Animation this clip is created from.
     unsigned long _startTime;                       // Start time of the clip.
@@ -265,15 +283,7 @@ private:
     std::vector<AnimationValue*> _values;           // AnimationValue holder.
     std::vector<Listener*>* _beginListeners;        // Collection of begin listeners on the clip.
     std::vector<Listener*>* _endListeners;          // Collection of end listeners on the clip.
-
-    struct ListenerList
-    {
-        std::list<Listener*> _list;             // List of listeners.
-        std::list<Listener*>::iterator _listItr; // Pointer to the next listener event to be triggered.
-    };
-
-    ListenerList* _listeners;                        // Collection of listeners on the clip.
-
+    ListenerList* _listeners;                       // Collection of listeners on the clip.
 };
 
 }