Update chat and counter even if there is dialog window opened
This commit is contained in:
parent
72b36e1512
commit
443919b6b7
@ -1183,17 +1183,25 @@ namespace GUIEngine
|
||||
// ---- some menus may need updating
|
||||
if (gamestate != GAME)
|
||||
{
|
||||
bool dialog_opened = false;
|
||||
|
||||
if (ScreenKeyboard::isActive())
|
||||
{
|
||||
ScreenKeyboard::getCurrent()->onUpdate(dt);
|
||||
dialog_opened = true;
|
||||
}
|
||||
else if (ModalDialog::isADialogActive())
|
||||
{
|
||||
ModalDialog::getCurrent()->onUpdate(dt);
|
||||
dialog_opened = true;
|
||||
}
|
||||
else
|
||||
|
||||
Screen* screen = getCurrentScreen();
|
||||
|
||||
if (screen != NULL &&
|
||||
(!dialog_opened || screen->getUpdateInBackground()))
|
||||
{
|
||||
getCurrentScreen()->onUpdate(elapsed_time);
|
||||
screen->onUpdate(elapsed_time);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -58,6 +58,7 @@ Screen::Screen(const char* file, bool pause_race)
|
||||
m_render_3d = false;
|
||||
m_loaded = false;
|
||||
m_pause_race = pause_race;
|
||||
m_update_in_background = false;
|
||||
} // Screen
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
@ -71,6 +72,7 @@ Screen::Screen(bool pause_race)
|
||||
m_loaded = false;
|
||||
m_render_3d = false;
|
||||
m_pause_race = pause_race;
|
||||
m_update_in_background = false;
|
||||
} // Screen
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
@ -113,6 +113,11 @@ namespace GUIEngine
|
||||
/** to catch errors as early as possible, for debugging purposes only */
|
||||
unsigned int m_magic_number;
|
||||
|
||||
/** When set to true it updates the screen even if modal dialog is
|
||||
* opened
|
||||
*/
|
||||
bool m_update_in_background;
|
||||
|
||||
protected:
|
||||
bool m_throttle_FPS;
|
||||
|
||||
@ -155,6 +160,12 @@ namespace GUIEngine
|
||||
void manualAddWidget(Widget* w);
|
||||
|
||||
void manualRemoveWidget(Widget* w);
|
||||
|
||||
/** When set to true it updates the screen even if modal dialog is
|
||||
* opened
|
||||
*/
|
||||
void setUpdateInBackground(bool value) {m_update_in_background = value;}
|
||||
bool getUpdateInBackground() {return m_update_in_background;}
|
||||
|
||||
/** \return the name of this menu (which is the name of the file) */
|
||||
const std::string& getName() const { return m_filename; }
|
||||
|
@ -75,6 +75,9 @@ NetworkingLobby::NetworkingLobby() : Screen("online/networking_lobby.stkgui")
|
||||
m_chat_box = NULL;
|
||||
m_send_button = NULL;
|
||||
m_icon_bank = NULL;
|
||||
|
||||
// Allows to update chat and counter even if dialog window is opened
|
||||
setUpdateInBackground(true);
|
||||
} // NetworkingLobby
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user