Call WindowBase::onFrame() for every active window

pull/303/head
scrawl 7 years ago
parent ba7ae2663f
commit 2b03bc0c56

@ -116,8 +116,9 @@ void CompanionWindow::setPtr(const MWWorld::Ptr& npc)
setTitle(npc.getClass().getName(npc)); setTitle(npc.getClass().getName(npc));
} }
void CompanionWindow::onFrame() void CompanionWindow::onFrame(float dt)
{ {
checkReferenceAvailable();
updateEncumbranceBar(); updateEncumbranceBar();
} }

@ -23,7 +23,7 @@ namespace MWGui
virtual void resetReference(); virtual void resetReference();
void setPtr(const MWWorld::Ptr& npc); void setPtr(const MWWorld::Ptr& npc);
void onFrame (); void onFrame (float dt);
private: private:
ItemView* mItemView; ItemView* mItemView;

@ -42,6 +42,8 @@ namespace MWGui
virtual void onOpen(); virtual void onOpen();
virtual void onClose(); virtual void onClose();
void onFrame(float dt) { checkReferenceAvailable(); }
void setFont(const std::string &fntName); void setFont(const std::string &fntName);
void onResChange(int width, int height); void onResChange(int width, int height);

@ -36,6 +36,8 @@ namespace MWGui
void setPtr(const MWWorld::Ptr& container); void setPtr(const MWWorld::Ptr& container);
virtual void onClose(); virtual void onClose();
void onFrame(float dt) { checkReferenceAvailable(); }
virtual void resetReference(); virtual void resetReference();
private: private:

