Monarch is a Defold screen manager with transition support and a straight forward API
FIX: Screen url detection was not working when nesting collections CHANGE: Calling monarch.post(screen, message_id, message) will only post a message if monarch.on_post(screen, fn) has been called for the screen, regardless if the screen is created through a proxy or factory
FIX: Clarified documentation
FIX: The flag to wait for proxy loaded was not cleared when the proxy was loaded
BREAKING CHANGE: Transitions are now configured through the monarch.on_transition(screen_id, fn)
function. The function defines for which screen to configure transitions and sets a function to be called when a transition should be started. This function must accept (message_id, message, sender) as arguments, with message_id
defining which type of transition to start:
transition_show_in
(constant defined as monarch.TRANSITION.SHOW_IN
)transition_show_out
(constant defined as monarch.TRANSITION.SHOW_OUT
)transition_back_in
(constant defined as monarch.TRANSITION.BACK_IN
)transition_back_out
(constant defined as monarch.TRANSITION.BACK_OUT
)When a transition is completed it is up to the developer to send a transition_done
(constant monarch.TRANSITION.DONE
) message back to the sender to indicate that the transition is completed and that Monarch can continue the navigation sequence.
BREAKING CHANGE: Focus change listeners are now configured through monarch.on_focus_changed(screen_id, fn)
.
NEW: Added on_post(screen_id, fn)
message listener function which will be called when a screen is sent a message using monarch.post()
.
IMPORTANT! You must call monarch.on_message(message_id, message, sender)
from the same script as the above listener setup functions are called.
CHANGE: monarch.unload()
will now unload a preloaded screen regardless if it was preloaded using the editor checkbox or using monarch.preload()
, even with the keep_loaded
option.
FIX: Do not try to unload a preloaded screen which was not shown.
NEW: Added keep_loaded
option to monarch.preload()
. The keep_loaded
option will keep the screen loaded even after a navigation event that would otherwise unload it.
monarch.preload(screen, { keep_loaded = true }, cb)
CHANGE: When a screen is unregistered it will also remove any presence of the screen in the stack
FIX: The time step of a screen below a popup was reset already during the popup transition. The time step should not reset until after the popup has been completely hidden.
FIX: Fixed warnings about two missing variables (had no actual impact on the behaviour of the code)