|
|
|
using System;
|
|
|
|
using static flecs_hub.flecs;
|
|
|
|
|
|
|
|
namespace gaemstone.ECS;
|
|
|
|
|
|
|
|
public unsafe partial class Universe
|
|
|
|
{
|
|
|
|
public ecs_world_t* Handle { get; }
|
|
|
|
public ModuleManager Modules { get; }
|
|
|
|
|
|
|
|
public bool IsDeferred => ecs_is_deferred(this);
|
|
|
|
|
|
|
|
public Universe(params string[] args)
|
|
|
|
{
|
|
|
|
Handle = ecs_init_w_args(args.Length, null);
|
|
|
|
|
|
|
|
Modules = new(this);
|
|
|
|
Modules.Register(typeof(Flecs.Core));
|
|
|
|
Modules.Register(typeof(Flecs.ObserverEvent));
|
|
|
|
Modules.Register(typeof(Flecs.SystemPhase));
|
|
|
|
|
|
|
|
New("Game").Symbol("Game").Build().CreateLookup<Game>();
|
|
|
|
}
|
|
|
|
|
|
|
|
public EntityBuilder New(EntityPath? path = null)
|
|
|
|
=> new(this, path);
|
|
|
|
|
|
|
|
public bool Progress(TimeSpan delta)
|
|
|
|
=> ecs_progress(this, (float)delta.TotalSeconds);
|
|
|
|
|
|
|
|
public static implicit operator ecs_world_t*(Universe w) => w.Handle;
|
|
|
|
}
|