make sure we call the sprite load callback

This commit is contained in:
Konstantin Käfer
2014-04-30 12:58:38 +02:00
parent f683cbf02a
commit 74768abeb8
6 changed files with 38 additions and 21 deletions

View File

@@ -49,8 +49,10 @@ public:
private:
void asyncParseJSON();
void asyncParseImage();
static void parseJSON(std::shared_ptr<Sprite> &sprite);
static void parseImage(std::shared_ptr<Sprite> &sprite);
static void complete(std::shared_ptr<Sprite> &sprite);
private:

View File

@@ -8,6 +8,8 @@
#include <mutex>
#include <memory>
typedef struct uv_loop_s uv_loop_t;
namespace llmr {
class Raster : public std::enable_shared_from_this<Raster> {
@@ -16,7 +18,7 @@ public:
~Raster();
// load image data
void load(const std::string& data);
void load();
// set shared texture pool
void setTexturepool(Texturepool* texturepool);
@@ -25,13 +27,15 @@ public:
void bind(bool linear = false);
// loaded status
operator bool() const;
bool isLoaded() const;
// animations
void beginFadeInAnimation();
bool needsAnimation() const;
void updateAnimations(double time);
inline void setData(const std::string &img) { data = img; }
public:
// loaded image dimensions
uint32_t width = 0, height = 0;
@@ -61,6 +65,9 @@ private:
// min/mag filter
uint32_t filter = 0;
// the encoded image data.
std::string data;
// the raw pixels
char *img = nullptr;