summaryrefslogtreecommitdiff
path: root/src/game/GameView.cpp
diff options
context:
space:
mode:
authorSimon 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)
commit186e62dec45bc1e606b3a536f4f6689922910b9b (patch)
treeff160ea741f069b6611719b317d3c090289a2584 /src/game/GameView.cpp
parentd6fe7fa2c853f203e924e81242d828cc1fd5f6c0 (diff)
downloadpowder-186e62dec45bc1e606b3a536f4f6689922910b9b.zip
powder-186e62dec45bc1e606b3a536f4f6689922910b9b.tar.gz
Pad frame numbers with zeros for screenshots and recording
Diffstat (limited to 'src/game/GameView.cpp')
-rw-r--r--src/game/GameView.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/game/GameView.cpp b/src/game/GameView.cpp
index dbe7f30..f812358 100644
--- a/src/game/GameView.cpp
+++ b/src/game/GameView.cpp
@@ -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());
}