X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fobject%2Fbackground.cpp;h=f60f18435537493adaa6104b82b597c9ff7dfedd;hb=04a3157ef478169b5a3fc05dae00ed6ee6a1fae2;hp=02fabd176d5797c887ae8436eb3627fcb8091718;hpb=20e8b8fc6cebb32a3b6076be82f54e4d4942c7e3;p=supertux.git diff --git a/src/object/background.cpp b/src/object/background.cpp index 02fabd176..f60f18435 100644 --- a/src/object/background.cpp +++ b/src/object/background.cpp @@ -1,7 +1,7 @@ // $Id$ // -// SuperTux - A Jump'n Run -// Copyright (C) 2004 Matthias Braun // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License @@ -16,6 +16,7 @@ // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + #include #include @@ -27,7 +28,7 @@ #include "object_factory.hpp" #include "resources.hpp" #include "main.hpp" -#include "msg.hpp" +#include "log.hpp" Background::Background() : layer(LAYER_BACKGROUND0) @@ -50,7 +51,7 @@ Background::Background(const lisp::Lisp& reader) reader.get("layer", layer); if(!reader.get("image", imagefile) || !reader.get("speed", speed)) throw std::runtime_error("Must specify image and speed for background"); - + set_image(imagefile, speed); reader.get("speed-y", speed_y); if (reader.get("image-top", imagefile_top)) { @@ -72,7 +73,7 @@ Background::write(lisp::Writer& writer) if (image_top.get() != NULL) writer.write_string("image-top", imagefile_top); - + writer.write_string("image", imagefile); if (image_bottom.get() != NULL) writer.write_string("image-bottom", imagefile_bottom); @@ -80,7 +81,7 @@ Background::write(lisp::Writer& writer) writer.write_float("speed", speed); writer.write_float("speed-y", speed_y); writer.write_int("layer", layer); - + writer.end_list("background"); } @@ -103,7 +104,7 @@ Background::draw(DrawingContext& context) { if(image.get() == NULL) return; - + int w = (int) image->get_width(); int h = (int) image->get_height(); int sx = int(pos.x-context.get_translation().x * speed) % w - w; @@ -117,7 +118,7 @@ Background::draw(DrawingContext& context) if (image_top.get() != NULL && (y < center_image_py)) { context.draw_surface(image_top.get(), Vector(x, y), layer); continue; - } + } if (image_bottom.get() != NULL && (y >= bottom_image_py)) { context.draw_surface(image_bottom.get(), Vector(x, y), layer); continue;