From 936564befc83bfff520afea4dd2a2e86bb378ade Mon Sep 17 00:00:00 2001 From: RandomityGuy <31925790+RandomityGuy@users.noreply.github.com> Date: Fri, 7 Jun 2024 20:58:25 +0530 Subject: [PATCH] fix caret color --- src/gui/EnterNameDlg.hx | 1 + src/gui/GuiTextInput.hx | 5 +++++ src/gui/ReplayNameDlg.hx | 1 + 3 files changed, 7 insertions(+) diff --git a/src/gui/EnterNameDlg.hx b/src/gui/EnterNameDlg.hx index bdc2df65..bf68b74a 100644 --- a/src/gui/EnterNameDlg.hx +++ b/src/gui/EnterNameDlg.hx @@ -51,6 +51,7 @@ class EnterNameDlg extends GuiImage { textInput.horizSizing = Width; textInput.vertSizing = Height; textInput.text.textColor = 0xEBEBEB; + textInput.setCaretColor(0xEBEBEB); textInput.text.selectionColor.setColor(0x8DFF8D); textInput.text.selectionTile = h2d.Tile.fromColor(0x88BCEE, 0, hxd.Math.ceil(textInput.text.font.lineHeight)); textFrame.addChild(textInput); diff --git a/src/gui/GuiTextInput.hx b/src/gui/GuiTextInput.hx index 437fbac8..a4de3742 100644 --- a/src/gui/GuiTextInput.hx +++ b/src/gui/GuiTextInput.hx @@ -77,4 +77,9 @@ class GuiTextInput extends GuiControl { text.focus(); #end } + + public function setCaretColor(col:Int) { + text.cursorTile = h2d.Tile.fromColor(col, Std.int(1 / hxd.Window.getInstance().windowToPixelRatio), text.font.size); + text.cursorTile.dy = 2 / hxd.Window.getInstance().windowToPixelRatio; + } } diff --git a/src/gui/ReplayNameDlg.hx b/src/gui/ReplayNameDlg.hx index c6caee69..c4ea3276 100644 --- a/src/gui/ReplayNameDlg.hx +++ b/src/gui/ReplayNameDlg.hx @@ -48,6 +48,7 @@ class ReplayNameDlg extends GuiImage { textInput.horizSizing = Width; textInput.vertSizing = Height; textInput.text.textColor = 0xEBEBEB; + textInput.setCaretColor(0xEBEBEB); textInput.text.selectionColor.setColor(0x8DFF8D); textInput.text.selectionTile = h2d.Tile.fromColor(0x88BCEE, 0, hxd.Math.ceil(textInput.text.font.lineHeight)); textFrame.addChild(textInput);