From aa68511ad3d339be8c8f42fc6c083b696d8e687b Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 20 Jun 2012 00:34:39 +0300 Subject: Add delayed images load. Can work for now only in OpenGL modes. --- src/animatedsprite.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/animatedsprite.h') diff --git a/src/animatedsprite.h b/src/animatedsprite.h index d28badfc1..4f4caff16 100644 --- a/src/animatedsprite.h +++ b/src/animatedsprite.h @@ -29,6 +29,7 @@ #include class Animation; +class AnimationDelayLoad; struct Frame; /** @@ -53,6 +54,9 @@ class AnimatedSprite : public Sprite static AnimatedSprite *load(const std::string &filename, int variant = 0); + static AnimatedSprite *delayedLoad(const std::string &filename, + int variant = 0); + virtual ~AnimatedSprite(); bool reset(); @@ -86,9 +90,19 @@ class AnimatedSprite : public Sprite bool updateNumber(unsigned num); + void clearDelayLoad(); + + void setSprite(SpriteDef *sprite) + { mSprite = sprite; } + + static void setEnableCache(bool b) + { mEnableCache = b; } + private: bool updateCurrentAnimation(unsigned int dt); + void setDelayLoad(const std::string &filename, int variant); + SpriteDirection mDirection; /**< The sprite direction. */ int mLastTime; /**< The last time update was called. */ @@ -101,6 +115,8 @@ class AnimatedSprite : public Sprite Frame *mFrame; /**< The currently active frame. */ unsigned mNumber; unsigned mNumber1; + AnimationDelayLoad *mDelayLoad; + static bool mEnableCache; }; #endif -- cgit v1.2.3-60-g2f50