Change texture coordinates when falling back to player_hit_01

openmw-38
scrawl 9 years ago
parent 9d4af59860
commit 152f415b9a

@ -1,6 +1,7 @@
#include "screenfader.hpp"
#include <MyGUI_RenderManager.h>
#include <MyGUI_ImageBox.h>
namespace MWGui
{
@ -66,20 +67,25 @@ namespace MWGui
mFader->notifyOperationFinished();
}
ScreenFader::ScreenFader(const std::string & texturePath, const std::string& layout)
ScreenFader::ScreenFader(const std::string & texturePath, const std::string& layout, const MyGUI::FloatCoord& texCoordOverride)
: WindowBase(layout)
, mCurrentAlpha(0.f)
, mFactor(1.f)
, mRepeat(false)
{
mMainWidget->setSize(MyGUI::RenderManager::getInstance().getViewSize());
setTexture(texturePath);
setVisible(false);
}
void ScreenFader::setTexture(const std::string & texturePath)
{
mMainWidget->setProperty("ImageTexture", texturePath);
MyGUI::ImageBox* imageBox = mMainWidget->castType<MyGUI::ImageBox>(false);
if (imageBox)
{
imageBox->setImageTexture(texturePath);
const MyGUI::IntSize imageSize = imageBox->getImageSize();
imageBox->setImageCoord(MyGUI::IntCoord(texCoordOverride.left * imageSize.width,
texCoordOverride.top * imageSize.height,
texCoordOverride.width * imageSize.width,
texCoordOverride.height * imageSize.height));
}
}
void ScreenFader::update(float dt)

@ -36,9 +36,7 @@ namespace MWGui
class ScreenFader : public WindowBase
{
public:
ScreenFader(const std::string & texturePath, const std::string& layout = "openmw_screen_fader.layout");
void setTexture(const std::string & texturePath);
ScreenFader(const std::string & texturePath, const std::string& layout = "openmw_screen_fader.layout", const MyGUI::FloatCoord& texCoordOverride = MyGUI::FloatCoord(0,0,1,1));
void update(float dt);

@ -330,12 +330,18 @@ namespace MWGui
if (mResourceSystem->getVFS()->exists(werewolfFaderTex))
mWerewolfFader = new ScreenFader(werewolfFaderTex);
mBlindnessFader = new ScreenFader("black");
std::string hitFaderTexture = "textures\\bm_player_hit_01.dds";
// fall back to player_hit_01.dds if bm_player_hit_01.dds is not available
// TODO: check if non-BM versions actually use player_hit_01.dds
std::string hitFaderTexture = "textures\\bm_player_hit_01.dds";
const std::string hitFaderLayout = "openmw_screen_fader_hit.layout";
MyGUI::FloatCoord hitFaderCoord (0,0,1,1);
if(!mResourceSystem->getVFS()->exists(hitFaderTexture))
{
hitFaderTexture = "textures\\player_hit_01.dds";
mHitFader = new ScreenFader(hitFaderTexture, "openmw_screen_fader_hit.layout");
hitFaderCoord = MyGUI::FloatCoord(0.2, 0.25, 0.6, 0.5);
}
mHitFader = new ScreenFader(hitFaderTexture, hitFaderLayout, hitFaderCoord);
mScreenFader = new ScreenFader("black");
mDebugWindow = new DebugWindow();

Loading…
Cancel
Save