1
0
mirror of https://github.com/rwengine/openrw.git synced 2024-09-15 06:52:34 +02:00

Merge pull request #22 from rcrit/screenshot

Don't hardcode screenshot directory (still hardcodes filename)
This commit is contained in:
Daniel Evans 2016-05-19 19:41:21 +01:00
commit 238d788c0d

View File

@ -794,9 +794,18 @@ void RWGame::globalKeyEvent(const sf::Event& event)
case sf::Keyboard::F3:
showDebugPhysics = ! showDebugPhysics;
break;
case sf::Keyboard::F12:
window.capture().saveToFile("/home/dan/screenshot.png");
case sf::Keyboard::F12: {
auto homedir = getenv("HOME");
if( homedir == nullptr ) {
std::cerr << "Unable to determine home directory for screenshot" << std::endl;
break;
}
std::string savePath(homedir);
std::string path = savePath+"/screenshot.png";
window.capture().saveToFile(path);
break;
}
default: break;
}
}