Input fields and refactors required to support them

This commit is contained in:
2026-05-31 22:14:25 +02:00
parent b506b78c32
commit c7acc70dcd
12 changed files with 431 additions and 61 deletions

View File

@@ -58,3 +58,17 @@ BorderColor = "#161616"
# Default background color for all Container derived classes.
[Container]
BackgroundColor = "#e0e0e0"
[InputField]
TextColor = "#161616"
BorderColor = "#8d8d8d"
BorderSize = [0, 0, 0, 1]
Padding = [16, 16, 4, 8]
[InputField.Focused]
BorderColor = "#0f62fe"
BorderSize = 2.0
# [InputField.Hovered]BorderColor = "#0f62fe"
# BackgroundColor = "#f4f4f4"

View File

@@ -73,7 +73,7 @@ public class TestGame : Game
_uiSystem.SetStyleSheet(_styleSheet);
var addButton = new Button("Default button", _defaultFontSet);
var addButton = new Button("", _defaultFontSet);
var removeButton = new Button("Danger button", _defaultFontSet);
@@ -93,10 +93,16 @@ public class TestGame : Game
Anchor = Anchor.TopCenter
};
var inputField = new InputField(string.Empty, _defaultFontSet)
{
PlaceholderText = "Hello, World!"
};
c.AddChild(addButton);
c.AddChild(removeButton);
c.AddChild(outlineButton);
c.AddChild(linkButton);
c.AddChild(inputField);
var vc = new VerticalContainer(0.0f);
vc.AddChild(c);