Changed the way screenshots are created (Bug #191)

actorid
Pieter van der Kloet 13 years ago
parent 4fcb721054
commit 17b1546dc1

@ -462,6 +462,28 @@ void OMW::Engine::activate()
}
}
void OMW::Engine::screenshot()
{
// Count screenshots.
int shotCount = 0;
const std::string screenshotPath = mCfgMgr.getLocalConfigPath().string();
// Find the first unused filename with a do-while
std::ostringstream stream;
do
{
// Reset the stream
stream.str("");
stream.clear();
stream << screenshotPath << "screenshot" << std::setw(3) << std::setfill('0') << shotCount++ << ".png";
} while (boost::filesystem::exists(stream.str()));
mOgre->screenshot(stream.str());
}
void OMW::Engine::setCompileAll (bool all)
{
mCompileAll = all;

@ -152,6 +152,9 @@ namespace OMW
/// Activate the focussed object.
void activate();
/// Write screenshot to file.
void screenshot();
/// Compile all scripts (excludign dialogue scripts) at startup?
void setCompileAll (bool all);

@ -83,27 +83,14 @@ namespace MWInput
MWGui::WindowManager &windows;
OMW::Engine& mEngine;
// Count screenshots.
int shotCount;
/* InputImpl Methods */
// Write screenshot to file.
void screenshot()
{
// Find the first unused filename with a do-while
char buf[50];
do
{
snprintf(buf, 50, "screenshot%03d.png", shotCount++);
} while (boost::filesystem::exists(buf));
ogre.screenshot(buf);
mEngine.screenshot();
}
/* toggleInventory() is called when the user presses the button to toggle the inventory screen. */
void toggleInventory()
{

Loading…
Cancel
Save