savegame screenshot has smaller size (configurable)/ screenshots are deleted too
This commit is contained in:
parent
1ac9aa6d3f
commit
91dce63aac
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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){
|
||||
|
|
Loading…
Reference in New Issue