mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 22:23:51 +00:00
Changed the way screenshots are created (Bug #191)
This commit is contained in:
parent
4fcb721054
commit
17b1546dc1
3 changed files with 26 additions and 14 deletions
|
@ -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)
|
void OMW::Engine::setCompileAll (bool all)
|
||||||
{
|
{
|
||||||
mCompileAll = all;
|
mCompileAll = all;
|
||||||
|
|
|
@ -152,6 +152,9 @@ namespace OMW
|
||||||
/// Activate the focussed object.
|
/// Activate the focussed object.
|
||||||
void activate();
|
void activate();
|
||||||
|
|
||||||
|
/// Write screenshot to file.
|
||||||
|
void screenshot();
|
||||||
|
|
||||||
/// Compile all scripts (excludign dialogue scripts) at startup?
|
/// Compile all scripts (excludign dialogue scripts) at startup?
|
||||||
void setCompileAll (bool all);
|
void setCompileAll (bool all);
|
||||||
|
|
||||||
|
|
|
@ -83,27 +83,14 @@ namespace MWInput
|
||||||
MWGui::WindowManager &windows;
|
MWGui::WindowManager &windows;
|
||||||
OMW::Engine& mEngine;
|
OMW::Engine& mEngine;
|
||||||
|
|
||||||
// Count screenshots.
|
|
||||||
int shotCount;
|
|
||||||
|
|
||||||
|
|
||||||
/* InputImpl Methods */
|
/* InputImpl Methods */
|
||||||
|
|
||||||
// Write screenshot to file.
|
|
||||||
void screenshot()
|
void screenshot()
|
||||||
{
|
{
|
||||||
|
mEngine.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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* toggleInventory() is called when the user presses the button to toggle the inventory screen. */
|
/* toggleInventory() is called when the user presses the button to toggle the inventory screen. */
|
||||||
void toggleInventory()
|
void toggleInventory()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue