summaryrefslogtreecommitdiff
path: root/src/resources/animation
diff options
context:
space:
mode:
Diffstat (limited to 'src/resources/animation')
-rw-r--r--src/resources/animation/animation.cpp12
-rw-r--r--src/resources/animation/animation.h5
2 files changed, 16 insertions, 1 deletions
diff --git a/src/resources/animation/animation.cpp b/src/resources/animation/animation.cpp
index ac7e4a146..e52b55737 100644
--- a/src/resources/animation/animation.cpp
+++ b/src/resources/animation/animation.cpp
@@ -86,3 +86,15 @@ void Animation::setLastFrameDelay(const int delay) noexcept
}
}
}
+
+int Animation::calcMemoryLocal()
+{
+ int sz = sizeof(Animation);
+ FOR_EACH (FramesIter, it, mFrames)
+ {
+ Frame &frame = *it;
+ sz += sizeof(Frame) +
+ frame.nextAction.capacity();
+ }
+ return sz;
+}
diff --git a/src/resources/animation/animation.h b/src/resources/animation/animation.h
index 765e687d4..dc44a3f0d 100644
--- a/src/resources/animation/animation.h
+++ b/src/resources/animation/animation.h
@@ -24,6 +24,7 @@
#define RESOURCES_ANIMATION_ANIMATION_H
#include "resources/frame.h"
+#include "resources/memorycounter.h"
#include <vector>
@@ -35,7 +36,7 @@ class Image;
* An animation consists of several frames, each with their own delay and
* offset.
*/
-class Animation final
+class Animation final : public MemoryCounter
{
friend class AnimatedSprite;
friend class ParticleEmitter;
@@ -82,6 +83,8 @@ class Animation final
{ return mFrames; }
#endif
+ int calcMemoryLocal() override final;
+
/**
* Determines whether the given animation frame is a terminator.
*/