X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fgraphics%2FAnimation.h;h=6af75d0a64639ae129a803b96f4c5249c4c7afea;hb=00b557a47e47d9410730d47d436f6158a3fb79f5;hp=03ead7fc5fc3cb75cc293b8c8fd55c135eb7af2a;hpb=62db8dd0b428e68cf5626607297589c2bafe0d3e;p=l2e.git diff --git a/src/graphics/Animation.h b/src/graphics/Animation.h index 03ead7f..6af75d0 100644 --- a/src/graphics/Animation.h +++ b/src/graphics/Animation.h @@ -39,9 +39,20 @@ public: void Stop() { timer = app::Timer(); } + bool Started() const { + return timer.Started(); + } bool Running() const { return timer.Running() && (repeat || timer.Iteration() < NumFrames()); } + bool Finished() const { + return Started() && !Running(); + } + bool JustFinished() const { + return timer.JustHit() && timer.Iteration() == NumFrames(); + } + + const app::Timer &GetTimer() { return timer; } void SetColOffset(int offset) { colOffset = offset; } int ColOffset() const { return colOffset; } @@ -67,8 +78,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;