From 54432e21b40dee494dc0d1525916f1283a8df006 Mon Sep 17 00:00:00 2001 From: grumbel Date: Tue, 1 Dec 2009 04:21:09 +0000 Subject: [PATCH] Fixed draw range in Background git-svn-id: http://supertux.lethargik.org/svn/supertux/trunk/supertux@6162 837edb03-e0f3-0310-88ca-d4d4e8b29345 --- src/object/background.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) 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) { -- 2.11.0