00001 /* 00002 * libwiisprite - Image 00003 */ 00004 00005 #ifndef LIBWIISPRITE_IMAGE 00006 #define LIBWIISPRITE_IMAGE 00007 00008 #include <stdlib.h> 00009 #include <gccore.h> 00010 00012 namespace wsp{ 00013 00015 enum IMG_LOAD_ERROR{ 00016 IMG_LOAD_ERROR_NONE = 0, 00017 IMG_LOAD_ERROR_NOT_FOUND, 00018 IMG_LOAD_ERROR_INV_PNG, 00019 IMG_LOAD_ERROR_PNG_FAIL, 00020 IMG_LOAD_ERROR_WRONG_SIZE, 00021 IMG_LOAD_ERROR_ALREADY_INIT 00022 }; 00023 00025 class Image{ 00026 public: 00028 Image(); 00030 virtual ~Image(); 00031 00037 IMG_LOAD_ERROR LoadImage(const char* path); 00038 00041 u32 GetWidth() const; 00044 u32 GetHeight() const; 00045 00048 bool IsInitialized() const; 00049 00053 void BindTexture(bool bilinear = true); 00054 protected: 00060 bool _InitializeImage(u32 width, u32 height); 00062 void _Flush(); 00063 u8* _pixels; 00064 private: 00065 u32 _width, _height; 00066 bool _initialized; 00067 GXTexObj _texObj; 00068 }; 00069 }; 00070 00071 #endif