fix caret color

This commit is contained in:
RandomityGuy 2024-06-07 20:58:25 +05:30
parent 0c003189e7
commit 936564befc
3 changed files with 7 additions and 0 deletions

View file

@ -51,6 +51,7 @@ class EnterNameDlg extends GuiImage {
textInput.horizSizing = Width; textInput.horizSizing = Width;
textInput.vertSizing = Height; textInput.vertSizing = Height;
textInput.text.textColor = 0xEBEBEB; textInput.text.textColor = 0xEBEBEB;
textInput.setCaretColor(0xEBEBEB);
textInput.text.selectionColor.setColor(0x8DFF8D); textInput.text.selectionColor.setColor(0x8DFF8D);
textInput.text.selectionTile = h2d.Tile.fromColor(0x88BCEE, 0, hxd.Math.ceil(textInput.text.font.lineHeight)); textInput.text.selectionTile = h2d.Tile.fromColor(0x88BCEE, 0, hxd.Math.ceil(textInput.text.font.lineHeight));
textFrame.addChild(textInput); textFrame.addChild(textInput);

View file

@ -77,4 +77,9 @@ class GuiTextInput extends GuiControl {
text.focus(); text.focus();
#end #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;
}
} }

View file

@ -48,6 +48,7 @@ class ReplayNameDlg extends GuiImage {
textInput.horizSizing = Width; textInput.horizSizing = Width;
textInput.vertSizing = Height; textInput.vertSizing = Height;
textInput.text.textColor = 0xEBEBEB; textInput.text.textColor = 0xEBEBEB;
textInput.setCaretColor(0xEBEBEB);
textInput.text.selectionColor.setColor(0x8DFF8D); textInput.text.selectionColor.setColor(0x8DFF8D);
textInput.text.selectionTile = h2d.Tile.fromColor(0x88BCEE, 0, hxd.Math.ceil(textInput.text.font.lineHeight)); textInput.text.selectionTile = h2d.Tile.fromColor(0x88BCEE, 0, hxd.Math.ceil(textInput.text.font.lineHeight));
textFrame.addChild(textInput); textFrame.addChild(textInput);