]> git.jsancho.org Git - lugaru.git/blob - Source/Texture.h
The console key is now easy to configure. (the option will only be shown in debug...
[lugaru.git] / Source / Texture.h
1 #include <map>
2 #include <string>
3
4 //keeps track of which textures are loaded
5 //TODO: delete them properly
6 class Texture {
7         private:
8                 static std::map<std::string,Texture> textures;
9         
10                 bool isSkin;
11                 std::string fileName;
12                 GLuint id;
13                 bool mipmap;
14                 bool hasalpha;
15                 GLubyte* array;
16                 int arraySize;
17                 int skinsize;
18
19                 void load();
20
21         public:
22                 Texture():
23                         isSkin(false), skinsize(0), arraySize(0),
24                         fileName(""), id(0), mipmap(false), hasalpha(false), array(NULL) { }
25                 ~Texture() {
26                         free(array);
27                 }
28                 Texture (const std::string& _fileName, bool _mipmap, bool _hasalpha):
29                         isSkin(false), skinsize(0), arraySize(0), array(NULL),
30                         fileName(_fileName), id(0), mipmap(_mipmap), hasalpha(_hasalpha) { }
31                 Texture (const std::string& _fileName, bool _mipmap, bool _hasalpha, bool _isSkin):
32                         isSkin(_isSkin), skinsize(0), arraySize(0), array(NULL),
33                         fileName(_fileName), id(0), mipmap(_mipmap), hasalpha(_hasalpha) { }
34                 GLuint getId() const { return id; }
35                 
36                 static GLuint Load(const std::string& fileName, bool mipmap, bool hasalpha);
37                 static GLuint Load(const std::string& fileName, bool mipmap, bool hasalpha, GLubyte* array, int* skinsize);
38 };
39