forked from teamnwah/openmw-tes3coop
Change texture coordinates when falling back to player_hit_01
This commit is contained in:
parent
9d4af59860
commit
152f415b9a
3 changed files with 22 additions and 12 deletions
|
@ -1,6 +1,7 @@
|
||||||
#include "screenfader.hpp"
|
#include "screenfader.hpp"
|
||||||
|
|
||||||
#include <MyGUI_RenderManager.h>
|
#include <MyGUI_RenderManager.h>
|
||||||
|
#include <MyGUI_ImageBox.h>
|
||||||
|
|
||||||
namespace MWGui
|
namespace MWGui
|
||||||
{
|
{
|
||||||
|
@ -66,20 +67,25 @@ namespace MWGui
|
||||||
mFader->notifyOperationFinished();
|
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)
|
: WindowBase(layout)
|
||||||
, mCurrentAlpha(0.f)
|
, mCurrentAlpha(0.f)
|
||||||
, mFactor(1.f)
|
, mFactor(1.f)
|
||||||
, mRepeat(false)
|
, mRepeat(false)
|
||||||
{
|
{
|
||||||
mMainWidget->setSize(MyGUI::RenderManager::getInstance().getViewSize());
|
mMainWidget->setSize(MyGUI::RenderManager::getInstance().getViewSize());
|
||||||
setTexture(texturePath);
|
|
||||||
setVisible(false);
|
setVisible(false);
|
||||||
}
|
|
||||||
|
|
||||||
void ScreenFader::setTexture(const std::string & texturePath)
|
MyGUI::ImageBox* imageBox = mMainWidget->castType<MyGUI::ImageBox>(false);
|
||||||
{
|
if (imageBox)
|
||||||
mMainWidget->setProperty("ImageTexture", texturePath);
|
{
|
||||||
|
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)
|
void ScreenFader::update(float dt)
|
||||||
|
|
|
@ -36,9 +36,7 @@ namespace MWGui
|
||||||
class ScreenFader : public WindowBase
|
class ScreenFader : public WindowBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ScreenFader(const std::string & texturePath, const std::string& layout = "openmw_screen_fader.layout");
|
ScreenFader(const std::string & texturePath, const std::string& layout = "openmw_screen_fader.layout", const MyGUI::FloatCoord& texCoordOverride = MyGUI::FloatCoord(0,0,1,1));
|
||||||
|
|
||||||
void setTexture(const std::string & texturePath);
|
|
||||||
|
|
||||||
void update(float dt);
|
void update(float dt);
|
||||||
|
|
||||||
|
|
|
@ -330,12 +330,18 @@ namespace MWGui
|
||||||
if (mResourceSystem->getVFS()->exists(werewolfFaderTex))
|
if (mResourceSystem->getVFS()->exists(werewolfFaderTex))
|
||||||
mWerewolfFader = new ScreenFader(werewolfFaderTex);
|
mWerewolfFader = new ScreenFader(werewolfFaderTex);
|
||||||
mBlindnessFader = new ScreenFader("black");
|
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
|
// 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))
|
if(!mResourceSystem->getVFS()->exists(hitFaderTexture))
|
||||||
|
{
|
||||||
hitFaderTexture = "textures\\player_hit_01.dds";
|
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");
|
mScreenFader = new ScreenFader("black");
|
||||||
|
|
||||||
mDebugWindow = new DebugWindow();
|
mDebugWindow = new DebugWindow();
|
||||||
|
|
Loading…
Reference in a new issue