X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fbackground.cpp;h=b8d0ecc945d3998e849967bcdba0600031e66986;hb=546364c9567ef212ea9276201facf73f5ada696a;hp=fcf91f518ce842db73f70c14be4055fb59ce1fe5;hpb=d94b6812ea18ea6dc9f6aed592d2a6766a27c08b;p=supertux.git diff --git a/src/background.cpp b/src/background.cpp index fcf91f518..b8d0ecc94 100644 --- a/src/background.cpp +++ b/src/background.cpp @@ -18,10 +18,10 @@ // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "background.h" -#include "globals.h" +#include "app/globals.h" #include "camera.h" -#include "screen/drawing_context.h" -#include "lispwriter.h" +#include "video/drawing_context.h" +#include "utils/lispwriter.h" Background::Background() : type(INVALID), image(0) @@ -36,13 +36,10 @@ Background::Background(LispReader& reader) set_image(imagefile, speed); } - int tr, tg, tb, br, bg, bb; - if(reader.read_int("top_red", tr) && reader.read_int("top_green", tg) - && reader.read_int("top_blue", tb) && reader.read_int("bottom_red", br) - && reader.read_int("bottom_green", br) - && reader.read_int("bottom_blue", bb)) { - set_gradient(Color(tr, tg, tb), Color(br, bg, bb)); - } + std::vector bkgd_top_color, bkgd_bottom_color; + if(reader.read_int_vector("top_color", bkgd_top_color) && + reader.read_int_vector("bottom_color", bkgd_bottom_color)) + set_gradient(Color(bkgd_top_color), Color(bkgd_bottom_color)); } Background::~Background() @@ -62,12 +59,15 @@ Background::write(LispWriter& writer) writer.write_string("image", imagefile); writer.write_float("speed", speed); } else if(type == GRADIENT) { - writer.write_int("top_red", gradient_top.red); - writer.write_int("top_green", gradient_top.green); - writer.write_int("top_blue", gradient_top.blue); - writer.write_int("bottom_red", gradient_bottom.red); - writer.write_int("bottom_green", gradient_bottom.green); - writer.write_int("bottom_blue", gradient_bottom.blue); + std::vector bkgd_top_color, bkgd_bottom_color; + bkgd_top_color.push_back(gradient_top.red); + bkgd_top_color.push_back(gradient_top.green); + bkgd_top_color.push_back(gradient_top.blue); + bkgd_bottom_color.push_back(gradient_top.red); + bkgd_bottom_color.push_back(gradient_top.green); + bkgd_bottom_color.push_back(gradient_top.blue); + writer.write_int_vector("top_color", bkgd_top_color); + writer.write_int_vector("bottom_color", bkgd_bottom_color); } writer.end_list("background"); @@ -86,7 +86,7 @@ Background::set_image(const std::string& name, float speed) this->speed = speed; delete image; - image = new Surface(datadir + "/images/background/" + name, IGNORE_ALPHA); + image = new Surface(datadir + "/images/background/" + name, false); } void