Hide message boxes when HUD is hidden

dont-compose-content
elsid 4 years ago
parent 4259f7f230
commit d8cd5b361a
No known key found for this signature in database
GPG Key ID: B845CB9FEE18AB40

@ -101,6 +101,8 @@ namespace MWGui
if(stat)
mStaticMessageBox = box;
box->setVisible(mVisible);
mMessageBoxes.push_back(box);
if(mMessageBoxes.size() > 3) {
@ -167,8 +169,12 @@ namespace MWGui
return pressed;
}
void MessageBoxManager::setVisible(bool value)
{
mVisible = value;
for (MessageBox* messageBox : mMessageBoxes)
messageBox->setVisible(value);
}
MessageBox::MessageBox(MessageBoxManager& parMessageBoxManager, const std::string& message)
: Layout("openmw_messagebox.layout")
@ -201,7 +207,10 @@ namespace MWGui
return mMainWidget->getHeight()+mNextBoxPadding;
}
void MessageBox::setVisible(bool value)
{
mMainWidget->setVisible(value);
}
InteractiveMessageBox::InteractiveMessageBox(MessageBoxManager& parMessageBoxManager, const std::string& message, const std::vector<std::string>& buttons)
: WindowModal(MWBase::Environment::get().getWindowManager()->isGuiMode() ? "openmw_interactive_messagebox_notransp.layout" : "openmw_interactive_messagebox.layout")

@ -47,12 +47,15 @@ namespace MWGui
void onButtonPressed(int button) { eventButtonPressed(button); eventButtonPressed.clear(); }
void setVisible(bool value);
private:
std::vector<MessageBox*> mMessageBoxes;
InteractiveMessageBox* mInterMessageBoxe;
MessageBox* mStaticMessageBox;
float mMessageBoxSpeed;
int mLastButtonPressed;
bool mVisible = true;
};
class MessageBox : public Layout
@ -62,6 +65,7 @@ namespace MWGui
void setMessage (const std::string& message);
int getHeight ();
void update (int height);
void setVisible(bool value);
float mCurrentTime;
float mMaxTime;

@ -1499,6 +1499,7 @@ namespace MWGui
{
mHudEnabled = !mHudEnabled;
updateVisible();
mMessageBoxManager->setVisible(mHudEnabled);
return mHudEnabled;
}

Loading…
Cancel
Save