- moved tilemanager into its own class
[supertux.git] / src / screen / texture.h
index 84cdc13..79899d9 100644 (file)
 #ifndef SUPERTUX_TEXTURE_H
 #define SUPERTUX_TEXTURE_H
 
-#include <SDL.h>
 #include <string>
+#include <list>
+
 #ifndef NOOPENGL
-#include <SDL_opengl.h>
+#include "SDL_opengl.h"
 #endif
 
-#include <stdint.h>
-#include <list>
+#include "SDL.h"
+
 #include "screen.h"
 #include "vector.h"
 
 SDL_Surface* sdl_surface_from_sdl_surface(SDL_Surface* sdl_surf, int use_alpha);
+SDL_Surface* sdl_surface_from_nothing();
 
 class SurfaceImpl;
 class SurfaceSDL;
@@ -41,7 +43,7 @@ class DrawingContext;
 
 /// bitset for drawing effects
 enum {
-      /** Draw the Surface upside down */
+      /** Don't apply anything */
       NONE_EFFECT       = 0x0000,
       /** Draw the Surface upside down */
       VERTICAL_FLIP     = 0x0001,
@@ -53,7 +55,7 @@ enum {
 class SurfaceData 
 {
 public:
-  enum ConstructorType { LOAD, LOAD_PART, SURFACE };
+  enum ConstructorType { LOAD, LOAD_PART, SURFACE, GRADIENT };
   ConstructorType type;
   SDL_Surface* surface;
   std::string file;
@@ -62,10 +64,13 @@ public:
   int y;
   int w;
   int h;
+  Color top_gradient;
+  Color bottom_gradient;
 
   SurfaceData(SDL_Surface* surf, int use_alpha_);
   SurfaceData(const std::string& file_, int use_alpha_);
   SurfaceData(const std::string& file_, int x_, int y_, int w_, int h_, int use_alpha_);
+  SurfaceData(Color top_gradient_, Color bottom_gradient_, int w_, int h_);
   ~SurfaceData();
 
   SurfaceSDL* create_SurfaceSDL();
@@ -92,6 +97,7 @@ public:
   Surface(SDL_Surface* surf, int use_alpha);  
   Surface(const std::string& file, int use_alpha);  
   Surface(const std::string& file, int x, int y, int w, int h, int use_alpha);
+  Surface(Color top_gradient, Color bottom_gradient, int w_, int h_);
   ~Surface();
   
   /** Reload the surface, which is necesarry in case of a mode swich */
@@ -116,8 +122,8 @@ public:
   virtual ~SurfaceImpl();
   
   /** Return 0 on success, -2 if surface needs to be reloaded */
-  virtual int draw(float x, float y, Uint8 alpha, uint32_t effect = NONE_EFFECT) = 0;
-  virtual int draw_part(float sx, float sy, float x, float y, float w, float h,  Uint8 alpha, uint32_t effect = NONE_EFFECT) = 0;
+  virtual int draw(float x, float y, Uint8 alpha, Uint32 effect = NONE_EFFECT) = 0;
+  virtual int draw_part(float sx, float sy, float x, float y, float w, float h,  Uint8 alpha, Uint32 effect = NONE_EFFECT) = 0;
 #if 0
   virtual int draw_stretched(float x, float y, int w, int h, Uint8 alpha, bool update) = 0;
 #endif
@@ -132,10 +138,11 @@ public:
   SurfaceSDL(SDL_Surface* surf, int use_alpha);
   SurfaceSDL(const std::string& file, int use_alpha);  
   SurfaceSDL(const std::string& file, int x, int y, int w, int h, int use_alpha);
+  SurfaceSDL(Color top_gradient, Color bottom_gradient, int w, int h);
   virtual ~SurfaceSDL();
 
-  int draw(float x, float y, Uint8 alpha, uint32_t effect = NONE_EFFECT);
-  int draw_part(float sx, float sy, float x, float y, float w, float h,  Uint8 alpha, uint32_t effect = NONE_EFFECT);
+  int draw(float x, float y, Uint8 alpha, Uint32 effect = NONE_EFFECT);
+  int draw_part(float sx, float sy, float x, float y, float w, float h,  Uint8 alpha, Uint32 effect = NONE_EFFECT);
 #if 0
   int draw_stretched(float x, float y, int w, int h, Uint8 alpha);
 #endif
@@ -151,10 +158,12 @@ public:
   SurfaceOpenGL(SDL_Surface* surf, int use_alpha);
   SurfaceOpenGL(const std::string& file, int use_alpha);  
   SurfaceOpenGL(const std::string& file, int x, int y, int w, int h, int use_alpha);
+  SurfaceOpenGL(Color top_gradient, Color bottom_gradient, int w, int h);
+
   virtual ~SurfaceOpenGL();
 
-  int draw(float x, float y, Uint8 alpha, uint32_t effect = NONE_EFFECT);
-  int draw_part(float sx, float sy, float x, float y, float w, float h,  Uint8 alpha, uint32_t effect = NONE_EFFECT);
+  int draw(float x, float y, Uint8 alpha, Uint32 effect = NONE_EFFECT);
+  int draw_part(float sx, float sy, float x, float y, float w, float h,  Uint8 alpha, Uint32 effect = NONE_EFFECT);
 #if 0
   int draw_stretched(float x, float y, int w, int h, Uint8 alpha);
 #endif