Rewrote ScreenSystemOverlay overlay/default.lua to be able to display multiple messages. Added Reload Overlay Screens option to debug menu.

This commit is contained in:
Kyzentun
2014-07-08 01:02:36 -06:00
parent 026f968fa4
commit bee284d0c7
6 changed files with 191 additions and 23 deletions
+15
View File
@@ -548,6 +548,7 @@ static LocalizedString RELOAD ( "ScreenDebugOverlay", "Reload" );
static LocalizedString RESTART ( "ScreenDebugOverlay", "Restart" );
static LocalizedString SCREEN_ON ( "ScreenDebugOverlay", "Send On To Screen" );
static LocalizedString SCREEN_OFF ( "ScreenDebugOverlay", "Send Off To Screen" );
static LocalizedString RELOAD_OVERLAY_SCREENS( "ScreenDebugOverlay", "Reload Overlay Screens" );
static LocalizedString RELOAD_THEME_AND_TEXTURES( "ScreenDebugOverlay", "Reload Theme and Textures" );
static LocalizedString WRITE_PROFILES ( "ScreenDebugOverlay", "Write Profiles" );
static LocalizedString WRITE_PREFERENCES ( "ScreenDebugOverlay", "Write Preferences" );
@@ -1030,6 +1031,19 @@ class DebugLineReloadTheme : public IDebugLine
}
};
class DebugLineReloadOverlayScreens : public IDebugLine
{
virtual RString GetDisplayTitle() { return RELOAD_OVERLAY_SCREENS.GetValue(); }
virtual RString GetDisplayValue() { return RString(); }
virtual bool IsEnabled() { return true; }
virtual RString GetPageName() const { return "Theme"; }
virtual void DoAndLog( RString &sMessageOut )
{
IDebugLine::DoAndLog(sMessageOut);
SCREENMAN->ReloadOverlayScreensAfterInputFinishes();
}
};
class DebugLineWriteProfiles : public IDebugLine
{
virtual RString GetDisplayTitle() { return WRITE_PROFILES.GetValue(); }
@@ -1212,6 +1226,7 @@ DECLARE_ONE( DebugLineRestartCurrentScreen );
DECLARE_ONE( DebugLineCurrentScreenOn );
DECLARE_ONE( DebugLineCurrentScreenOff );
DECLARE_ONE( DebugLineReloadTheme );
DECLARE_ONE( DebugLineReloadOverlayScreens );
DECLARE_ONE( DebugLineWriteProfiles );
DECLARE_ONE( DebugLineWritePreferences );
DECLARE_ONE( DebugLineMenuTimer );
+13
View File
@@ -242,6 +242,7 @@ ScreenManager::ScreenManager()
g_pSharedBGA = new Actor;
m_bReloadOverlayScreensAfterInput= false;
m_bZeroNextUpdate = false;
m_PopTopScreen = SM_Invalid;
m_OnDonePreparingScreen = SM_Invalid;
@@ -330,6 +331,11 @@ void ScreenManager::ReloadOverlayScreens()
this->RefreshCreditsMessages();
}
void ScreenManager::ReloadOverlayScreensAfterInputFinishes()
{
m_bReloadOverlayScreensAfterInput= true;
}
Screen *ScreenManager::GetTopScreen()
{
if( g_ScreenStack.empty() )
@@ -514,7 +520,14 @@ void ScreenManager::Input( const InputEventPlus &input )
// because anybody setting an input callback is probably doing it to
// do something in addition to whatever the screen does.
if(pScreen->PassInputToLua(input) || handled)
{
if(m_bReloadOverlayScreensAfterInput)
{
ReloadOverlayScreens();
m_bReloadOverlayScreensAfterInput= false;
}
return;
}
}
// Pass input to the topmost screen. If we have a new top screen pending, don't
+5
View File
@@ -51,6 +51,7 @@ public:
void RefreshCreditsMessages();
void ThemeChanged();
void ReloadOverlayScreens();
void ReloadOverlayScreensAfterInputFinishes();
/**
* @brief Is this Screen in the main Screen stack, but not the bottommost Screen?
@@ -79,6 +80,10 @@ private:
// operations take a long time, and will cause a skip on the next update.
bool m_bZeroNextUpdate;
// This exists so the debug overlay can reload the overlay screens without seg faulting.
// It's "AfterInput" because the debug overlay carries out actions in Input.
bool m_bReloadOverlayScreensAfterInput;
Screen *MakeNewScreen( const RString &sName );
void LoadDelayedScreen();
bool ActivatePreparedScreenAndBackground( const RString &sScreenName );