forked from teamnwah/openmw-tes3coop
Remember pressed message box button longer
Remember which button was pressed until a new interactive message box is displayed or until the pressed button number is read. Before that, it was not possible to get the pressed button after the message box was hidden/destroyed.
This commit is contained in:
parent
db7ea30483
commit
ba4b8a37e2
2 changed files with 8 additions and 8 deletions
|
@ -14,6 +14,7 @@ namespace MWGui
|
|||
mMessageBoxSpeed = 0.1;
|
||||
mInterMessageBoxe = NULL;
|
||||
mStaticMessageBox = NULL;
|
||||
mLastButtonPressed = -1;
|
||||
}
|
||||
|
||||
void MessageBoxManager::onFrame (float frameDuration)
|
||||
|
@ -62,6 +63,7 @@ namespace MWGui
|
|||
}
|
||||
|
||||
if(mInterMessageBoxe != NULL && mInterMessageBoxe->mMarkedToDelete) {
|
||||
mLastButtonPressed = mInterMessageBoxe->readPressedButton();
|
||||
delete mInterMessageBoxe;
|
||||
mInterMessageBoxe = NULL;
|
||||
MWBase::Environment::get().getInputManager()->changeInputMode(
|
||||
|
@ -107,6 +109,7 @@ namespace MWGui
|
|||
}
|
||||
|
||||
mInterMessageBoxe = new InteractiveMessageBox(*this, message, buttons);
|
||||
mLastButtonPressed = -1;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -154,11 +157,9 @@ namespace MWGui
|
|||
|
||||
int MessageBoxManager::readPressedButton ()
|
||||
{
|
||||
if(mInterMessageBoxe != NULL)
|
||||
{
|
||||
return mInterMessageBoxe->readPressedButton();
|
||||
}
|
||||
return -1;
|
||||
int pressed = mLastButtonPressed;
|
||||
mLastButtonPressed = -1;
|
||||
return pressed;
|
||||
}
|
||||
|
||||
|
||||
|
@ -421,9 +422,7 @@ namespace MWGui
|
|||
|
||||
int InteractiveMessageBox::readPressedButton ()
|
||||
{
|
||||
int pressed = mButtonPressed;
|
||||
mButtonPressed = -1;
|
||||
return pressed;
|
||||
return mButtonPressed;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -56,6 +56,7 @@ namespace MWGui
|
|||
MessageBox* mStaticMessageBox;
|
||||
std::vector<MessageBoxManagerTimer> mTimers;
|
||||
float mMessageBoxSpeed;
|
||||
int mLastButtonPressed;
|
||||
};
|
||||
|
||||
class MessageBox : public OEngine::GUI::Layout
|
||||
|
|
Loading…
Reference in a new issue