@ -630,9 +630,10 @@ namespace MWGui
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Dialogue); MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Dialogue);
} }
void DialogueWindow::onFrame() void DialogueWindow::onFrame(float dt)
{ {
if(mMainWidget->getVisible() && mPtr.getTypeName() == typeid(ESM::NPC).name()) checkReferenceAvailable();
if(mPtr.getTypeName() == typeid(ESM::NPC).name())
{ {
int disp = MWBase::Environment::get().getMechanicsManager()->getDerivedDisposition(mPtr); int disp = MWBase::Environment::get().getMechanicsManager()->getDerivedDisposition(mPtr);
mDispositionBar->setProgressRange(100); mDispositionBar->setProgressRange(100);

@ -117,7 +117,7 @@ namespace MWGui
void clearChoices(); void clearChoices();
void goodbye(); void goodbye();
void onFrame(); void onFrame(float dt);
// make sure to call these before setKeywords() // make sure to call these before setKeywords()
void setServices(int services) { mServices = services; } void setServices(int services) { mServices = services; }

@ -21,6 +21,8 @@ namespace MWGui
virtual void onOpen(); virtual void onOpen();
void onFrame(float dt) { checkReferenceAvailable(); }
void setSoulGem (const MWWorld::Ptr& gem); void setSoulGem (const MWWorld::Ptr& gem);
void setItem (const MWWorld::Ptr& item); void setItem (const MWWorld::Ptr& item);

@ -589,11 +589,8 @@ namespace MWGui
mEncumbranceBar->setValue(static_cast<int>(encumbrance), static_cast<int>(capacity)); mEncumbranceBar->setValue(static_cast<int>(encumbrance), static_cast<int>(capacity));
} }
void InventoryWindow::onFrame() void InventoryWindow::onFrame(float dt)
{ {
if (!mMainWidget->getVisible())
return;
updateEncumbranceBar(); updateEncumbranceBar();
} }

@ -40,7 +40,7 @@ namespace MWGui
/// start trading, disables item drag&drop /// start trading, disables item drag&drop
void setTrading(bool trading); void setTrading(bool trading);
void onFrame(); void onFrame(float dt);
void pickUpObject (MWWorld::Ptr object); void pickUpObject (MWWorld::Ptr object);

@ -197,7 +197,7 @@ namespace MWGui
} }
} }
void MainMenu::update(float dt) void MainMenu::onFrame(float dt)
{ {
if (mVideo) if (mVideo)
{ {

@ -36,7 +36,7 @@ namespace MWGui
virtual void setVisible (bool visible); virtual void setVisible (bool visible);
void update(float dt); void onFrame(float dt);
private: private:
const VFS::Manager* mVFS; const VFS::Manager* mVFS;

@ -28,6 +28,8 @@ namespace MWGui
void setPtr(const MWWorld::Ptr& actor); void setPtr(const MWWorld::Ptr& actor);
void setPtr(const MWWorld::Ptr& actor, int startOffset); void setPtr(const MWWorld::Ptr& actor, int startOffset);
void onFrame(float dt) { checkReferenceAvailable(); }
protected: protected:
MyGUI::Button* mCancelButton; MyGUI::Button* mCancelButton;
MyGUI::TextBox* mPlayerGold; MyGUI::TextBox* mPlayerGold;

@ -152,6 +152,8 @@ namespace MWGui
virtual void onOpen(); virtual void onOpen();
void onFrame(float dt) { checkReferenceAvailable(); }
void setPtr(const MWWorld::Ptr& actor); void setPtr(const MWWorld::Ptr& actor);
protected: protected:

@ -68,16 +68,13 @@ namespace MWGui
} }
void SpellWindow::onFrame(float dt) void SpellWindow::onFrame(float dt)
{ {
if (mMainWidget->getVisible()) NoDrop::onFrame(dt);
mUpdateTimer += dt;
if (0.5f < mUpdateTimer)
{ {
NoDrop::onFrame(dt); mUpdateTimer = 0;
mUpdateTimer += dt; mSpellView->incrementalUpdate();
if (0.5f < mUpdateTimer)
{
mUpdateTimer = 0;
mSpellView->incrementalUpdate();
}
} }
} }

@ -297,9 +297,6 @@ namespace MWGui
void StatsWindow::onFrame (float dt) void StatsWindow::onFrame (float dt)
{ {
if (!mMainWidget->getVisible())
return;
NoDrop::onFrame(dt); NoDrop::onFrame(dt);
MWWorld::Ptr player = MWMechanics::getPlayer(); MWWorld::Ptr player = MWMechanics::getPlayer();

@ -142,6 +142,11 @@ namespace MWGui
onFilterChanged(mFilterAll); onFilterChanged(mFilterAll);
} }
void TradeWindow::onFrame(float dt)
{
checkReferenceAvailable();
}
void TradeWindow::onFilterChanged(MyGUI::Widget* _sender) void TradeWindow::onFilterChanged(MyGUI::Widget* _sender)
{ {
if (_sender == mFilterAll) if (_sender == mFilterAll)

@ -29,6 +29,8 @@ namespace MWGui
void setPtr(const MWWorld::Ptr& actor); void setPtr(const MWWorld::Ptr& actor);
void onFrame(float dt);
void borrowItem (int index, size_t count); void borrowItem (int index, size_t count);
void returnItem (int index, size_t count); void returnItem (int index, size_t count);

@ -195,6 +195,7 @@ namespace MWGui
void TrainingWindow::onFrame(float dt) void TrainingWindow::onFrame(float dt)
{ {
checkReferenceAvailable();
mTimeAdvancer.onFrame(dt); mTimeAdvancer.onFrame(dt);
if (mFadeTimeRemaining <= 0) if (mFadeTimeRemaining <= 0)

@ -29,6 +29,9 @@ namespace MWGui
/// Open this object in the GUI, for windows that support it /// Open this object in the GUI, for windows that support it
virtual void setPtr(const MWWorld::Ptr& ptr) {} virtual void setPtr(const MWWorld::Ptr& ptr) {}
/// Called every frame if the window is in an active GUI mode
virtual void onFrame(float duration) {}
/// Notify that window has been made visible /// Notify that window has been made visible
virtual void onOpen() {} virtual void onOpen() {}
/// Notify that window has been hidden /// Notify that window has been hidden

@ -890,12 +890,19 @@ namespace MWGui
void WindowManager::onFrame (float frameDuration) void WindowManager::onFrame (float frameDuration)
{ {
if (!mGuiModes.empty())
{
GuiModeState& state = mGuiModeStates[mGuiModes.back()];
for (WindowBase* window : state.mWindows)
window->onFrame(frameDuration);
}
if (!mCurrentModals.empty())
mCurrentModals.top()->onFrame(frameDuration);
mMessageBoxManager->onFrame(frameDuration); mMessageBoxManager->onFrame(frameDuration);
mToolTips->onFrame(frameDuration); mToolTips->onFrame(frameDuration);
mMenu->update(frameDuration);
if (mLocalMapRender) if (mLocalMapRender)
mLocalMapRender->cleanupCameras(); mLocalMapRender->cleanupCameras();
@ -909,34 +916,10 @@ namespace MWGui
mDragAndDrop->mDraggedWidget->setPosition(MyGUI::InputManager::getInstance().getMousePosition()); mDragAndDrop->mDraggedWidget->setPosition(MyGUI::InputManager::getInstance().getMousePosition());
} }
mDialogueWindow->onFrame();
mInventoryWindow->onFrame();
updateMap(); updateMap();
mStatsWindow->onFrame(frameDuration);
mMap->onFrame(frameDuration);
mSpellWindow->onFrame(frameDuration);
mWaitDialog->onFrame(frameDuration);
mHud->onFrame(frameDuration); mHud->onFrame(frameDuration);
mTrainingWindow->onFrame (frameDuration);
mTrainingWindow->checkReferenceAvailable();
mDialogueWindow->checkReferenceAvailable();
mTradeWindow->checkReferenceAvailable();
mSpellBuyingWindow->checkReferenceAvailable();
mSpellCreationDialog->checkReferenceAvailable();
mEnchantingDialog->checkReferenceAvailable();
mContainerWindow->checkReferenceAvailable();
mCompanionWindow->checkReferenceAvailable();
mConsole->checkReferenceAvailable();
mCompanionWindow->onFrame();
mJailScreen->onFrame(frameDuration);
if (mWerewolfFader) if (mWerewolfFader)
mWerewolfFader->update(frameDuration); mWerewolfFader->update(frameDuration);
mBlindnessFader->update(frameDuration); mBlindnessFader->update(frameDuration);

Loading…
Cancel
Save