WIP: button widget
This commit is contained in:
@@ -63,10 +63,19 @@ public class TestGame : Game
|
||||
Input.AddInputMapping("reload", new IInputAction[] { new KeyInputAction(KeyboardKey.R) });
|
||||
_emitterId = _particleSystem.CreateEmitter(Renderer.WindowSize / 2, _fireEffect);
|
||||
|
||||
// _fillContainer.AddChild(_container);
|
||||
// _marginContainer.AddChild(_container);
|
||||
var button = new Button("Add element", _defaultFontSet, () => { _container.AddChild(new Label("Hello, World!", _defaultFontSet)); });
|
||||
button.Padding = new Margin(8.0f);
|
||||
|
||||
_uiSystem.AddElement(_container);
|
||||
_buttonContainer.AddChild(button);
|
||||
|
||||
var c = new MarginContainer();
|
||||
c.AddChild(_container);
|
||||
|
||||
_buttonContainer.AddChild(c);
|
||||
|
||||
_root.AddChild(_buttonContainer);
|
||||
|
||||
_uiSystem.AddElement(_root);
|
||||
}
|
||||
|
||||
|
||||
@@ -78,11 +87,6 @@ public class TestGame : Game
|
||||
_particleSystem!.RestartEmitter(_emitterId);
|
||||
}
|
||||
|
||||
if (Input.IsActionPressed("accept"))
|
||||
{
|
||||
_container.AddChild(new Label("こんにちは世界!", _defaultFontSet));
|
||||
}
|
||||
|
||||
if (Input.IsActionPressed("cancel") && _container.Children.Count != 0)
|
||||
{
|
||||
var lastChild = _container.Children.Last();
|
||||
@@ -146,12 +150,6 @@ public class TestGame : Game
|
||||
|
||||
[NotNull] private Label _label;
|
||||
|
||||
private FillContainer _fillContainer = new();
|
||||
private MarginContainer _marginContainer = new(new Margin(32.0f))
|
||||
{
|
||||
};
|
||||
// private HorizontalContainer _container = new(new Rect(128.0f, 64.0f), new(), 16)
|
||||
// {
|
||||
// ConfineToContents = true,
|
||||
// };
|
||||
private FillContainer _root = new();
|
||||
private VerticalContainer _buttonContainer = new(16);
|
||||
}
|
||||
Reference in New Issue
Block a user