Pad frame numbers with zeros for screenshots and recording
This commit is contained in:
parent
d6fe7fa2c8
commit
186e62dec4
@ -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;
|
||||
}
|
||||
|
||||
|
@ -1825,7 +1825,13 @@ void GameView::OnDraw()
|
||||
{
|
||||
VideoBuffer screenshot(ren->DumpFrame());
|
||||
std::vector<char> data = format::VideoBufferToPNG(screenshot);
|
||||
Client::Ref().WriteFile(data, "screenshot_" + format::NumberToString<int>(screenshotIndex++) + ".png");
|
||||
|
||||
std::stringstream filename;
|
||||
filename << "screenshot_";
|
||||
filename << std::setfill('0') << std::setw(6) << (screenshotIndex++);
|
||||
filename << ".png";
|
||||
|
||||
Client::Ref().WriteFile(data, filename.str());
|
||||
doScreenshot = false;
|
||||
}
|
||||
|
||||
@ -1833,7 +1839,13 @@ void GameView::OnDraw()
|
||||
{
|
||||
VideoBuffer screenshot(ren->DumpFrame());
|
||||
std::vector<char> data = format::VideoBufferToPPM(screenshot);
|
||||
Client::Ref().WriteFile(data, "frame_" + format::NumberToString<int>(recordingIndex++) + ".ppm");
|
||||
|
||||
std::stringstream filename;
|
||||
filename << "frame_";
|
||||
filename << std::setfill('0') << std::setw(6) << (recordingIndex++);
|
||||
filename << ".ppm";
|
||||
|
||||
Client::Ref().WriteFile(data, filename.str());
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user