[Super-tux-commit] supertux/src background.cpp,1.14,1.15 background.h,1.10,1.11
Brought to you by:
wkendrick
From: Matze B. <mat...@us...> - 2004-11-23 14:32:31
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30322/src Modified Files: background.cpp background.h Log Message: make it possible to put background images in each layer Index: background.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/background.h,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- background.h 20 Jul 2004 18:04:47 -0000 1.10 +++ background.h 23 Nov 2004 14:32:19 -0000 1.11 @@ -60,6 +60,7 @@ }; Type type; + int layer; std::string imagefile; float speed; Surface* image; Index: background.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/background.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- background.cpp 20 Nov 2004 22:14:37 -0000 1.14 +++ background.cpp 23 Nov 2004 14:32:18 -0000 1.15 @@ -26,12 +26,12 @@ #include "utils/lispwriter.h" Background::Background() - : type(INVALID), image(0) + : type(INVALID), layer(LAYER_BACKGROUND0), image(0) { } Background::Background(LispReader& reader) - : type(INVALID), image(0) + : type(INVALID), layer(LAYER_BACKGROUND0), image(0) { if(reader.read_string("image", imagefile) && reader.read_float("speed", speed)) { @@ -71,6 +71,7 @@ writer.write_int_vector("top_color", bkgd_top_color); writer.write_int_vector("bottom_color", bkgd_bottom_color); } + writer.write_int("layer", layer); writer.end_list("background"); } @@ -109,12 +110,12 @@ /* In case we are using OpenGL just draw the gradient, else (software mode) use the cache. */ if(use_gl) - context.draw_gradient(gradient_top, gradient_bottom, LAYER_BACKGROUND0); + context.draw_gradient(gradient_top, gradient_bottom, layer); else { context.push_transform(); context.set_translation(Vector(0, 0)); - context.draw_surface(image, Vector(0, 0), LAYER_BACKGROUND0); + context.draw_surface(image, Vector(0, 0), layer); context.pop_transform(); } } else if(type == IMAGE) { @@ -127,7 +128,7 @@ context.set_translation(Vector(0, 0)); for(int x = sx; x < screen->w; x += image->w) for(int y = sy; y < screen->h; y += image->h) - context.draw_surface(image, Vector(x, y), LAYER_BACKGROUND0); + context.draw_surface(image, Vector(x, y), layer); context.pop_transform(); } } |