From: Matthias Braun Date: Fri, 26 Nov 2004 14:54:05 +0000 (+0000) Subject: fixed background drawing problems introduced with my last commit X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=02d54bd21d3d72e46ecad8f6038666b0384d4eb8;p=supertux.git fixed background drawing problems introduced with my last commit SVN-Revision: 2203 --- diff --git a/lib/special/collision.cpp b/lib/special/collision.cpp index 889899f76..46ed0bf79 100644 --- a/lib/special/collision.cpp +++ b/lib/special/collision.cpp @@ -146,7 +146,6 @@ Collision::rectangle_aatriangle(CollisionHit& hit, const Rectangle& rect, return false; float time = depth / -(normal * movement); if(time < hit.time) { - printf("Time: %f.\n", time); hit.depth = depth; hit.time = time; hit.normal = normal; diff --git a/src/gameloop.cpp b/src/gameloop.cpp index a5933de17..1b2914bef 100644 --- a/src/gameloop.cpp +++ b/src/gameloop.cpp @@ -185,8 +185,13 @@ GameSession::levelintro(void) char str[60]; DrawingContext context; - if(currentsector->background) - currentsector->background->draw(context); + for(Sector::GameObjects::iterator i = currentsector->gameobjects.begin(); + i != currentsector->gameobjects.end(); ++i) { + Background* background = dynamic_cast (*i); + if(background) { + background->draw(context); + } + } // context.draw_text(gold_text, level->get_name(), Vector(screen->w/2, 160), // CENTER_ALLIGN, LAYER_FOREGROUND1); @@ -905,12 +910,18 @@ GameSession::drawstatus(DrawingContext& context) } void -GameSession::drawresultscreen(void) +GameSession::drawresultscreen() { char str[80]; DrawingContext context; - currentsector->background->draw(context); + for(Sector::GameObjects::iterator i = currentsector->gameobjects.begin(); + i != currentsector->gameobjects.end(); ++i) { + Background* background = dynamic_cast (*i); + if(background) { + background->draw(context); + } + } context.draw_text(blue_text, _("Result:"), Vector(screen->w/2, 200), CENTER_ALLIGN, LAYER_FOREGROUND1); diff --git a/src/sector.cpp b/src/sector.cpp index 98731009a..f9b5ede9c 100644 --- a/src/sector.cpp +++ b/src/sector.cpp @@ -63,7 +63,7 @@ Sector* Sector::_current = 0; Sector::Sector() - : gravity(10), player(0), solids(0), background(0), camera(0), + : gravity(10), player(0), solids(0), camera(0), currentmusic(LEVEL_MUSIC) { song_title = "Mortimers_chipdisko.mod"; @@ -93,8 +93,7 @@ GameObject* Sector::parse_object(const std::string& name, LispReader& reader) { if(name == "background") { - background = new Background(reader); - return background; + return new Background(reader); } else if(name == "camera") { Camera* camera = new Camera(this); camera->parse(reader); diff --git a/src/sector.h b/src/sector.h index a30e5d41d..45a2cd539 100644 --- a/src/sector.h +++ b/src/sector.h @@ -134,7 +134,6 @@ public: // some special objects, where we need direct access Player* player; TileMap* solids; - Background* background; Camera* camera; private: