github
There are few screen managers for defold:
1)Router - first screen manager, i try it but don’t like how it work
2)New router(my lib) - it contains less function then router, but i like how it work. But i wrote it when i was noob in lua, so it will easy to rewrite it, then to continue development
3)Monarch from britzl. I look inside and using coorutine inside library is cool. Also it contains screen transitions, and it is awesome.
But there is no library that i like to use, so i make another library.
Yet another screen manager for defold.
As any screen manager it can:
1)Change scene
2)Go back
3)Send data for scenes
4)It handle input for scenes. Only top scene have input.
It can’t:
1)Popup scenes(will be added later, when i need this in game)
The main features:
1)Logging.The screen manager can log changing screen logic:what screen was enabled and what was disabled.
Also it can log loading time for screen.
2)You can unload scene or only disable scene when changing. If you have a complex menu with a lot of object, scroll and etc. You don’t need to unload it because user, want see same state when he returned to menu.
3)Using coroutine inside library, which make easy to add new steps when changing scene, for example add transitions like in monarch
Example of log:
DEBUG:SCRIPT: SCREEN_MANAGER:show map
DEBUG:SCRIPT: SCREEN_MANAGER:input for map was acquired
DEBUG:SCRIPT: SCREEN_MANAGER:scene map was loaded
DEBUG:SCRIPT: SCREEN_MANAGER:loading time:0.038729
DEBUG:SCRIPT: SCREEN_MANAGER:scene:map was enable
DEBUG:SCRIPT: SCREEN_MANAGER:scene:map send input:
DEBUG:SCRIPT: nil
ERROR:GAMEOBJECT: Instance '/controller' could not be found when dispatching message 'scene_send_input' sent from main:/router#script
DEBUG:SCRIPT: SCREEN_MANAGER:show game
DEBUG:SCRIPT: SCREEN_MANAGER:input for map was released
DEBUG:SCRIPT: SCREEN_MANAGER:input for game was acquired
DEBUG:SCRIPT: SCREEN_MANAGER:scene game was loaded
DEBUG:SCRIPT: SCREEN_MANAGER:loading time:0.008699
DEBUG:SCRIPT: SCREEN_MANAGER:scene:game was enable
DEBUG:SCRIPT: SCREEN_MANAGER:scene:game send input:
DEBUG:SCRIPT:
{
input = {
lvl = 1,
}
}
DEBUG:SCRIPT: SCREEN_MANAGER:scene:map was disabled
DEBUG:SCRIPT: SCREEN_MANAGER:back
DEBUG:SCRIPT: SCREEN_MANAGER:input for game was released
DEBUG:SCRIPT: SCREEN_MANAGER:input for map was acquired
DEBUG:SCRIPT: SCREEN_MANAGER:scene:map already loaded
DEBUG:SCRIPT: SCREEN_MANAGER:scene:map was enable
DEBUG:SCRIPT: SCREEN_MANAGER:scene:map send input:
DEBUG:SCRIPT: nil
DEBUG:SCRIPT: SCREEN_MANAGER:scene:game was disabled
ERROR:GAMEOBJECT: Instance '/controller' could not be found when dispatching message 'scene_send_input' sent from main:/router#script
little demo: