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.
40 lines
991 B
40 lines
991 B
using System; |
|
using static flecs_hub.flecs; |
|
|
|
namespace gaemstone.ECS; |
|
|
|
public unsafe partial class World |
|
{ |
|
public ecs_world_t* Handle { get; } |
|
|
|
// Flecs built-ins that are important to internals. |
|
internal EntityRef ChildOf { get; } |
|
internal EntityRef Disabled { get; } |
|
internal EntityRef DependsOn { get; } |
|
|
|
public bool IsDeferred => ecs_is_deferred(this); |
|
public bool IsQuitRequested => ecs_should_quit(this); |
|
|
|
public World(params string[] args) |
|
{ |
|
Handle = ecs_init_w_args(args.Length, null); |
|
|
|
ChildOf = LookupOrThrow("/flecs/core/ChildOf"); |
|
Disabled = LookupOrThrow("/flecs/core/Disabled"); |
|
DependsOn = LookupOrThrow("/flecs/core/DependsOn"); |
|
} |
|
|
|
public void Dispose() |
|
=> ecs_fini(this); |
|
|
|
public EntityBuilder New(EntityPath? path = null) |
|
=> new(this, path); |
|
|
|
public bool Progress(TimeSpan delta) |
|
=> ecs_progress(this, (float)delta.TotalSeconds); |
|
|
|
public void Quit() |
|
=> ecs_quit(this); |
|
|
|
public static implicit operator ecs_world_t*(World w) => w.Handle; |
|
}
|
|
|