diff --git a/source/glest_game/game/game.cpp b/source/glest_game/game/game.cpp index df858e61..eae182ce 100644 --- a/source/glest_game/game/game.cpp +++ b/source/glest_game/game/game.cpp @@ -3457,6 +3457,7 @@ void Game::toggleTeamColorMarker() { } string Game::saveGame(string name) { + Config &config= Config::getInstance(); // auto name file if using saved file pattern string if(name == GameConstants::saveGameFilePattern) { time_t curTime = time(NULL); @@ -3625,7 +3626,7 @@ string Game::saveGame(string name) { saveGameFile = getGameReadWritePath(GameConstants::path_logs_CacheLookupKey) + saveGameFile; } else { - string userData = Config::getInstance().getString("UserData_Root",""); + string userData = config.getString("UserData_Root",""); if(userData != "") { endPathWithSlash(userData); } @@ -3637,7 +3638,7 @@ string Game::saveGame(string name) { if(masterserverMode == false) { // take Screenshot string jpgFileName=saveGameFile+".jpg"; - Renderer::getInstance().saveScreen(jpgFileName); + Renderer::getInstance().saveScreen(jpgFileName,config.getInt("SaveGameScreenshotWidth","800"),config.getInt("SaveGameScreenshotHeight","600")); } return saveGameFile; diff --git a/source/glest_game/graphics/renderer.cpp b/source/glest_game/graphics/renderer.cpp index d568f438..0db23974 100644 --- a/source/glest_game/graphics/renderer.cpp +++ b/source/glest_game/graphics/renderer.cpp @@ -6462,12 +6462,12 @@ Texture2D *Renderer::saveScreenToTexture(int x, int y, int width, int height) { return texture; } -void Renderer::saveScreen(const string &path) { +void Renderer::saveScreen(const string &path,int w, int h) { const Metrics &sm= Metrics::getInstance(); if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); - Pixmap2D *pixmapScreenShot = new Pixmap2D(sm.getScreenW(), sm.getScreenH(), 3); + Pixmap2D *pixmapScreenShot = new Pixmap2D(sm.getScreenW(),sm.getScreenH(), 3); if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); //glFinish(); @@ -6478,6 +6478,13 @@ void Renderer::saveScreen(const string &path) { glReadPixels(0, 0, pixmapScreenShot->getW(), pixmapScreenShot->getH(), GL_RGB, GL_UNSIGNED_BYTE, pixmapScreenShot->getPixels()); + if(w==0 || h==0){ + h=sm.getScreenH(); + w=sm.getScreenW(); + } + else{ + pixmapScreenShot->Scale(GL_RGB,w,h); + } if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); glPixelStorei(GL_UNPACK_ALIGNMENT, 1); diff --git a/source/glest_game/graphics/renderer.h b/source/glest_game/graphics/renderer.h index c94cc381..f31680fb 100644 --- a/source/glest_game/graphics/renderer.h +++ b/source/glest_game/graphics/renderer.h @@ -531,7 +531,7 @@ public: //misc void loadConfig(); - void saveScreen(const string &path); + void saveScreen(const string &path,int w=0, int h=0); Quad2i getVisibleQuad() const {return visibleQuad;} Quad2i getVisibleQuadFromCamera() const {return visibleQuadFromCamera;} void renderTeamColorPlane(); diff --git a/source/glest_game/menu/menu_state_load_game.cpp b/source/glest_game/menu/menu_state_load_game.cpp index 5b3a7e83..d1e2c50c 100644 --- a/source/glest_game/menu/menu_state_load_game.cpp +++ b/source/glest_game/menu/menu_state_load_game.cpp @@ -214,6 +214,10 @@ void MenuStateLoadGame::mouseClick(int x, int y, MouseButton mouseButton){ if(slots[i] == selectedButton) { //deleteSlot(i); if(removeFile(filename) == true) { + removeFile(jpgfilename); + needsToBeFreedTexture=previewTexture; + previewTexture=NULL; + infoTextLabel.setText(""); listFiles(); slotsScrollBar.setElementCount(filenames.size()); } @@ -377,7 +381,7 @@ void MenuStateLoadGame::render(){ } - renderer.renderConsole(&console,false,true); + renderer.renderConsole(&console,false,false); if(program != NULL) program->renderProgramMsgBox(); if(needsToBeFreedTexture!=NULL){