diff options
| author | Simon Robertshaw <simon@hardwired.org.uk> | 2012-08-19 15:55:46 (GMT) |
|---|---|---|
| committer | Simon Robertshaw <simon@hardwired.org.uk> | 2012-08-19 15:55:46 (GMT) |
| commit | 186e62dec45bc1e606b3a536f4f6689922910b9b (patch) | |
| tree | ff160ea741f069b6611719b317d3c090289a2584 /src/cat/LuaScriptInterface.cpp | |
| parent | d6fe7fa2c853f203e924e81242d828cc1fd5f6c0 (diff) | |
| download | powder-186e62dec45bc1e606b3a536f4f6689922910b9b.zip powder-186e62dec45bc1e606b3a536f4f6689922910b9b.tar.gz | |
Pad frame numbers with zeros for screenshots and recording
Diffstat (limited to 'src/cat/LuaScriptInterface.cpp')
| -rw-r--r-- | src/cat/LuaScriptInterface.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/cat/LuaScriptInterface.cpp b/src/cat/LuaScriptInterface.cpp index dc3d5fb..bcf2009 100644 --- a/src/cat/LuaScriptInterface.cpp +++ b/src/cat/LuaScriptInterface.cpp @@ -6,6 +6,7 @@ */ #include <string> +#include <iomanip> #include "Config.h" #include "Format.h" #include "LuaScriptInterface.h" @@ -2083,6 +2084,8 @@ int luatpt_setwindowsize(lua_State* l) return 0; } +int screenshotIndex = 0; + int luatpt_screenshot(lua_State* l) { //TODO Implement @@ -2098,7 +2101,11 @@ int luatpt_screenshot(lua_State* l) VideoBuffer screenshot(luacon_ren->DumpFrame()); data = format::VideoBufferToPNG(screenshot); } - Client::Ref().WriteFile(data, "screenshot.png"); + std::stringstream filename; + filename << "screenshot_"; + filename << std::setfill('0') << std::setw(6) << (screenshotIndex++); + filename << ".png"; + Client::Ref().WriteFile(data, filename.str()); return 0; } |
