- allow screenshots to be taken ANY time (in menus etc.) and not only when a game is playing

This commit is contained in:
Mark Vejvoda 2010-10-30 02:24:53 +00:00
parent 77bad3ce07
commit 44563b6f73
2 changed files with 22 additions and 22 deletions

View File

@ -1193,28 +1193,6 @@ void Game::keyDown(char key) {
}
}
}
else if(key == configKeys.getCharKey("Screenshot")) {
string path = GameConstants::folder_path_screenshots;
if(isdir(path.c_str()) == true) {
Config &config= Config::getInstance();
string fileFormat = config.getString("ScreenShotFileType","png");
unsigned int queueSize = Renderer::getInstance().getSaveScreenQueueSize();
for(int i=0; i < 250; ++i) {
path = GameConstants::folder_path_screenshots;
path += "screen" + intToStr(i + queueSize) + "." + fileFormat;
FILE *f= fopen(path.c_str(), "rb");
if(f == NULL) {
Renderer::getInstance().saveScreen(path);
break;
}
else {
fclose(f);
}
}
}
}
//move camera left
else if(key == configKeys.getCharKey("CameraModeLeft")) {
gameCamera.setMoveX(-1);

View File

@ -372,6 +372,28 @@ void MainWindow::eventKeyDown(char key){
Config &config = Config::getInstance();
config.reload();
}
else if(key == configKeys.getCharKey("Screenshot")) {
string path = GameConstants::folder_path_screenshots;
if(isdir(path.c_str()) == true) {
Config &config= Config::getInstance();
string fileFormat = config.getString("ScreenShotFileType","png");
unsigned int queueSize = Renderer::getInstance().getSaveScreenQueueSize();
for(int i=0; i < 250; ++i) {
path = GameConstants::folder_path_screenshots;
path += "screen" + intToStr(i + queueSize) + "." + fileFormat;
FILE *f= fopen(path.c_str(), "rb");
if(f == NULL) {
Renderer::getInstance().saveScreen(path);
break;
}
else {
fclose(f);
}
}
}
}
}
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);