More UI work

This commit is contained in:
2024-01-20 16:44:26 +01:00
parent c96db94de4
commit 8abc17034c
3 changed files with 33 additions and 8 deletions

View File

@@ -44,24 +44,43 @@ public class UiLayer : Layer
var style = new PanelStyle()
{
BackgroundColor = new Color(0.25f, 0.25f, 0.25f, 1.0f)
BackgroundColor = new Color(0.2f, 0.2f, 0.2f, 1.0f)
};
_panel = new MarginPanel(style)
{
ExpandRatio = new Vector2(0.5f, 1.0f),
RelativeMargin = Vector2.One * 0.01f
ExpandRatio = new Vector2(0.5f, 1f),
AbsoluteMargin = Vector2.One * 16f
};
_screenContainer.AddChild(_panel);
var exampleText = new TextLabel()
{
Font = _defaultFont,
FontSize = 30,
Text = "This Panel will occupy 50% of the screen.\nHow cool is that?"
FontSize = 20,
Text = "This Panel will occupy 50% of the screen.\nThis text in particular is inside a panel with an absolute margin of 16px.\nHow cool is that?"
};
_panel.AddChild(exampleText);
var contentPanel = new MarginPanel(new PanelStyle()
{
BackgroundColor = new Color(0.25f, 0.25f, 0.25f, 1.0f)
})
{
AbsoluteMargin = Vector2.One * 32f
};
_panel.AddChild(contentPanel);
var verticalPanel = new MarginPanel(new PanelStyle()
{
BackgroundColor = new Color(0.1f, 0.1f, 0.1f, 1.0f),
})
{
AbsoluteMargin = Vector2.One * 8f,
};
contentPanel.AddChild(verticalPanel);
verticalPanel.AddChild(exampleText);
// var verticalPanel = new VerticalPanel(new PanelStyle()
// {