WIP: UI system, containers and widgets.
This commit is contained in:
@@ -6,6 +6,9 @@ using System.Numerics;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Voile.Rendering;
|
||||
using Voile.OpenAL;
|
||||
using Voile.UI;
|
||||
using Voile.UI.Widgets;
|
||||
using Voile.UI.Containers;
|
||||
|
||||
public class TestGame : Game
|
||||
{
|
||||
@@ -16,9 +19,11 @@ public class TestGame : Game
|
||||
{
|
||||
InitializeSystemsDefault();
|
||||
|
||||
_uiSystem = new UISystem(new ResourceRef<Style>(Guid.Empty));
|
||||
|
||||
_particleSystem = new ParticleSystem();
|
||||
|
||||
// AddSystemToUpdate(_audioSystem);
|
||||
AddSystemToUpdate(_uiSystem);
|
||||
AddSystemToUpdate(_particleSystem);
|
||||
}
|
||||
|
||||
@@ -49,6 +54,13 @@ public class TestGame : Game
|
||||
{
|
||||
Input.AddInputMapping("reload", new IInputAction[] { new KeyInputAction(KeyboardKey.R) });
|
||||
_emitterId = _particleSystem.CreateEmitter(Renderer.WindowSize / 2, _fireEffect);
|
||||
|
||||
_uiSystem.AddElement(new VerticalContainer(new()
|
||||
{
|
||||
new Label("Hello, I'm a label!", _font),
|
||||
new Label("I'm also a label, except I'm located slightly lower!", _font),
|
||||
new Label("I hope a VerticalContainer works.", _font)
|
||||
}, 64.0f));
|
||||
}
|
||||
|
||||
|
||||
@@ -80,11 +92,7 @@ public class TestGame : Game
|
||||
}
|
||||
|
||||
Renderer.ResetTransform();
|
||||
|
||||
Renderer.DrawText(_font, $"Render: {RenderFrameTime.TotalMilliseconds:F1} ms", Color.White);
|
||||
|
||||
Renderer.SetTransform(new Vector2(0.0f, 16.0f), Vector2.Zero);
|
||||
Renderer.DrawText(_font, $"Update: {UpdateTimeStep * 1000:F1} ms", Color.White);
|
||||
_uiSystem.Render(Renderer);
|
||||
}
|
||||
|
||||
private void DrawEmitter(ParticleEmitter emitter)
|
||||
@@ -107,6 +115,7 @@ public class TestGame : Game
|
||||
}
|
||||
|
||||
[NotNull] private ParticleSystem _particleSystem;
|
||||
[NotNull] private UISystem _uiSystem;
|
||||
private int _emitterId;
|
||||
private ResourceRef<ParticleEmitterSettingsResource> _fireEffect;
|
||||
private ResourceRef<Font> _font;
|
||||
|
||||
Reference in New Issue
Block a user