00001 00002 00003 #ifndef TEXTURERESOURCEFILE_H 00004 #define TEXTURERESOURCEFILE_H 00005 00006 00007 #include <string> 00008 #include <vector> 00009 00010 00011 namespace xml { 00012 class CXMLNode; 00013 class CXMLDocument; 00014 }; 00015 00016 namespace pge { 00017 00018 class TextureResourceFile { 00019 00020 public: 00021 //************************************************************************ 00022 // 00023 // Data structures 00024 // 00025 //************************************************************************ 00026 struct TextureResource { 00027 std::string m_filename; 00028 bool m_alphaEnabled; 00029 int m_alphaRed; 00030 int m_alphaGreen; 00031 int m_alphaBlue; 00032 unsigned int m_minFilter; 00033 unsigned int m_magFilter; 00034 bool m_doMipmap; 00035 unsigned int m_wrapS; 00036 unsigned int m_wrapT; 00037 }; 00038 00039 00040 //************************************************************************ 00041 // 00042 // Constructor 00043 // 00044 //************************************************************************ 00046 TextureResourceFile(const std::string &file); 00047 00048 00049 //************************************************************************ 00050 // 00051 // Destructor 00052 // 00053 //************************************************************************ 00055 virtual ~TextureResourceFile(void); 00056 00057 00058 //************************************************************************ 00059 // 00060 // Functions 00061 // 00062 //************************************************************************ 00063 bool hasResource(const std::string &filename); 00064 TextureResource getResource(const std::string &filename); 00065 00066 00067 private: 00068 //************************************************************************ 00069 // 00070 // Functions 00071 // 00072 //************************************************************************ 00073 bool parseContent(void); 00074 bool parseTexture(xml::CXMLNode *textureNode); 00075 00076 00077 //************************************************************************ 00078 // 00079 // Variables 00080 // 00081 //************************************************************************ 00082 std::string m_filename; 00083 std::vector<TextureResource> m_resources; 00084 xml::CXMLDocument *m_document; 00085 }; 00086 }; 00087 00088 #endif