From: Ingo Ruhnke Date: Tue, 1 Dec 2009 04:21:09 +0000 (+0000) Subject: Fixed draw range in Background X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=cbb015c68e184f5c19d0483a486325c1ee819086;p=supertux.git Fixed draw range in Background SVN-Revision: 6162 --- diff --git a/src/object/background.cpp b/src/object/background.cpp index 728adc7d5..0ed917b0a 100644 --- a/src/object/background.cpp +++ b/src/object/background.cpp @@ -85,6 +85,10 @@ Background::Background(const Reader& reader) : { alignment = BOTTOM_ALIGNMENT; } + else if (alignment_str == "none") + { + alignment = NO_ALIGNMENT; + } else { log_warning << "Background: invalid alignment: '" << alignment_str << "'" << std::endl; @@ -143,10 +147,10 @@ Background::draw_image(DrawingContext& context, const Vector& pos) Sizef parallax_image_size = (1.0f - speed) * screen + level * speed; // FIXME: Implement proper clipping here - int start_x = -level.width / image->get_width() / 2; - int end_x = level.width / image->get_width() / 2; - int start_y = -level.height / image->get_height() / 2; - int end_y = level.height / image->get_height() / 2; + int start_x = -parallax_image_size.width / 2.0f / image->get_width() - 1; + int end_x = parallax_image_size.width / 2.0f / image->get_width() + 1; + int start_y = -parallax_image_size.height / 2.0f / image->get_height() - 1; + int end_y = parallax_image_size.height / 2.0f / image->get_height() + 1; switch(alignment) {