Merged changes from branches/supertux-milestone2-grumbel/ to trunk/supertux/
[supertux.git] / src / video / texture_manager.hpp
index 0b0854f..e404790 100644 (file)
@@ -1,14 +1,33 @@
-#ifndef __IMAGE_TEXTURE_MANAGER_HPP__
-#define __IMAGE_TEXTURE_MANAGER_HPP__
+//  SuperTux
+//  Copyright (C) 2006 Matthias Braun <matze@braunis.de>
+//
+//  This program is free software: you can redistribute it and/or modify
+//  it under the terms of the GNU General Public License as published by
+//  the Free Software Foundation, either version 3 of the License, or
+//  (at your option) any later version.
+//
+//  This program is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//  GNU General Public License for more details.
+//
+//  You should have received a copy of the GNU General Public License
+//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+#ifndef HEADER_SUPERTUX_VIDEO_TEXTURE_MANAGER_HPP
+#define HEADER_SUPERTUX_VIDEO_TEXTURE_MANAGER_HPP
+
+#include <config.h>
 
-#include <GL/gl.h>
-#include <string>
-#include <vector>
 #include <map>
 #include <set>
+#include <string>
+#include <vector>
+
+#include "video/glutil.hpp"
 
 class Texture;
-class ImageTexture;
+class GLTexture;
 
 class TextureManager
 {
@@ -16,45 +35,50 @@ public:
   TextureManager();
   ~TextureManager();
 
-  ImageTexture* get(const std::string& filename);
-  
-  void register_texture(Texture* texture);
-  void remove_texture(Texture* texture);
+  Texture* get(const std::string& filename);
+
+#ifdef HAVE_OPENGL
+  void register_texture(GLTexture* texture);
+  void remove_texture(GLTexture* texture);
 
   void save_textures();
   void reload_textures();
+#endif
 
 private:
-  friend class ImageTexture;
-  void release(ImageTexture* texture);
-  
-  typedef std::map<std::string, ImageTexture*> ImageTextures;
+  friend class Texture;
+  void release(Texture* texture);
+
+  typedef std::map<std::string, Texture*> ImageTextures;
   ImageTextures image_textures;
 
-  ImageTexture* create_image_texture(const std::string& filename);
+  Texture* create_image_texture(const std::string& filename);
 
-  typedef std::set<Texture*> Textures;
+#ifdef HAVE_OPENGL
+  typedef std::set<GLTexture*> Textures;
   Textures textures;
 
   struct SavedTexture
   {
-    Texture* texture;
-    int width;
-    int height;
+    GLTexture* texture;
+    GLint width;
+    GLint height;
     char* pixels;
-    int border;                              
+    GLint border;
 
-    int min_filter;
-    int mag_filter;
-    int wrap_s;
-    int wrap_t;
+    GLint min_filter;
+    GLint mag_filter;
+    GLint wrap_s;
+    GLint wrap_t;
   };
   std::vector<SavedTexture> saved_textures;
 
-  void save_texture(Texture* texture);
+  void save_texture(GLTexture* texture);
+#endif
 };
 
 extern TextureManager* texture_manager;
 
 #endif
 
+/* EOF */