[Super-tux-commit] supertux/src/screen font.cpp,1.9,1.10 screen.h,1.7,1.8 surface.cpp,1.2,1.3 surfac
Brought to you by:
wkendrick
From: Ricardo C. <rm...@us...> - 2004-07-10 14:23:08
|
Update of /cvsroot/super-tux/supertux/src/screen In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31744/src/screen Modified Files: font.cpp screen.h surface.cpp surface.h Log Message: Replaced USE_ALPHA/IGNORE_ALPHA by booleans. Should have been done long ago. Index: font.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/screen/font.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- font.cpp 10 Jul 2004 14:07:03 -0000 1.9 +++ font.cpp 10 Jul 2004 14:22:58 -0000 1.10 @@ -33,7 +33,7 @@ : chars(0), shadow_chars(0), type(ntype), w(nw), h(nh), shadowsize(nshadowsize) { - chars = new Surface(file, USE_ALPHA); + chars = new Surface(file, true); switch(type) { case TEXT: @@ -58,7 +58,7 @@ } SDL_UnlockSurface(conv); SDL_SetAlpha(conv, SDL_SRCALPHA, 128); - shadow_chars = new Surface(conv, USE_ALPHA); + shadow_chars = new Surface(conv, true); SDL_FreeSurface(conv); } } @@ -172,7 +172,7 @@ } // load background image - Surface* background = new Surface(datadir + "/images/background/" + background_file, IGNORE_ALPHA); + Surface* background = new Surface(datadir + "/images/background/" + background_file, false); int done = 0; float scroll = 0; Index: screen.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/screen/screen.h,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- screen.h 25 Jun 2004 11:54:37 -0000 1.7 +++ screen.h 10 Jul 2004 14:22:58 -0000 1.8 @@ -53,11 +53,6 @@ class Vector; -#define NO_UPDATE false -#define UPDATE true -#define USE_ALPHA 0 -#define IGNORE_ALPHA 1 - void putpixel(SDL_Surface *surface, int x, int y, Uint32 pixel); void drawpixel(int x, int y, Uint32 pixel); void fillrect(float x, float y, float w, float h, int r, int g, int b, int a = 255); Index: surface.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/screen/surface.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- surface.h 14 Jun 2004 22:56:17 -0000 1.2 +++ surface.h 10 Jul 2004 14:22:58 -0000 1.3 @@ -33,7 +33,7 @@ #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_sdl_surface(SDL_Surface* sdl_surf, bool use_alpha); SDL_Surface* sdl_surface_from_nothing(); class SurfaceImpl; @@ -59,7 +59,7 @@ ConstructorType type; SDL_Surface* surface; std::string file; - int use_alpha; + bool use_alpha; int x; int y; int w; @@ -67,9 +67,9 @@ 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(SDL_Surface* surf, bool use_alpha_); + SurfaceData(const std::string& file_, bool use_alpha_); + SurfaceData(const std::string& file_, int x_, int y_, int w_, int h_, bool use_alpha_); SurfaceData(Color top_gradient_, Color bottom_gradient_, int w_, int h_); ~SurfaceData(); @@ -94,9 +94,9 @@ static void reload_all(); static void debug_check(); - 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(SDL_Surface* surf, bool use_alpha); + Surface(const std::string& file, bool use_alpha); + Surface(const std::string& file, int x, int y, int w, int h, bool use_alpha); Surface(Color top_gradient, Color bottom_gradient, int w_, int h_); ~Surface(); @@ -135,9 +135,9 @@ class SurfaceSDL : public SurfaceImpl { 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(SDL_Surface* surf, bool use_alpha); + SurfaceSDL(const std::string& file, bool use_alpha); + SurfaceSDL(const std::string& file, int x, int y, int w, int h, bool use_alpha); SurfaceSDL(Color top_gradient, Color bottom_gradient, int w, int h); virtual ~SurfaceSDL(); @@ -155,9 +155,9 @@ GLuint gl_texture; 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(SDL_Surface* surf, bool use_alpha); + SurfaceOpenGL(const std::string& file, bool use_alpha); + SurfaceOpenGL(const std::string& file, int x, int y, int w, int h, bool use_alpha); SurfaceOpenGL(Color top_gradient, Color bottom_gradient, int w, int h); virtual ~SurfaceOpenGL(); Index: surface.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/screen/surface.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- surface.cpp 14 Jun 2004 22:56:17 -0000 1.2 +++ surface.cpp 10 Jul 2004 14:22:58 -0000 1.3 @@ -31,7 +31,7 @@ Surface::Surfaces Surface::surfaces; -SurfaceData::SurfaceData(SDL_Surface* temp, int use_alpha_) +SurfaceData::SurfaceData(SDL_Surface* temp, bool use_alpha_) : type(SURFACE), surface(0), use_alpha(use_alpha_) { // Copy the given surface and make sure that it is not stored in @@ -49,11 +49,11 @@ SDL_BlitSurface(temp, NULL, surface, NULL); } -SurfaceData::SurfaceData(const std::string& file_, int use_alpha_) +SurfaceData::SurfaceData(const std::string& file_, bool use_alpha_) : type(LOAD), surface(0), file(file_), use_alpha(use_alpha_) {} -SurfaceData::SurfaceData(const std::string& file_, int x_, int y_, int w_, int h_, int use_alpha_) +SurfaceData::SurfaceData(const std::string& file_, int x_, int y_, int w_, int h_, bool use_alpha_) : type(LOAD_PART), surface(0), file(file_), use_alpha(use_alpha_), x(x_), y(y_), w(w_), h(h_) {} @@ -134,7 +134,7 @@ } #endif -Surface::Surface(SDL_Surface* surf, int use_alpha) +Surface::Surface(SDL_Surface* surf, bool use_alpha) : data(surf, use_alpha), w(0), h(0) { impl = data.create(); @@ -146,7 +146,7 @@ surfaces.push_back(this); } -Surface::Surface(const std::string& file, int use_alpha) +Surface::Surface(const std::string& file, bool use_alpha) : data(file, use_alpha), w(0), h(0) { impl = data.create(); @@ -158,7 +158,7 @@ surfaces.push_back(this); } -Surface::Surface(const std::string& file, int x, int y, int w, int h, int use_alpha) +Surface::Surface(const std::string& file, int x, int y, int w, int h, bool use_alpha) : data(file, x, y, w, h, use_alpha), w(0), h(0) { impl = data.create(); @@ -248,7 +248,7 @@ } SDL_Surface* -sdl_surface_part_from_file(const std::string& file, int x, int y, int w, int h, int use_alpha) +sdl_surface_part_from_file(const std::string& file, int x, int y, int w, int h, bool use_alpha) { SDL_Rect src; SDL_Surface * sdl_surface; @@ -283,7 +283,7 @@ SDL_SetAlpha(temp,0,0); SDL_BlitSurface(temp, &src, conv, NULL); - if(use_alpha == IGNORE_ALPHA && !use_gl) + if(use_alpha == false && !use_gl) sdl_surface = SDL_DisplayFormat(conv); else sdl_surface = SDL_DisplayFormatAlpha(conv); @@ -291,7 +291,7 @@ if (sdl_surface == NULL) st_abort("Can't covert to display format", file); - if (use_alpha == IGNORE_ALPHA && !use_gl) + if (use_alpha == false && !use_gl) SDL_SetAlpha(sdl_surface, 0, 0); SDL_FreeSurface(temp); @@ -301,7 +301,7 @@ } SDL_Surface* -sdl_surface_from_file(const std::string& file, int use_alpha) +sdl_surface_from_file(const std::string& file, bool use_alpha) { SDL_Surface* sdl_surface; SDL_Surface* temp; @@ -311,7 +311,7 @@ if (temp == NULL) st_abort("Can't load", file); - if(use_alpha == IGNORE_ALPHA && !use_gl) + if(use_alpha == false && !use_gl) sdl_surface = SDL_DisplayFormat(temp); else sdl_surface = SDL_DisplayFormatAlpha(temp); @@ -319,7 +319,7 @@ if (sdl_surface == NULL) st_abort("Can't covert to display format", file); - if (use_alpha == IGNORE_ALPHA && !use_gl) + if (use_alpha == false && !use_gl) SDL_SetAlpha(sdl_surface, 0, 0); SDL_FreeSurface(temp); @@ -328,7 +328,7 @@ } SDL_Surface* -sdl_surface_from_sdl_surface(SDL_Surface* sdl_surf, int use_alpha) +sdl_surface_from_sdl_surface(SDL_Surface* sdl_surf, bool use_alpha) { SDL_Surface* sdl_surface; Uint32 saved_flags; @@ -343,7 +343,7 @@ SDL_SetAlpha(sdl_surf, 0, 0); } - if(use_alpha == IGNORE_ALPHA && !use_gl) + if(use_alpha == false && !use_gl) sdl_surface = SDL_DisplayFormat(sdl_surf); else sdl_surface = SDL_DisplayFormatAlpha(sdl_surf); @@ -358,7 +358,7 @@ if (sdl_surface == NULL) st_abort("Can't covert to display format", "SURFACE"); - if (use_alpha == IGNORE_ALPHA && !use_gl) + if (use_alpha == false && !use_gl) SDL_SetAlpha(sdl_surface, 0, 0); return sdl_surface; @@ -434,7 +434,7 @@ } #ifndef NOOPENGL -SurfaceOpenGL::SurfaceOpenGL(SDL_Surface* surf, int use_alpha) +SurfaceOpenGL::SurfaceOpenGL(SDL_Surface* surf, bool use_alpha) { sdl_surface = sdl_surface_from_sdl_surface(surf, use_alpha); create_gl(sdl_surface,&gl_texture); @@ -443,7 +443,7 @@ h = sdl_surface->h; } -SurfaceOpenGL::SurfaceOpenGL(const std::string& file, int use_alpha) +SurfaceOpenGL::SurfaceOpenGL(const std::string& file, bool use_alpha) { sdl_surface = sdl_surface_from_file(file, use_alpha); create_gl(sdl_surface,&gl_texture); @@ -452,7 +452,7 @@ h = sdl_surface->h; } -SurfaceOpenGL::SurfaceOpenGL(const std::string& file_, int x_, int y_, int w_, int h_, int use_alpha_) +SurfaceOpenGL::SurfaceOpenGL(const std::string& file_, int x_, int y_, int w_, int h_, bool use_alpha_) { sdl_surface = sdl_surface_part_from_file(file_,x_,y_,w_,h_,use_alpha_); @@ -700,21 +700,21 @@ #endif -SurfaceSDL::SurfaceSDL(SDL_Surface* surf, int use_alpha) +SurfaceSDL::SurfaceSDL(SDL_Surface* surf, bool use_alpha) { sdl_surface = sdl_surface_from_sdl_surface(surf, use_alpha); w = sdl_surface->w; h = sdl_surface->h; } -SurfaceSDL::SurfaceSDL(const std::string& file, int use_alpha) +SurfaceSDL::SurfaceSDL(const std::string& file, bool use_alpha) { sdl_surface = sdl_surface_from_file(file, use_alpha); w = sdl_surface->w; h = sdl_surface->h; } -SurfaceSDL::SurfaceSDL(const std::string& file, int x, int y, int w, int h, int use_alpha) +SurfaceSDL::SurfaceSDL(const std::string& file, int x, int y, int w, int h, bool use_alpha) { sdl_surface = sdl_surface_part_from_file(file, x, y, w, h, use_alpha); w = sdl_surface->w; |