fix console tilde thing

This commit is contained in:
RandomityGuy 2023-05-25 01:00:39 +05:30
parent 43c9d64f33
commit 8b28d74e04
2 changed files with 13 additions and 0 deletions

View file

@ -201,6 +201,7 @@ class MarbleGame {
canvas.pushDialog(console);
} else {
@:privateAccess console.isShowing = false;
console.unfocus();
canvas.popDialog(console, false);
}
}

View file

@ -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);