Should have been done long ago.
SVN-Revision: 1565
this->speed = speed;
delete image;
- image = new Surface(datadir + "/images/background/" + name, IGNORE_ALPHA);
+ image = new Surface(datadir + "/images/background/" + name, false);
}
void
if(mw != -1 || mh != -1)
{
- icon.push_back(new Surface(filename,USE_ALPHA));
+ icon.push_back(new Surface(filename,true));
icon.back()->resize(mw,mh);
}
else
- icon.push_back(new Surface(filename,USE_ALPHA));
+ icon.push_back(new Surface(filename,true));
}
SDL_Event event;
DrawingContext context;
- bkgd = new Surface(datadir + "/images/highscore/highscore.png", IGNORE_ALPHA);
+ bkgd = new Surface(datadir + "/images/highscore/highscore.png", false);
hs_score = score;
le_mouse_clicked[LEFT] = false;
le_mouse_clicked[RIGHT] = false;
- le_selection = new Surface(datadir + "/images/leveleditor/select.png", USE_ALPHA);
+ le_selection = new Surface(datadir + "/images/leveleditor/select.png", true);
select_tilegroup_menu_effect.init(false);
select_objects_menu_effect.init(false);
MouseCursor::MouseCursor(std::string cursor_file, int frames) : mid_x(0), mid_y(0)
{
- cursor = new Surface(cursor_file, USE_ALPHA);
+ cursor = new Surface(cursor_file, true);
cur_state = MC_NORMAL;
cur_frame = 0;
SnowParticleSystem::SnowParticleSystem()
{
- snowimages[0] = new Surface(datadir+"/images/shared/snow0.png", USE_ALPHA);
- snowimages[1] = new Surface(datadir+"/images/shared/snow1.png", USE_ALPHA);
- snowimages[2] = new Surface(datadir+"/images/shared/snow2.png", USE_ALPHA);
+ snowimages[0] = new Surface(datadir+"/images/shared/snow0.png", true);
+ snowimages[1] = new Surface(datadir+"/images/shared/snow1.png", true);
+ snowimages[2] = new Surface(datadir+"/images/shared/snow2.png", true);
virtual_width = screen->w * 2;
CloudParticleSystem::CloudParticleSystem()
{
- cloudimage = new Surface(datadir + "/images/shared/cloud.png", USE_ALPHA);
+ cloudimage = new Surface(datadir + "/images/shared/cloud.png", true);
virtual_width = 2000.0;
/* Water: */
- img_water = new Surface(datadir + "/images/shared/water.png", IGNORE_ALPHA);
+ img_water = new Surface(datadir + "/images/shared/water.png", false);
img_waves[0] = new Surface(datadir + "/images/shared/waves-0.png",
- USE_ALPHA);
+ true);
img_waves[1] = new Surface(datadir + "/images/shared/waves-1.png",
- USE_ALPHA);
+ true);
img_waves[2] = new Surface(datadir + "/images/shared/waves-2.png",
- USE_ALPHA);
+ true);
/* Pole: */
- img_pole = new Surface(datadir + "/images/shared/pole.png", USE_ALPHA);
+ img_pole = new Surface(datadir + "/images/shared/pole.png", true);
img_poletop = new Surface(datadir + "/images/shared/poletop.png",
- USE_ALPHA);
+ true);
/* Flag: */
img_flag[0] = new Surface(datadir + "/images/shared/flag-0.png",
- USE_ALPHA);
+ true);
img_flag[1] = new Surface(datadir + "/images/shared/flag-1.png",
- USE_ALPHA);
+ true);
/* Cloud: */
img_cloud[0][0] = new Surface(datadir + "/images/shared/cloud-00.png",
- USE_ALPHA);
+ true);
img_cloud[0][1] = new Surface(datadir + "/images/shared/cloud-01.png",
- USE_ALPHA);
+ true);
img_cloud[0][2] = new Surface(datadir + "/images/shared/cloud-02.png",
- USE_ALPHA);
+ true);
img_cloud[0][3] = new Surface(datadir + "/images/shared/cloud-03.png",
- USE_ALPHA);
+ true);
img_cloud[1][0] = new Surface(datadir + "/images/shared/cloud-10.png",
- USE_ALPHA);
+ true);
img_cloud[1][1] = new Surface(datadir + "/images/shared/cloud-11.png",
- USE_ALPHA);
+ true);
img_cloud[1][2] = new Surface(datadir + "/images/shared/cloud-12.png",
- USE_ALPHA);
+ true);
img_cloud[1][3] = new Surface(datadir + "/images/shared/cloud-13.png",
- USE_ALPHA);
+ true);
/* Bad guys: */
/* Distros: */
img_distro[0] = new Surface(datadir + "/images/tilesets/coin1.png",
- USE_ALPHA);
+ true);
img_distro[1] = new Surface(datadir + "/images/tilesets/coin2.png",
- USE_ALPHA);
+ true);
img_distro[2] = new Surface(datadir + "/images/tilesets/coin3.png",
- USE_ALPHA);
+ true);
img_distro[3] = new Surface(datadir + "/images/tilesets/coin2.png",
- USE_ALPHA);
+ true);
/* Tux life: */
tux_life = new Surface(datadir + "/images/shared/tux-life.png",
- USE_ALPHA);
+ true);
/* Sound effects: */
: 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:
}
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);
}
}
}
// 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;
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);
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
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_)
{}
}
#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();
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();
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();
}
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;
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);
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);
}
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;
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);
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);
}
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;
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);
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;
}
#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);
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);
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_);
#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;
#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;
ConstructorType type;
SDL_Surface* surface;
std::string file;
- int use_alpha;
+ bool use_alpha;
int x;
int y;
int w;
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();
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();
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();
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();
Font::NUM, 32,32);
/* Load GUI/menu images: */
- checkbox = new Surface(datadir + "/images/status/checkbox.png", USE_ALPHA);
- checkbox_checked = new Surface(datadir + "/images/status/checkbox-checked.png", USE_ALPHA);
- back = new Surface(datadir + "/images/status/back.png", USE_ALPHA);
- arrow_left = new Surface(datadir + "/images/icons/left.png", USE_ALPHA);
- arrow_right = new Surface(datadir + "/images/icons/right.png", USE_ALPHA);
+ checkbox = new Surface(datadir + "/images/status/checkbox.png", true);
+ checkbox_checked = new Surface(datadir + "/images/status/checkbox-checked.png", true);
+ back = new Surface(datadir + "/images/status/back.png", true);
+ arrow_left = new Surface(datadir + "/images/icons/left.png", true);
+ arrow_right = new Surface(datadir + "/images/icons/right.png", true);
/* Load the mouse-cursor */
mouse_cursor = new MouseCursor( datadir + "/images/status/mousecursor.png",1);
for(std::vector<std::string>::size_type i = 0; i < images.size(); ++i)
{
surfaces.push_back(
- new Surface(datadir + "/images/" + images[i], USE_ALPHA));
+ new Surface(datadir + "/images/" + images[i], true));
}
frame_delay = 1000.0f/fps;
if (lisp_string_p(cur))
{
return new Surface(datadir + "/images/tilesets/" + lisp_string(cur),
- USE_ALPHA);
+ true);
}
else if (lisp_cons_p(cur) && lisp_symbol_p(lisp_car(cur)))
{
lisp_integer(lisp_list_nth(data, 2)),
lisp_integer(lisp_list_nth(data, 3)),
lisp_integer(lisp_list_nth(data, 4)),
- USE_ALPHA);
+ true);
}
else
{
titlesession = new GameSession(datadir + "/levels/misc/menu.stl", ST_GL_DEMO_GAME);
/* Load images: */
- bkg_title = new Surface(datadir + "/images/background/arctis.jpg", IGNORE_ALPHA);
- logo = new Surface(datadir + "/images/title/logo.png", USE_ALPHA);
- img_choose_subset = new Surface(datadir + "/images/status/choose-level-subset.png", USE_ALPHA);
+ bkg_title = new Surface(datadir + "/images/background/arctis.jpg", false);
+ logo = new Surface(datadir + "/images/title/logo.png", true);
+ img_choose_subset = new Surface(datadir + "/images/status/choose-level-subset.png", true);
/* Generating contrib maps by only using a string_list */
worldmap_list = dfiles("levels/worldmap", NULL, NULL);
tile->sprite = new Surface(
datadir + "/images/worldmap/" + filename,
- USE_ALPHA);
+ true);
if (id >= int(tiles.size()))
tiles.resize(id+1);
Tux::Tux(WorldMap* worldmap_)
: worldmap(worldmap_)
{
- largetux_sprite = new Surface(datadir + "/images/worldmap/tux.png", USE_ALPHA);
- firetux_sprite = new Surface(datadir + "/images/worldmap/firetux.png", USE_ALPHA);
- smalltux_sprite = new Surface(datadir + "/images/worldmap/smalltux.png", USE_ALPHA);
+ largetux_sprite = new Surface(datadir + "/images/worldmap/tux.png", true);
+ firetux_sprite = new Surface(datadir + "/images/worldmap/firetux.png", true);
+ smalltux_sprite = new Surface(datadir + "/images/worldmap/smalltux.png", true);
offset = 0;
moving = false;
start_x = 4;
start_y = 5;
- level_sprite = new Surface(datadir + "/images/worldmap/levelmarker.png", USE_ALPHA);
- leveldot_green = new Surface(datadir + "/images/worldmap/leveldot_green.png", USE_ALPHA);
- leveldot_red = new Surface(datadir + "/images/worldmap/leveldot_red.png", USE_ALPHA);
+ level_sprite = new Surface(datadir + "/images/worldmap/levelmarker.png", true);
+ leveldot_green = new Surface(datadir + "/images/worldmap/leveldot_green.png", true);
+ leveldot_red = new Surface(datadir + "/images/worldmap/leveldot_red.png", true);
input_direction = D_NONE;
enter_level = false;