Minimal world init, remove args constructor

main
copygirl 2 years ago
parent 6cd699efbc
commit c575046a61
  1. 13
      src/gaemstone.ECS/World+Bare.cs
  2. 7
      src/gaemstone.ECS/World.cs

@ -17,7 +17,9 @@ public unsafe struct World
public World(ecs_world_t* handle)
=> Handle = handle;
public World(params string[] args)
/// <summary> Initializes a new Flecs world. </summary>
/// <param name="minimal"> If true, doesn't automatically import built-in modules. </param>
public World(bool minimal = false)
{
[UnmanagedCallersOnly]
static void Abort() => throw new FlecsAbortException();
@ -27,14 +29,7 @@ public unsafe struct World
api.abort_ = new FnPtr_Void { Pointer = &Abort };
ecs_os_set_api(&api);
if (args?.Length > 0) {
var ptr = Runtime.CStrings.CStringArray(args);
Handle = ecs_init_w_args(args.Length, ptr);
for (var i = 0; i < args.Length; i++)
Marshal.FreeHGlobal(ptr[i]);
} else {
Handle = ecs_init();
}
Handle = minimal ? ecs_mini() : ecs_init();
}
public bool Progress(TimeSpan delta)

@ -15,8 +15,11 @@ public unsafe struct World<TContext>
public World(World value)
=> Value = value;
public World(params string[] args)
: this(new World(args)) { }
/// <summary> Initializes a new Flecs world. </summary>
/// <param name="minimal"> If true, doesn't automatically import built-in modules. </param>
public World(bool minimal = false)
: this(new World(minimal)) { }
public bool Progress(TimeSpan delta) => Value.Progress(delta);
public void Quit() => Value.Quit();

Loading…
Cancel
Save