[Super-tux-commit] supertux/src gameloop.cpp,1.204,1.205 sector.cpp,1.51,1.52 sector.h,1.26,1.27
Brought to you by:
wkendrick
From: Matze B. <mat...@us...> - 2004-11-26 14:54:17
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1294/src Modified Files: gameloop.cpp sector.cpp sector.h Log Message: fixed background drawing problems introduced with my last commit Index: sector.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/sector.h,v retrieving revision 1.26 retrieving revision 1.27 diff -u -d -r1.26 -r1.27 --- sector.h 26 Nov 2004 14:45:41 -0000 1.26 +++ sector.h 26 Nov 2004 14:54:05 -0000 1.27 @@ -134,7 +134,6 @@ // some special objects, where we need direct access Player* player; TileMap* solids; - Background* background; Camera* camera; private: Index: sector.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/sector.cpp,v retrieving revision 1.51 retrieving revision 1.52 diff -u -d -r1.51 -r1.52 --- sector.cpp 26 Nov 2004 14:45:41 -0000 1.51 +++ sector.cpp 26 Nov 2004 14:54:05 -0000 1.52 @@ -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 @@ 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); Index: gameloop.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/gameloop.cpp,v retrieving revision 1.204 retrieving revision 1.205 diff -u -d -r1.204 -r1.205 --- gameloop.cpp 26 Nov 2004 14:45:32 -0000 1.204 +++ gameloop.cpp 26 Nov 2004 14:54:05 -0000 1.205 @@ -185,8 +185,13 @@ 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<Background*> (*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 @@ } 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<Background*> (*i); + if(background) { + background->draw(context); + } + } context.draw_text(blue_text, _("Result:"), Vector(screen->w/2, 200), CENTER_ALLIGN, LAYER_FOREGROUND1); |