]> git.mmlx.us Git - IvanGame.git/commitdiff
Game's constructor makes a Level
authorMatt Mullins <mokomull@gmail.com>
Sun, 12 Jul 2009 20:04:49 +0000 (15:04 -0500)
committerMatt Mullins <mokomull@gmail.com>
Sun, 12 Jul 2009 20:04:49 +0000 (15:04 -0500)
Game.cpp
Game.h
Level.cpp

index a93b60f4db440d0930a29ea30305b42cc168b54a..4bd9ca2126ab6f4925d5f1d9630bba4da249c506 100644 (file)
--- a/Game.cpp
+++ b/Game.cpp
@@ -26,14 +26,16 @@ Game::Game() : mCurrentLevel(0), mScreen(0)
        // To see prcisely what this toggle does, just comment the line and recompile
        // the code...
        SDL_EnableKeyRepeat(25, 20);
-}
 
-Game::Game(SDL_Surface* screen) : mCurrentLevel(0), mScreen(screen)
-{
+       // Create the first level
+       mLevels.push_back(new Level(mScreen));
 }
 
 Game::~Game()
 {
+       for (size_t i = 0; i < mLevels.size(); ++i) {
+               delete mLevels[i];
+       }
 }
 
 Level* Game::getCurrentLevel()
diff --git a/Game.h b/Game.h
index 2a4db57285fed1da372b93028a2304d97970e0de..ae01b02907c34e28e9bd7c1f473e101556eb7a35 100644 (file)
--- a/Game.h
+++ b/Game.h
@@ -18,7 +18,6 @@ class Game
 {
 public:
        Game();
-       Game(SDL_Surface *screen);
        ~Game();
 
        /**
index fc31120edc314d2b837ae752f22ed60cc17212ec..2ba05e9f6971732a5b7d113dbbc3dbd007864e3d 100644 (file)
--- a/Level.cpp
+++ b/Level.cpp
@@ -8,6 +8,10 @@ Level::Level(SDL_Surface* screen) :
        mBackground = LoadImage("Backgrounds/bg.bmp");
 }
 
+Level::~Level()
+{
+}
+
 void Level::DrawIMG(SDL_Surface *img, int x, int y)
 {
     SDL_Rect dest;