ecs and tranforms
added the moonworks ecs library. testing it by setting up a transform and parent system.
This commit is contained in:
@@ -1,9 +1,15 @@
|
||||
using Nerfed.Runtime;
|
||||
using MoonTools.ECS;
|
||||
using Nerfed.Runtime;
|
||||
using Nerfed.Runtime.Systems;
|
||||
using System.Numerics;
|
||||
|
||||
namespace Nerfed.Editor;
|
||||
|
||||
internal class Program
|
||||
{
|
||||
private static readonly World world = new World();
|
||||
private static List<MoonTools.ECS.System> systems = new List<MoonTools.ECS.System>();
|
||||
|
||||
private static void Main(string[] args)
|
||||
{
|
||||
Engine.OnInitialize += HandleOnInitialize;
|
||||
@@ -16,6 +22,16 @@ internal class Program
|
||||
|
||||
private static void HandleOnInitialize()
|
||||
{
|
||||
systems.Add(new ParentSystem(world));
|
||||
systems.Add(new TransformSystem(world));
|
||||
|
||||
Entity ent1 = world.CreateEntity();
|
||||
world.Set(ent1, new LocalTransform(new Vector3(1, 0, 0), Quaternion.Identity, Vector3.One));
|
||||
|
||||
Entity ent2 = world.CreateEntity();
|
||||
world.Set(ent2, new LocalTransform(new Vector3(0, 1, 0), Quaternion.Identity, Vector3.One));
|
||||
world.Set(ent2, new Parent(ent1));
|
||||
|
||||
// Open project.
|
||||
// Setip EditorGui.
|
||||
EditorGui.Initialize();
|
||||
@@ -23,6 +39,11 @@ internal class Program
|
||||
|
||||
private static void HandleOnUpdate()
|
||||
{
|
||||
foreach (MoonTools.ECS.System system in systems)
|
||||
{
|
||||
system.Update(Engine.Timestep);
|
||||
}
|
||||
|
||||
// Editor Update.
|
||||
EditorGui.Update();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user