]> git.localhorst.tv Git - l2e.git/blobdiff - src/graphics/Animation.h
added number animation
[l2e.git] / src / graphics / Animation.h
index 03ead7fc5fc3cb75cc293b8c8fd55c135eb7af2a..0c6ae288b4a5e04220f764d9c5ba6b4ee05597c4 100644 (file)
@@ -42,6 +42,11 @@ public:
        bool Running() const {
                return timer.Running() && (repeat || timer.Iteration() < NumFrames());
        }
+       bool JustFinished() const {
+               return timer.JustHit() && timer.Iteration() == NumFrames();
+       }
+
+       const app::Timer<Uint32> &GetTimer() { return timer; }
 
        void SetColOffset(int offset) { colOffset = offset; }
        int ColOffset() const { return colOffset; }
@@ -67,8 +72,9 @@ public:
                Draw(dest, position + offset);
        }
 
-protected:
        int Frame() const { return Running() ? (timer.Iteration() % NumFrames()) : 0; }
+
+protected:
        virtual int Col() const = 0;
        virtual int Row() const = 0;
        virtual int NumFrames() const = 0;