Added AddInputCallback and RemoveInputCallback to Lua API for screen. ScreenManager now passes input to the lua side of each screen in addition to the engine side.

This commit is contained in:
Kyzentun
2014-06-26 21:33:54 -06:00
parent 0b7ca07576
commit 27c6a54d82
9 changed files with 204 additions and 1 deletions
+6 -1
View File
@@ -509,7 +509,11 @@ void ScreenManager::Input( const InputEventPlus &input )
for( unsigned i = 0; i < g_OverlayScreens.size(); ++i )
{
Screen *pScreen = g_OverlayScreens[i];
if( pScreen->Input(input) )
bool handled= pScreen->Input(input);
// Pass input to the screen and lua. Contention shouldn't be a problem
// 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)
return;
}
@@ -522,6 +526,7 @@ void ScreenManager::Input( const InputEventPlus &input )
return;
g_ScreenStack.back().m_pScreen->Input( input );
g_ScreenStack.back().m_pScreen->PassInputToLua( input );
}
// Just create a new screen; don't do any associated cleanup.