diff --git a/src/MarbleGame.hx b/src/MarbleGame.hx index 01d22d7a..920463b9 100644 --- a/src/MarbleGame.hx +++ b/src/MarbleGame.hx @@ -201,6 +201,7 @@ class MarbleGame { canvas.pushDialog(console); } else { @:privateAccess console.isShowing = false; + console.unfocus(); canvas.popDialog(console, false); } } diff --git a/src/gui/ConsoleDlg.hx b/src/gui/ConsoleDlg.hx index c4e0e1ed..5a0ec3bd 100644 --- a/src/gui/ConsoleDlg.hx +++ b/src/gui/ConsoleDlg.hx @@ -95,6 +95,14 @@ class ConsoleDlg extends GuiControl { consoleInput.text.backgroundColor = 0xFFFFFFFF; consoleInput.text.selectionColor.set(1, 1, 1); consoleInput.text.selectionTile = h2d.Tile.fromColor(0x808080, 0, hxd.Math.ceil(consoleInput.text.font.lineHeight)); + consoleInput.text.onKeyDown = (e) -> { + if (e.keyCode == hxd.Key.QWERTY_TILDE) + e.cancel = true; + } + consoleInput.text.onTextInput = (e) -> { + if (e.charCode == '`'.code) + e.cancel = true; + } this.addChild(consoleInput); @@ -120,6 +128,10 @@ class ConsoleDlg extends GuiControl { scroll.setScrollMax(consoleContent.text.textHeight); } + public function unfocus() { + @:privateAccess consoleInput.text.interactive.blur(); + } + public override function update(dt:Float, mouseState:MouseState) { super.update(dt, mouseState);