diff --git a/src/chunk.cpp b/src/chunk.cpp index b13330b762959b76a9640cbe9522fe08205d9b88..1d335fb198f08aa744910d4690bf425a7db306e8 100644 --- a/src/chunk.cpp +++ b/src/chunk.cpp @@ -14,7 +14,7 @@ Chunk::~Chunk() void Chunk::generate(){ this->generate_random(); } void Chunk::generate_random() { - this->_logger.info( "Generating Chunk at "+this->getLocationString()+" - Random" ); + // this->_logger.info( "Generating Chunk at "+this->getLocationString()+" - Random" ); this->wealth = rand(); this->weirdness = rand(); diff --git a/src/main.cpp b/src/main.cpp index 573b2b1f5932d6a3ab1a2f974d2a09ad75061058..3193ad1d10f6893c38f6f119dc0ef24cb700ab24 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -19,12 +19,29 @@ int main( int argc, char* argv[] ) { SDL_Surface* screenSurface = NULL; //Initialize SDL - //if( SDL_Init( SDL_INIT_VIDEO ) < 0 ) - //{ - //// printf( "SDL could not initialize! SDL_Error: \n%s\n", SDL_GetError() ); - //} + if( SDL_Init( SDL_INIT_VIDEO ) < 0 ) + { + // printf( "SDL could not initialize! SDL_Error: \n%s\n", SDL_GetError() ); + logger.error( "Failed to initialise SDL" ); + return 1; + } window = SDL_CreateWindow( "SDL Tutorial", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, SCREEN_WIDTH, SCREEN_HEIGHT, SDL_WINDOW_SHOWN ); + if( window == NULL ) + { + printf( "Window could not be created! SDL_Error: %s\n", SDL_GetError() ); + } else { + //Get window surface + screenSurface = SDL_GetWindowSurface( window ); + + //Fill the surface white + SDL_FillRect( screenSurface, NULL, SDL_MapRGB( screenSurface->format, 0xFF, 0xFF, 0xFF ) ); + //Update the surface + SDL_UpdateWindowSurface( window ); + + //Hack to get window to stay up + SDL_Event e; bool quit = false; while( quit == false ){ while( SDL_PollEvent( &e ) ){ if( e.type == SDL_QUIT ) quit = true; } } + } // Genrate a Random chunk WorldHex2D map( 5 ); //Chunk* chunk = new Chunk( 0, 0, 0); @@ -58,7 +75,12 @@ int main( int argc, char* argv[] ) { } // Clean-up - + //Destroy window + SDL_DestroyWindow( window ); + + //Quit SDL subsystems + SDL_Quit(); + // Return logger.info( "Process Ending" ); return 0;