NAT playground confirm ESCAPE for exit
This commit is contained in:
@@ -108,6 +108,7 @@
|
|||||||
(method :Void hidePrefixMap []
|
(method :Void hidePrefixMap []
|
||||||
(clearUI))
|
(clearUI))
|
||||||
|
|
||||||
|
(prop &mut :Bool confirmQuit false)
|
||||||
(defAlias &ident sh (cast shortcutHandler FlxKeyShortcutHandler<Dynamic>))
|
(defAlias &ident sh (cast shortcutHandler FlxKeyShortcutHandler<Dynamic>))
|
||||||
(method &override :Void update [:Float elapsed]
|
(method &override :Void update [:Float elapsed]
|
||||||
(super.update elapsed)
|
(super.update elapsed)
|
||||||
@@ -131,19 +132,22 @@
|
|||||||
// This part is hacky...
|
// This part is hacky...
|
||||||
(set lastUI textInputLabel)
|
(set lastUI textInputLabel)
|
||||||
(hideUI textInputLabel))
|
(hideUI textInputLabel))
|
||||||
(sh.currentMap
|
(~sh.currentMap
|
||||||
(sh.cancel))
|
(sh.cancel))
|
||||||
(true (Sys.exit 0))))
|
(confirmQuit
|
||||||
|
(Sys.exit 0))
|
||||||
|
(true
|
||||||
|
(displayMessage "Really quit?")
|
||||||
|
(set confirmQuit true))))
|
||||||
|
|
||||||
// Press ENTER to type a command to run
|
// Press ENTER to type a command to run
|
||||||
(when (and !textInput FlxG.keys.justPressed.ENTER)
|
(when (and !textInput FlxG.keys.justPressed.ENTER)
|
||||||
|
(set confirmQuit false)
|
||||||
(typeCommand))
|
(typeCommand))
|
||||||
(when (and textInput !textInput.alive)
|
(when (and textInput !textInput.alive)
|
||||||
(set textInput null))
|
(set textInput null))
|
||||||
|
|
||||||
// Press ESCAPE to clear the UI and cancel any input
|
|
||||||
(when FlxG.keys.justPressed.ESCAPE
|
|
||||||
(clearUI))
|
|
||||||
|
|
||||||
// Scroll the UI with the mouse:
|
// Scroll the UI with the mouse:
|
||||||
(var UI_SCROLL_FACTOR 2)
|
(var UI_SCROLL_FACTOR 2)
|
||||||
@@ -167,6 +171,7 @@
|
|||||||
// Don't check keys that can be used in shortcuts outside this block:
|
// Don't check keys that can be used in shortcuts outside this block:
|
||||||
(unless (or sh.currentMap (and textInput textInput.hasFocus))
|
(unless (or sh.currentMap (and textInput textInput.hasFocus))
|
||||||
(when FlxG.keys.justPressed.SEMICOLON
|
(when FlxG.keys.justPressed.SEMICOLON
|
||||||
|
(set confirmQuit false)
|
||||||
(sh.start)
|
(sh.start)
|
||||||
(return))
|
(return))
|
||||||
// +/- keys to change an entry's z
|
// +/- keys to change an entry's z
|
||||||
|
Reference in New Issue
Block a user