Rid extraneous outputs to command line
authorIvan Hernanez <iturtleman128@gmail.com>
Fri, 1 Jun 2012 03:49:37 +0000 (22:49 -0500)
committerIvan Hernanez <iturtleman128@gmail.com>
Fri, 1 Jun 2012 03:49:37 +0000 (22:49 -0500)
Fixed resizing.

Animation.cpp
Background.cpp
Game.cpp
Game.h
main.cpp

index 0ea926e..20b9cdd 100644 (file)
@@ -51,7 +51,6 @@ int Animation::loadAnimation(std::string animFile)
 
                YAML::Node doc;
                while(parser.GetNextDocument(doc)) {
-                       cout<<doc.size()<<endl;
                        mNumFrames = doc.size();
                        mFrames = new SpriteFrame[mNumFrames];
                        mBuilt = 1;
index ba05aad..ed1a980 100644 (file)
@@ -8,7 +8,6 @@ WorldObject(name,-10000, pos),
        wrapping(wrap)
 {
        load(filename);
-       cout<<mPos<<endl<<mVisible<<endl<<mTransparency<<endl<<mAngle<<endl<<mScale<<endl<<ZOrder<<endl;
        cout<<"background \""<<mName<<"\" created"<<endl;       
 }
 void Background::draw(){
index 1653271..de2c512 100644 (file)
--- a/Game.cpp
+++ b/Game.cpp
@@ -9,8 +9,14 @@ const Uint32 Game::waitTime = 1000/60; /* ms */
 
 using namespace std;
 
-void init_GL(int w = 640, int h = 480)
+void Game::resize(int w = 640, int h = 480)
 {
+       mScreen = SDL_SetVideoMode(w, h, 32, SDL_OPENGL | SDL_RESIZABLE);
+       if (!mScreen) {
+               printf ("Couldn't set video mode: %s\n", SDL_GetError ());
+               exit (2);
+       }
+
        // Set the OpenGL state after creating the context with SDL_SetVideoMode
 
        glClearColor( 0, 0, 0, 0 );
@@ -66,19 +72,13 @@ Game::Game() : mCurrentLevel(-1), mScreen(0), ShowCollisions(false), ShowFPS(fal
        SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
        SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24);
 
-       /** Set 800x600 video mode */
-       mScreen = SDL_SetVideoMode(screenwidth, screenheight, 32, SDL_OPENGL | SDL_RESIZABLE);
-       if (!mScreen) {
-               printf ("Couldn't set video mode: %s\n", SDL_GetError ());
-               exit (2);
-       }
 
        /** Set the title of our application window handler */
        SDL_WM_SetCaption("Ivan's Game", NULL);
 
        SDL_ShowCursor(0);
 
-       init_GL(screenwidth, screenheight);
+       resize(screenwidth, screenheight);
 
        /** Load Resources */
        LoadResources();
@@ -178,7 +178,7 @@ void Game::run()
                        break;
 
                case SDL_VIDEORESIZE :
-                       init_GL( event.resize.w, event.resize.h ) ;
+                       resize( event.resize.w, event.resize.h ) ;
                        break ;
 
                case SDL_USEREVENT:
diff --git a/Game.h b/Game.h
index 81178d4..78849f1 100644 (file)
--- a/Game.h
+++ b/Game.h
@@ -99,6 +99,7 @@ private:
        Uint32 deltaclock;
        Uint32 currentFPS;
 
+       void resize(int w , int h);
 };
 
 #endif
index 69cd56a..73b542d 100644 (file)
--- a/main.cpp
+++ b/main.cpp
@@ -28,4 +28,3 @@ int main (int argc, char *argv[])
 
     return 0;
 }
-