|
|
@ -1,18 +1,21 @@
|
|
|
|
#include "savegamedialog.hpp"
|
|
|
|
#include "savegamedialog.hpp"
|
|
|
|
#include "widgets.hpp"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include <OgreImage.h>
|
|
|
|
|
|
|
|
#include <OgreTextureManager.h>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include <MyGUI_ComboBox.h>
|
|
|
|
#include <MyGUI_ComboBox.h>
|
|
|
|
#include <MyGUI_ImageBox.h>
|
|
|
|
#include <MyGUI_ImageBox.h>
|
|
|
|
#include <MyGUI_ListBox.h>
|
|
|
|
#include <MyGUI_ListBox.h>
|
|
|
|
#include <MyGUI_InputManager.h>
|
|
|
|
#include <MyGUI_InputManager.h>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include <osgDB/ReadFile>
|
|
|
|
|
|
|
|
#include <osg/Texture2D>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include <components/myguiplatform/myguitexture.hpp>
|
|
|
|
|
|
|
|
|
|
|
|
#include <components/misc/stringops.hpp>
|
|
|
|
#include <components/misc/stringops.hpp>
|
|
|
|
|
|
|
|
|
|
|
|
#include <components/settings/settings.hpp>
|
|
|
|
#include <components/settings/settings.hpp>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include <components/files/memorystream.hpp>
|
|
|
|
|
|
|
|
|
|
|
|
#include "../mwbase/statemanager.hpp"
|
|
|
|
#include "../mwbase/statemanager.hpp"
|
|
|
|
#include "../mwbase/environment.hpp"
|
|
|
|
#include "../mwbase/environment.hpp"
|
|
|
|
#include "../mwbase/world.hpp"
|
|
|
|
#include "../mwbase/world.hpp"
|
|
|
@ -22,6 +25,7 @@
|
|
|
|
#include "../mwstate/character.hpp"
|
|
|
|
#include "../mwstate/character.hpp"
|
|
|
|
|
|
|
|
|
|
|
|
#include "confirmationdialog.hpp"
|
|
|
|
#include "confirmationdialog.hpp"
|
|
|
|
|
|
|
|
#include "widgets.hpp"
|
|
|
|
|
|
|
|
|
|
|
|
namespace MWGui
|
|
|
|
namespace MWGui
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -358,30 +362,38 @@ namespace MWGui
|
|
|
|
<< " " << hour << " " << (pm ? "#{sSaveMenuHelp05}" : "#{sSaveMenuHelp04}");
|
|
|
|
<< " " << hour << " " << (pm ? "#{sSaveMenuHelp05}" : "#{sSaveMenuHelp04}");
|
|
|
|
|
|
|
|
|
|
|
|
mInfoText->setCaptionWithReplacing(text.str());
|
|
|
|
mInfoText->setCaptionWithReplacing(text.str());
|
|
|
|
#if 0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Decode screenshot
|
|
|
|
// Decode screenshot
|
|
|
|
std::vector<char> data = mCurrentSlot->mProfile.mScreenshot; // MemoryDataStream doesn't work with const data :(
|
|
|
|
const std::vector<char>& data = mCurrentSlot->mProfile.mScreenshot;
|
|
|
|
Ogre::DataStreamPtr stream(new Ogre::MemoryDataStream(&data[0], data.size()));
|
|
|
|
Files::IMemStream instream (&data[0], data.size());
|
|
|
|
Ogre::Image image;
|
|
|
|
|
|
|
|
image.load(stream, "jpg");
|
|
|
|
osgDB::ReaderWriter* readerwriter = osgDB::Registry::instance()->getReaderWriterForExtension("jpg");
|
|
|
|
|
|
|
|
if (!readerwriter)
|
|
|
|
const std::string textureName = "@savegame_screenshot";
|
|
|
|
{
|
|
|
|
Ogre::TexturePtr texture;
|
|
|
|
std::cerr << "Can't open savegame screenshot, no jpg readerwriter found" << std::endl;
|
|
|
|
texture = Ogre::TextureManager::getSingleton().getByName(textureName);
|
|
|
|
return;
|
|
|
|
mScreenshot->setImageTexture("");
|
|
|
|
}
|
|
|
|
if (texture.isNull())
|
|
|
|
|
|
|
|
|
|
|
|
osgDB::ReaderWriter::ReadResult result = readerwriter->readImage(instream);
|
|
|
|
|
|
|
|
if (!result.success())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
texture = Ogre::TextureManager::getSingleton().createManual(textureName,
|
|
|
|
std::cerr << "Failed to read savegame screenshot: " << result.message() << std::endl;
|
|
|
|
Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
|
|
|
|
return;
|
|
|
|
Ogre::TEX_TYPE_2D,
|
|
|
|
|
|
|
|
image.getWidth(), image.getHeight(), 0, Ogre::PF_BYTE_RGBA, Ogre::TU_DYNAMIC_WRITE_ONLY);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
texture->unload();
|
|
|
|
|
|
|
|
texture->setWidth(image.getWidth());
|
|
|
|
|
|
|
|
texture->setHeight(image.getHeight());
|
|
|
|
|
|
|
|
texture->loadImage(image);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mScreenshot->setImageTexture(textureName);
|
|
|
|
osg::ref_ptr<osg::Texture2D> texture (new osg::Texture2D);
|
|
|
|
#endif
|
|
|
|
texture->setImage(result.getImage());
|
|
|
|
|
|
|
|
texture->setWrap(osg::Texture::WRAP_S, osg::Texture::CLAMP_TO_EDGE);
|
|
|
|
|
|
|
|
texture->setWrap(osg::Texture::WRAP_T, osg::Texture::CLAMP_TO_EDGE);
|
|
|
|
|
|
|
|
texture->setFilter(osg::Texture::MIN_FILTER, osg::Texture::LINEAR);
|
|
|
|
|
|
|
|
texture->setFilter(osg::Texture::MAG_FILTER, osg::Texture::LINEAR);
|
|
|
|
|
|
|
|
texture->setResizeNonPowerOfTwoHint(false);
|
|
|
|
|
|
|
|
texture->setUnRefImageDataAfterApply(true);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mScreenshotTexture.reset(new osgMyGUI::OSGTexture(texture));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mScreenshot->setRenderItemTexture(mScreenshotTexture.get());
|
|
|
|
|
|
|
|
mScreenshot->getSubWidgetMain()->_setUVSet(MyGUI::FloatRect(0.f, 1.f, 1.f, 0.f));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|