You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
933 B

2 years ago
using System;
using static flecs_hub.flecs;
using static flecs_hub.flecs.Runtime;
2 years ago
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);
2 years ago
public Universe(params string[] args)
2 years ago
{
var argv = CStrings.CStringArray(args);
Handle = ecs_init_w_args(args.Length, argv);
CStrings.FreeCStrings(argv, args.Length);
2 years ago
Modules = new(this);
Modules.Register(typeof(Flecs.Core));
Modules.Register(typeof(Flecs.ObserverEvent));
Modules.Register(typeof(Flecs.SystemPhase));
New("Game", "Game").Build().CreateLookup<Game>();
}
public EntityBuilder New(string? name = null, string? symbol = null)
=> new(this, name, symbol);
2 years ago
public bool Progress(TimeSpan delta)
=> ecs_progress(this, (float)delta.TotalSeconds);
2 years ago
public static implicit operator ecs_world_t*(Universe w) => w.Handle;
}