diff options
author | Perttu Ahola <celeron55@gmail.com> | 2011-06-26 19:33:40 +0300 |
---|---|---|
committer | Perttu Ahola <celeron55@gmail.com> | 2011-06-26 19:33:40 +0300 |
commit | 7e59938c5468a948634d93adaa61a71d383852ff (patch) | |
tree | cc6b22fe716ac30a084f332b9534a7121b584c39 /src/game.cpp | |
parent | 5e3deed67232cfa67471536814fc0fd61e93011f (diff) | |
download | minetest-7e59938c5468a948634d93adaa61a71d383852ff.tar.gz minetest-7e59938c5468a948634d93adaa61a71d383852ff.tar.bz2 minetest-7e59938c5468a948634d93adaa61a71d383852ff.zip |
added screenshot key F12 (from spongie)
Diffstat (limited to 'src/game.cpp')
-rw-r--r-- | src/game.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/game.cpp b/src/game.cpp index 59f14d37d..3197985e6 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -1246,6 +1246,25 @@ void the_game( chat_lines.push_back(ChatLine(L"frametime_graph enabled")); } } + else if(input->wasKeyDown(getKeySetting("keymap_screenshot"))) + { + irr::video::IImage* const image = driver->createScreenShot(); + if (image) { + irr::c8 filename[256]; + snprintf(filename, 256, "%s/screenshot_%u.png", + g_settings.get("screenshot_path").c_str(), + device->getTimer()->getRealTime()); + if (driver->writeImageToFile(image, filename)) { + std::wstringstream sstr; + sstr<<"Saved screenshot to '"<<filename<<"'"; + dstream<<"Saved screenshot to '"<<filename<<"'"<<std::endl; + chat_lines.push_back(ChatLine(sstr.str())); + } else{ + dstream<<"Failed to save screenshot '"<<filename<<"'"<<std::endl; + } + image->drop(); + } + } // Item selection with mouse wheel { |