diff options
Diffstat (limited to '')
-rw-r--r-- | gui/resources.hpp | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/gui/resources.hpp b/gui/resources.hpp index cc5e7b6ff..69d24279f 100644 --- a/gui/resources.hpp +++ b/gui/resources.hpp @@ -17,8 +17,8 @@ public: virtual ~Resource() {} public: - virtual void* GetResource(void) = 0; - std::string GetName(void) { return mName; } + std::string GetName() { return mName; } + virtual bool loadedOK() = 0; private: std::string mName; @@ -44,7 +44,10 @@ public: virtual ~FontResource(); public: - virtual void* GetResource(void) { return mFont; } + void* GetResource() { return this ? mFont : NULL; } + int GetHeight() { return gr_getMaxFontHeight(this ? mFont : NULL); } + + virtual bool loadedOK() { return mFont != NULL; } protected: void* mFont; @@ -58,7 +61,11 @@ public: virtual ~ImageResource(); public: - virtual void* GetResource(void) { return mSurface; } + gr_surface GetResource() { return this ? mSurface : NULL; } + int GetWidth() { return gr_get_width(this ? mSurface : NULL); } + int GetHeight() { return gr_get_height(this ? mSurface : NULL); } + + virtual bool loadedOK() { return mSurface != NULL; } protected: gr_surface mSurface; @@ -71,9 +78,12 @@ public: virtual ~AnimationResource(); public: - virtual void* GetResource(void) { return mSurfaces.empty() ? NULL : mSurfaces.at(0); } - virtual void* GetResource(int entry) { return mSurfaces.empty() ? NULL : mSurfaces.at(entry); } - virtual int GetResourceCount(void) { return mSurfaces.size(); } + gr_surface GetResource() { return (!this || mSurfaces.empty()) ? NULL : mSurfaces.at(0); } + gr_surface GetResource(int entry) { return (!this || mSurfaces.empty()) ? NULL : mSurfaces.at(entry); } + int GetWidth() { return gr_get_width(this ? GetResource() : NULL); } + int GetHeight() { return gr_get_height(this ? GetResource() : NULL); } + int GetResourceCount() { return mSurfaces.size(); } + virtual bool loadedOK() { return !mSurfaces.empty(); } protected: std::vector<gr_surface> mSurfaces; |