commented out an error-message line in glutil.hpp that caused linking errors
[supertux.git] / src / video / image_texture.hpp
1 #ifndef __SURFACE_TEXTURE_HPP__
2 #define __SURFACE_TEXTURE_HPP__
3
4 #include <string>
5 #include <assert.h>
6 #include "texture.hpp"
7
8 class ImageTexture : public Texture
9 {
10 private:
11   std::string filename;
12   float image_width;
13   float image_height;
14   int refcount;
15
16 public:
17   float get_image_width() const
18   {
19     return image_width;
20   }
21
22   float get_image_height() const
23   {
24     return image_height;
25   }
26   
27   float get_uv_right() const
28   {
29     return image_width / static_cast<float> (get_width());
30   }
31   
32   float get_uv_bottom() const
33   {
34     return image_height / static_cast<float> (get_height());
35   }
36
37   void ref()
38   {
39     refcount++;
40   }
41
42   void unref()
43   {
44     assert(refcount > 0);
45     refcount--;
46     if(refcount == 0)
47       release();
48   }
49
50 private:
51   friend class TextureManager;
52   
53   ImageTexture(SDL_Surface* surface);
54   virtual ~ImageTexture();
55
56   void release();
57 };
58
59 #endif
60