Mercurial > fife-parpg
diff engine/core/video/animation.h @ 150:6e7d228def30
Lazy loading for animations.
Uses a Resource-Pointer class that behaves like
a pointer to an IResource, but only loads the
resource on demand.
There's a slight change of API, which is already
adapted to in the XML loaders. If you use
Animation.addFrame directly, either adapt to the
change or wait a few hours for a backwards compatibility
solution.
author | phoku@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Sat, 11 Oct 2008 12:03:59 +0000 |
parents | 90005975cdbb |
children | 3804348fe3fb |
line wrap: on
line diff
--- a/engine/core/video/animation.h Sat Oct 11 06:23:45 2008 +0000 +++ b/engine/core/video/animation.h Sat Oct 11 12:03:59 2008 +0000 @@ -37,6 +37,7 @@ // First block: files included from the FIFE root src directory // Second block: files included from the same folder #include "util/base/resourceclass.h" +#include "util/resource/resource_ptr.h" namespace FIFE { @@ -72,7 +73,7 @@ * @param image Pointer to Image. Does not transfer the ownership * @param duration Duration for given frame in the animation */ - void addFrame(Image* image, unsigned int duration); + void addFrame(ResourcePtr image, unsigned int duration); /** Get the frame index that matches given timestamp. In case there is no exact match, * correct frame is calculated. E.g. if there are frames for timestamps 50 and 100 @@ -137,7 +138,7 @@ struct FrameInfo { unsigned int index; unsigned int duration; - Image* img; + ResourcePtr image; }; ResourceLocation m_location;