X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fscreen%2Ftexture.h;h=79899d94d74a75a0803d2a706b35ccd10636b5d1;hb=c79b901309bf5e0544fef1e92d264f51402f4370;hp=84cdc13b90ff15c3b828ffc782bbb3c3d0b63bf6;hpb=d4d4e5e7e87c9d3710ca91d5e3e57de03f03f6be;p=supertux.git diff --git a/src/screen/texture.h b/src/screen/texture.h index 84cdc13b9..79899d94d 100644 --- a/src/screen/texture.h +++ b/src/screen/texture.h @@ -21,18 +21,20 @@ #ifndef SUPERTUX_TEXTURE_H #define SUPERTUX_TEXTURE_H -#include #include +#include + #ifndef NOOPENGL -#include +#include "SDL_opengl.h" #endif -#include -#include +#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