mirror of
https://github.com/rwengine/openrw.git
synced 2024-11-07 03:12:36 +01:00
Merge pull request #22 from rcrit/screenshot
Don't hardcode screenshot directory (still hardcodes filename)
This commit is contained in:
commit
238d788c0d
@ -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;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user