#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;
/// 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,
class SurfaceData
{
public:
- enum ConstructorType { LOAD, LOAD_PART, SURFACE };
+ enum ConstructorType { LOAD, LOAD_PART, SURFACE, GRADIENT };
ConstructorType type;
SDL_Surface* surface;
std::string file;
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();
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 */
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
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
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