forked from teamnwah/openmw-tes3coop
Add option to change screenshot image format
This commit is contained in:
parent
7fa3100993
commit
36a90198e2
4 changed files with 8 additions and 6 deletions
|
@ -509,7 +509,7 @@ void OMW::Engine::screenshot()
|
|||
int shotCount = 0;
|
||||
|
||||
const std::string& screenshotPath = mCfgMgr.getUserDataPath().string();
|
||||
|
||||
std::string format = Settings::Manager::getString("screenshot format", "General");
|
||||
// Find the first unused filename with a do-while
|
||||
std::ostringstream stream;
|
||||
do
|
||||
|
@ -518,11 +518,11 @@ void OMW::Engine::screenshot()
|
|||
stream.str("");
|
||||
stream.clear();
|
||||
|
||||
stream << screenshotPath << "screenshot" << std::setw(3) << std::setfill('0') << shotCount++ << ".png";
|
||||
stream << screenshotPath << "screenshot" << std::setw(3) << std::setfill('0') << shotCount++ << "." << format;
|
||||
|
||||
} while (boost::filesystem::exists(stream.str()));
|
||||
|
||||
mOgre->screenshot(stream.str());
|
||||
mOgre->screenshot(stream.str(), format);
|
||||
}
|
||||
|
||||
void OMW::Engine::setCompileAll (bool all)
|
||||
|
|
|
@ -60,6 +60,8 @@ num mipmaps = 8
|
|||
|
||||
shader mode =
|
||||
|
||||
screenshot format = png
|
||||
|
||||
[Shadows]
|
||||
# Shadows are only supported when object shaders are on!
|
||||
enabled = false
|
||||
|
|
|
@ -44,7 +44,7 @@ void OgreRenderer::update(float dt)
|
|||
{
|
||||
}
|
||||
|
||||
void OgreRenderer::screenshot(const std::string &file)
|
||||
void OgreRenderer::screenshot(const std::string &file, const std::string& imageFormat)
|
||||
{
|
||||
/* Since Ogre uses narrow character interfaces, it does not support
|
||||
Unicode paths on Windows. Therefore we had to implement screenshot
|
||||
|
@ -65,7 +65,7 @@ void OgreRenderer::screenshot(const std::string &file)
|
|||
);
|
||||
mWindow->copyContentsToMemory(image.getPixelBox());
|
||||
|
||||
Ogre::DataStreamPtr stream = image.encode("png");
|
||||
Ogre::DataStreamPtr stream = image.encode(imageFormat);
|
||||
Ogre::MemoryDataStream *mem = dynamic_cast<Ogre::MemoryDataStream *>(stream.get());
|
||||
if (mem != 0) { // likely
|
||||
const char *ptr = reinterpret_cast<char *>(mem->getCurrentPtr());
|
||||
|
|
|
@ -108,7 +108,7 @@ namespace OEngine
|
|||
void update(float dt);
|
||||
|
||||
/// Write a screenshot to file
|
||||
void screenshot(const std::string &file);
|
||||
void screenshot(const std::string &file, const std::string& imageFormat);
|
||||
|
||||
float getFPS();
|
||||
|
||||
|
|
Loading…
Reference in a new issue