Fix chargen race menu bug, updating a render target from within MyGUI's ControllerManager update is not a good idea

actorid
scrawl 12 years ago
parent 58fce74620
commit 72600a16cf

@ -238,6 +238,12 @@ namespace MWGui
} }
} }
void CharacterCreation::doRenderUpdate()
{
if (mRaceDialog)
mRaceDialog->doRenderUpdate();
}
void CharacterCreation::setPlayerHealth (const MWMechanics::DynamicStat<float>& value) void CharacterCreation::setPlayerHealth (const MWMechanics::DynamicStat<float>& value)
{ {
mPlayerHealth = value; mPlayerHealth = value;

@ -41,6 +41,7 @@ namespace MWGui
void setValue (const std::string& id, const MWMechanics::DynamicStat<float>& value); void setValue (const std::string& id, const MWMechanics::DynamicStat<float>& value);
void setValue(const ESM::Skill::SkillEnum parSkill, const MWMechanics::Stat<float>& value); void setValue(const ESM::Skill::SkillEnum parSkill, const MWMechanics::Stat<float>& value);
void configureSkills (const SkillList& major, const SkillList& minor); void configureSkills (const SkillList& major, const SkillList& minor);
void doRenderUpdate();
private: private:
//Dialogs //Dialogs

@ -32,6 +32,7 @@ namespace MWGui
, mFaceIndex(0) , mFaceIndex(0)
, mHairIndex(0) , mHairIndex(0)
, mCurrentAngle(0) , mCurrentAngle(0)
, mPreviewDirty(true)
{ {
// Centre dialog // Centre dialog
center(); center();
@ -126,6 +127,8 @@ namespace MWGui
mHairIndex = boost::lexical_cast<int>(index) - 1; mHairIndex = boost::lexical_cast<int>(index) - 1;
mPreviewImage->setImageTexture ("CharacterHeadPreview"); mPreviewImage->setImageTexture ("CharacterHeadPreview");
mPreviewDirty = true;
} }
@ -174,6 +177,7 @@ namespace MWGui
float angle = (float(_position) / 49.f - 0.5) * 3.14 * 2; float angle = (float(_position) / 49.f - 0.5) * 3.14 * 2;
float diff = angle - mCurrentAngle; float diff = angle - mCurrentAngle;
mPreview->update (diff); mPreview->update (diff);
mPreviewDirty = true;
mCurrentAngle += diff; mCurrentAngle += diff;
} }
@ -286,6 +290,16 @@ namespace MWGui
record.mHair = mAvailableHairs[mHairIndex]; record.mHair = mAvailableHairs[mHairIndex];
mPreview->setPrototype(record); mPreview->setPrototype(record);
mPreviewDirty = true;
}
void RaceDialog::doRenderUpdate()
{
if (mPreviewDirty)
{
mPreview->render();
mPreviewDirty = false;
}
} }
void RaceDialog::updateRaces() void RaceDialog::updateRaces()

@ -52,6 +52,8 @@ namespace MWGui
*/ */
EventHandle_Void eventBack; EventHandle_Void eventBack;
void doRenderUpdate();
protected: protected:
void onHeadRotate(MyGUI::ScrollBar* _sender, size_t _position); void onHeadRotate(MyGUI::ScrollBar* _sender, size_t _position);
@ -98,6 +100,8 @@ namespace MWGui
float mCurrentAngle; float mCurrentAngle;
MWRender::RaceSelectionPreview* mPreview; MWRender::RaceSelectionPreview* mPreview;
bool mPreviewDirty;
}; };
} }
#endif #endif

@ -1292,6 +1292,7 @@ namespace MWGui
void WindowManager::frameStarted (float dt) void WindowManager::frameStarted (float dt)
{ {
mInventoryWindow->doRenderUpdate (); mInventoryWindow->doRenderUpdate ();
mCharGen->doRenderUpdate();
} }
void WindowManager::updatePlayer() void WindowManager::updatePlayer()

@ -230,7 +230,10 @@ namespace MWRender
mNode->roll(Ogre::Radian(angle), Ogre::SceneNode::TS_LOCAL); mNode->roll(Ogre::Radian(angle), Ogre::SceneNode::TS_LOCAL);
updateCamera(); updateCamera();
}
void RaceSelectionPreview::render()
{
mRenderTarget->update(); mRenderTarget->update();
} }

@ -93,6 +93,7 @@ namespace MWRender
RaceSelectionPreview(); RaceSelectionPreview();
virtual void onSetup(); virtual void onSetup();
void render();
void update(float angle); void update(float angle);

Loading…
Cancel
Save