Alternative managed wrapper around flecs-cs bindings for using the ECS framework Flecs in modern .NET.
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.

3773 lines
263 KiB

// <auto-generated>
// Generated by gaemstone.ECS.BindGen c661367
// Time: 2023-01-09 18:48:29Z
// Flecs version: v3.1.3
// </auto-generated>
using System;
using System.Runtime.InteropServices;
#pragma warning disable CS8981
public static unsafe partial class flecs
{
private const string LibraryName = "flecs";
/// <summary> Indicates types are marked as "const" on C's end. </summary>
[AttributeUsage(AttributeTargets.Parameter, AttributeTargets.ReturnValue)]
public class ConstAttribute : Attribute { }
/// <summary> Create new vector. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_vector_t* _ecs_vector_new(int elem_size, short offset, int elem_count);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_vector_t* _ecs_vector_from_array(int elem_size, short offset, int elem_count, void* array);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void _ecs_vector_zero(ecs_vector_t* vector, int elem_size, short offset);
/// <summary> Free vector. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_vector_free(ecs_vector_t* vector);
/// <summary> Clear values in vector. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_vector_clear(ecs_vector_t* vector);
/// <summary> Assert when the provided size does not match the vector type. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_vector_assert_size(ecs_vector_t* vector_inout, int elem_size);
/// <summary> Add element to vector. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void* _ecs_vector_add(ecs_vector_t** array_inout, int elem_size, short offset);
/// <summary> Insert element to vector. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void* _ecs_vector_insert_at(ecs_vector_t** array_inout, int elem_size, short offset, int index);
/// <summary> Add n elements to the vector. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void* _ecs_vector_addn(ecs_vector_t** array_inout, int elem_size, short offset, int elem_count);
/// <summary> Get element from vector. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void* _ecs_vector_get([Const] ecs_vector_t* vector, int elem_size, short offset, int index);
/// <summary> Get last element from vector. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void* _ecs_vector_last([Const] ecs_vector_t* vector, int elem_size, short offset);
/// <summary> Set minimum size for vector. If the current size of the vector is larger, the function will have no side effects. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern int _ecs_vector_set_min_size(ecs_vector_t** array_inout, int elem_size, short offset, int elem_count);
/// <summary> Set minimum count for vector. If the current count of the vector is larger, the function will have no side effects. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern int _ecs_vector_set_min_count(ecs_vector_t** vector_inout, int elem_size, short offset, int elem_count);
/// <summary> Remove last element. This operation requires no swapping of values. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_vector_remove_last(ecs_vector_t* vector);
/// <summary> Remove last value, store last element in provided value. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern bool _ecs_vector_pop(ecs_vector_t* vector, int elem_size, short offset, void* value);
/// <summary> Append element at specified index to another vector. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern int _ecs_vector_move_index(ecs_vector_t** dst, ecs_vector_t* src, int elem_size, short offset, int index);
/// <summary> Remove element at specified index. Moves the last value to the index. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern int _ecs_vector_remove(ecs_vector_t* vector, int elem_size, short offset, int index);
/// <summary> Shrink vector to make the size match the count. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void _ecs_vector_reclaim(ecs_vector_t** vector, int elem_size, short offset);
/// <summary> Grow size of vector with provided number of elements. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern int _ecs_vector_grow(ecs_vector_t** vector, int elem_size, short offset, int elem_count);
/// <summary> Set allocation size of vector. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern int _ecs_vector_set_size(ecs_vector_t** vector, int elem_size, short offset, int elem_count);
/// <summary> Set count of vector. If the size of the vector is smaller than the provided count, the vector is resized. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern int _ecs_vector_set_count(ecs_vector_t** vector, int elem_size, short offset, int elem_count);
/// <summary> Return number of elements in vector. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern int ecs_vector_count([Const] ecs_vector_t* vector);
/// <summary> Return size of vector. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern int ecs_vector_size([Const] ecs_vector_t* vector);
/// <summary> Return first element of vector. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void* _ecs_vector_first([Const] ecs_vector_t* vector, int elem_size, short offset);
/// <summary> Sort elements in vector. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void _ecs_vector_sort(ecs_vector_t* vector, int elem_size, short offset, ecs_comparator_t compare_action);
/// <summary> Copy vectors. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_vector_t* _ecs_vector_copy([Const] ecs_vector_t* src, int elem_size, short offset);
/// <summary> Initialize sparse set. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void _flecs_sparse_init(ecs_sparse_t* sparse, void* allocator, void* chunk_allocator, int elem_size);
/// <summary> Create new sparse set. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_sparse_t* _flecs_sparse_new(void* allocator, void* chunk_allocator, int elem_size);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void _flecs_sparse_fini(ecs_sparse_t* sparse);
/// <summary> Free sparse set. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void flecs_sparse_free(ecs_sparse_t* sparse);
/// <summary> Remove all elements from sparse set. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void flecs_sparse_clear(ecs_sparse_t* sparse);
/// <summary> Set id source. This allows the sparse set to use an external variable for issuing and increasing new ids. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void flecs_sparse_set_id_source(ecs_sparse_t* sparse, ulong* id_source);
/// <summary> Add element to sparse set, this generates or recycles an id. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void* _flecs_sparse_add(ecs_sparse_t* sparse, int elem_size);
/// <summary> Get last issued id. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ulong flecs_sparse_last_id([Const] ecs_sparse_t* sparse);
/// <summary> Generate or recycle a new id. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ulong flecs_sparse_new_id(ecs_sparse_t* sparse);
/// <summary> Generate or recycle new ids in bulk. The returned pointer points directly to the internal dense array vector with sparse ids. Operations on the sparse set can (and likely will) modify the contents of the buffer. </summary>
[return: Const]
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ulong* flecs_sparse_new_ids(ecs_sparse_t* sparse, int count);
/// <summary> Remove an element. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void flecs_sparse_remove(ecs_sparse_t* sparse, ulong id);
/// <summary> Fast version of remove, no liveliness checking. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void* _flecs_sparse_remove_fast(ecs_sparse_t* sparse, int elem_size, ulong id);
/// <summary> Remove an element, return pointer to the value in the sparse array. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void* _flecs_sparse_remove_get(ecs_sparse_t* sparse, int elem_size, ulong id);
/// <summary> Check whether an id has ever been issued. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern bool flecs_sparse_exists([Const] ecs_sparse_t* sparse, ulong id);
/// <summary> Check whether an id has ever been issued and is currently alive. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern bool flecs_sparse_is_valid([Const] ecs_sparse_t* sparse, ulong index);
/// <summary> Test if id is alive, which requires the generation count to match. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern bool flecs_sparse_is_alive([Const] ecs_sparse_t* sparse, ulong id);
/// <summary> Return identifier with current generation set. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ulong flecs_sparse_get_alive([Const] ecs_sparse_t* sparse, ulong id);
/// <summary> Get value from sparse set by dense id. This function is useful in combination with flecs_sparse_count for iterating all values in the set. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void* _flecs_sparse_get_dense([Const] ecs_sparse_t* sparse, int elem_size, int index);
/// <summary> Get the number of alive elements in the sparse set. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern int flecs_sparse_count([Const] ecs_sparse_t* sparse);
/// <summary> Get the number of not alive alive elements in the sparse set. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern int flecs_sparse_not_alive_count([Const] ecs_sparse_t* sparse);
/// <summary> Return total number of allocated elements in the dense array. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern int flecs_sparse_size([Const] ecs_sparse_t* sparse);
/// <summary> Get element by (sparse) id. The returned pointer is stable for the duration of the sparse set, as it is stored in the sparse array. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void* _flecs_sparse_get([Const] ecs_sparse_t* sparse, int elem_size, ulong id);
/// <summary> Like get_sparse, but don't care whether element is alive or not. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void* _flecs_sparse_get_any([Const] ecs_sparse_t* sparse, int elem_size, ulong id);
/// <summary> Get or create element by (sparse) id. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void* _flecs_sparse_ensure(ecs_sparse_t* sparse, int elem_size, ulong id);
/// <summary> Fast version of ensure, no liveliness checking. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void* _flecs_sparse_ensure_fast(ecs_sparse_t* sparse, int elem_size, ulong id);
/// <summary> Set value. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void* _flecs_sparse_set(ecs_sparse_t* sparse, int elem_size, ulong id, void* value);
/// <summary> Get pointer to ids (alive and not alive). Use with count() or size(). </summary>
[return: Const]
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ulong* flecs_sparse_ids([Const] ecs_sparse_t* sparse);
/// <summary> Set size of the dense array. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void flecs_sparse_set_size(ecs_sparse_t* sparse, int elem_count);
/// <summary> Copy sparse set into a new sparse set. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_sparse_t* flecs_sparse_copy([Const] ecs_sparse_t* src);
/// <summary> Restore sparse set into destination sparse set. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void flecs_sparse_restore(ecs_sparse_t* dst, [Const] ecs_sparse_t* src);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_sparse_t* _ecs_sparse_new(int elem_size);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void* _ecs_sparse_add(ecs_sparse_t* sparse, int elem_size);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ulong ecs_sparse_last_id([Const] ecs_sparse_t* sparse);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern int ecs_sparse_count([Const] ecs_sparse_t* sparse);
/// <summary> Override the generation count for a specific id. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void flecs_sparse_set_generation(ecs_sparse_t* sparse, ulong id);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void* _ecs_sparse_get_dense([Const] ecs_sparse_t* sparse, int elem_size, int index);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void* _ecs_sparse_get([Const] ecs_sparse_t* sparse, int elem_size, ulong id);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void flecs_ballocator_init(ecs_block_allocator_t* ba, int size);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_block_allocator_t* flecs_ballocator_new(int size);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void flecs_ballocator_fini(ecs_block_allocator_t* ba);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void flecs_ballocator_free(ecs_block_allocator_t* ba);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void* flecs_balloc(ecs_block_allocator_t* allocator);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void* flecs_bcalloc(ecs_block_allocator_t* allocator);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void flecs_bfree(ecs_block_allocator_t* allocator, void* memory);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void* flecs_brealloc(ecs_block_allocator_t* dst, ecs_block_allocator_t* src, void* memory);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void* flecs_bdup(ecs_block_allocator_t* ba, void* memory);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void _ecs_map_params_init(ecs_map_params_t* @params, void* allocator, int elem_size);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_map_params_fini(ecs_map_params_t* @params);
/// <summary> Initialize new map. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void _ecs_map_init(ecs_map_t* map, int elem_size, void* allocator, int initial_count);
/// <summary> Initialize new map. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void _ecs_map_init_w_params(ecs_map_t* map, ecs_map_params_t* @params);
/// <summary> Initialize new map if uninitialized, leave as is otherwise. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void _ecs_map_init_if(ecs_map_t* map, int elem_size, void* allocator, int elem_count);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void _ecs_map_init_w_params_if(ecs_map_t* result, ecs_map_params_t* @params);
/// <summary> Deinitialize map. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_map_fini(ecs_map_t* map);
/// <summary> Create new map. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_map_t* _ecs_map_new(int elem_size, void* allocator, int elem_count);
/// <summary> Is map initialized. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern bool ecs_map_is_initialized([Const] ecs_map_t* result);
/// <summary> Get element for key, returns NULL if they key doesn't exist. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void* _ecs_map_get([Const] ecs_map_t* map, int elem_size, ecs_map_key_t key);
/// <summary> Get pointer element. This dereferences the map element as a pointer. This operation returns NULL when either the element does not exist or whether the pointer is NULL, and should therefore only be used when the application knows for sure that a pointer should never be NULL. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void* _ecs_map_get_ptr([Const] ecs_map_t* map, ecs_map_key_t key);
/// <summary> Test if map has key. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern bool ecs_map_has([Const] ecs_map_t* map, ecs_map_key_t key);
/// <summary> Get or create element for key. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void* _ecs_map_ensure(ecs_map_t* map, int elem_size, ecs_map_key_t key);
/// <summary> Set element. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void* _ecs_map_set(ecs_map_t* map, int elem_size, ecs_map_key_t key, [Const] void* payload);
/// <summary> Free map. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_map_free(ecs_map_t* map);
/// <summary> Remove key from map. Returns number of remaining elements. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern int ecs_map_remove(ecs_map_t* map, ecs_map_key_t key);
/// <summary> Remove all elements from map. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_map_clear(ecs_map_t* map);
/// <summary> Return number of elements in map. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern int ecs_map_count([Const] ecs_map_t* map);
/// <summary> Return number of buckets in map. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern int ecs_map_bucket_count([Const] ecs_map_t* map);
/// <summary> Return iterator to map contents. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_map_iter_t ecs_map_iter([Const] ecs_map_t* map);
/// <summary> Obtain next element in map from iterator. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void* _ecs_map_next(ecs_map_iter_t* iter, int elem_size, ecs_map_key_t* key);
/// <summary> Obtain next pointer element from iterator. See ecs_map_get_ptr. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void* _ecs_map_next_ptr(ecs_map_iter_t* iter, ecs_map_key_t* key);
/// <summary> Grow number of buckets in the map for specified number of elements. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_map_grow(ecs_map_t* map, int elem_count);
/// <summary> Set number of buckets in the map for specified number of elements. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_map_set_size(ecs_map_t* map, int elem_count);
/// <summary> Copy map. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_map_t* ecs_map_copy(ecs_map_t* map);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void flecs_allocator_init(ecs_allocator_t* a);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void flecs_allocator_fini(ecs_allocator_t* a);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_block_allocator_t* flecs_allocator_get(ecs_allocator_t* a, int size);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern char* flecs_strdup(ecs_allocator_t* a, [Const] char* str);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void flecs_strfree(ecs_allocator_t* a, char* str);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void* flecs_dup(ecs_allocator_t* a, int size, [Const] void* src);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern bool ecs_strbuf_append(ecs_strbuf_t* buffer, [Const] char* fmt);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern bool ecs_strbuf_vappend(ecs_strbuf_t* buffer, [Const] char* fmt, int args);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern bool ecs_strbuf_appendstr(ecs_strbuf_t* buffer, [Const] char* str);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern bool ecs_strbuf_appendch(ecs_strbuf_t* buffer, char ch);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern bool ecs_strbuf_appendint(ecs_strbuf_t* buffer, long v);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern bool ecs_strbuf_appendflt(ecs_strbuf_t* buffer, double v, char nan_delim);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern bool ecs_strbuf_mergebuff(ecs_strbuf_t* dst_buffer, ecs_strbuf_t* src_buffer);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern bool ecs_strbuf_appendstr_zerocpy(ecs_strbuf_t* buffer, char* str);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern bool ecs_strbuf_appendstr_zerocpyn(ecs_strbuf_t* buffer, char* str, int n);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern bool ecs_strbuf_appendstr_zerocpy_const(ecs_strbuf_t* buffer, [Const] char* str);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern bool ecs_strbuf_appendstr_zerocpyn_const(ecs_strbuf_t* buffer, [Const] char* str, int n);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern bool ecs_strbuf_appendstrn(ecs_strbuf_t* buffer, [Const] char* str, int n);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern char* ecs_strbuf_get(ecs_strbuf_t* buffer);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern char* ecs_strbuf_get_small(ecs_strbuf_t* buffer);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_strbuf_reset(ecs_strbuf_t* buffer);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_strbuf_list_push(ecs_strbuf_t* buffer, [Const] char* list_open, [Const] char* separator);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_strbuf_list_pop(ecs_strbuf_t* buffer, [Const] char* list_close);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_strbuf_list_next(ecs_strbuf_t* buffer);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern bool ecs_strbuf_list_appendch(ecs_strbuf_t* buffer, char ch);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern bool ecs_strbuf_list_append(ecs_strbuf_t* buffer, [Const] char* fmt);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern bool ecs_strbuf_list_appendstr(ecs_strbuf_t* buffer, [Const] char* str);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern bool ecs_strbuf_list_appendstrn(ecs_strbuf_t* buffer, [Const] char* str, int n);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern int ecs_strbuf_written([Const] ecs_strbuf_t* buffer);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_os_init();
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_os_fini();
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_os_set_api(ecs_os_api_t* os_api);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_os_api_t ecs_os_get_api();
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_os_set_api_defaults();
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_os_dbg([Const] char* file, int line, [Const] char* msg);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_os_trace([Const] char* file, int line, [Const] char* msg);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_os_warn([Const] char* file, int line, [Const] char* msg);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_os_err([Const] char* file, int line, [Const] char* msg);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_os_fatal([Const] char* file, int line, [Const] char* msg);
[return: Const]
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern char* ecs_os_strerror(int err);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_sleepf(double t);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern double ecs_time_measure(ecs_time_t* start);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_time_t ecs_time_sub(ecs_time_t t1, ecs_time_t t2);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern double ecs_time_to_double(ecs_time_t t);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void* ecs_os_memdup([Const] void* src, int size);
/// <summary> Are heap functions available?. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern bool ecs_os_has_heap();
/// <summary> Are threading functions available?. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern bool ecs_os_has_threading();
/// <summary> Are time functions available?. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern bool ecs_os_has_time();
/// <summary> Are logging functions available?. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern bool ecs_os_has_logging();
/// <summary> Are dynamic library functions available?. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern bool ecs_os_has_dl();
/// <summary> Are module path functions available?. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern bool ecs_os_has_modules();
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern char* ecs_module_path_from_c([Const] char* c_name);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern bool ecs_identifier_is_0([Const] char* id);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_default_ctor(void* ptr, int count, [Const] ecs_type_info_t* ctx);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern char* ecs_vasprintf([Const] char* fmt, int args);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern char* ecs_asprintf([Const] char* fmt);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern int flecs_table_observed_count([Const] ecs_table_t* table);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_vec_t* ecs_vec_init(ecs_allocator_t* allocator, ecs_vec_t* vec, int size, int elem_count);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_vec_fini(ecs_allocator_t* allocator, ecs_vec_t* vec, int size);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_vec_t* ecs_vec_reset(ecs_allocator_t* allocator, ecs_vec_t* vec, int size);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_vec_clear(ecs_vec_t* vec);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void* ecs_vec_append(ecs_allocator_t* allocator, ecs_vec_t* vec, int size);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_vec_remove(ecs_vec_t* vec, int size, int elem);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_vec_remove_last(ecs_vec_t* vec);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_vec_t ecs_vec_copy(ecs_allocator_t* allocator, ecs_vec_t* vec, int size);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_vec_reclaim(ecs_allocator_t* allocator, ecs_vec_t* vec, int size);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_vec_set_size(ecs_allocator_t* allocator, ecs_vec_t* vec, int size, int elem_count);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_vec_set_count(ecs_allocator_t* allocator, ecs_vec_t* vec, int size, int elem_count);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void* ecs_vec_grow(ecs_allocator_t* allocator, ecs_vec_t* vec, int size, int elem_count);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern int ecs_vec_count([Const] ecs_vec_t* vec);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern int ecs_vec_size([Const] ecs_vec_t* vec);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void* ecs_vec_get([Const] ecs_vec_t* vec, int size, int index);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void* ecs_vec_first([Const] ecs_vec_t* vec);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void* ecs_vec_last([Const] ecs_vec_t* vec, int size);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void _flecs_hashmap_init(ecs_hashmap_t* hm, int key_size, int value_size, ecs_hash_value_action_t hash, ecs_compare_action_t compare, ecs_allocator_t* allocator);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void flecs_hashmap_fini(ecs_hashmap_t* map);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void* _flecs_hashmap_get([Const] ecs_hashmap_t* map, int key_size, [Const] void* key, int value_size);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern flecs_hashmap_result_t _flecs_hashmap_ensure(ecs_hashmap_t* map, int key_size, [Const] void* key, int value_size);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void _flecs_hashmap_set(ecs_hashmap_t* map, int key_size, void* key, int value_size, [Const] void* value);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void _flecs_hashmap_remove(ecs_hashmap_t* map, int key_size, [Const] void* key, int value_size);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void _flecs_hashmap_remove_w_hash(ecs_hashmap_t* map, int key_size, [Const] void* key, int value_size, ulong hash);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_hm_bucket_t* flecs_hashmap_get_bucket([Const] ecs_hashmap_t* map, ulong hash);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void flecs_hm_bucket_remove(ecs_hashmap_t* map, ecs_hm_bucket_t* bucket, ulong hash, int index);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void flecs_hashmap_copy([Const] ecs_hashmap_t* src, ecs_hashmap_t* dst);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern flecs_hashmap_iter_t flecs_hashmap_iter(ecs_hashmap_t* map);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void* _flecs_hashmap_next(flecs_hashmap_iter_t* it, int key_size, void* key_out, int value_size);
/// <summary>
/// <p> Create a new world. A world manages all the ECS data and supporting infrastructure. Applications must have at least one world. Entities, component and system handles are local to a world and should not be shared between worlds. </p>
/// <p> This operation creates a world with all builtin modules loaded. </p>
/// </summary>
/// <returns> A new world. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_world_t* ecs_init();
/// <summary> Same as ecs_init, but with minimal set of modules loaded. </summary>
/// <returns> A new tiny world. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_world_t* ecs_mini();
/// <summary> Create a new world with arguments. Same as ecs_init, but allows passing in command line arguments. These can be used to dynamically enable flecs features to an application. Currently these arguments are not used. </summary>
/// <returns> A new world. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_world_t* ecs_init_w_args(int argc, char*[] argv);
/// <summary> Delete a world. This operation deletes the world, and everything it contains. </summary>
/// <param name="world"> The world to delete. </param>
/// <returns> Zero if successful, non-zero if failed. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern int ecs_fini(ecs_world_t* world);
/// <summary> Returns whether the world is being deleted. </summary>
/// <param name="world"> The world. </param>
/// <returns> True if being deleted, false if not. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern bool ecs_is_fini([Const] ecs_world_t* world);
/// <summary> Register action to be executed when world is destroyed. Fini actions are typically used when a module needs to clean up before a world shuts down. </summary>
/// <param name="world"> The world. </param>
/// <param name="action"> The function to execute. </param>
/// <param name="ctx"> Userdata to pass to the function. </param>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_atfini(ecs_world_t* world, ecs_fini_action_t action, void* ctx);
/// <summary>
/// <p> Begin frame. When an application does not use ecs_progress to control the main loop, it can still use Flecs features such as FPS limiting and time measurements. This operation needs to be invoked whenever a new frame is about to get processed. </p>
/// <p> Calls to ecs_frame_begin must always be followed by ecs_frame_end. </p>
/// <p> The function accepts a delta_time parameter, which will get passed to systems. This value is also used to compute the amount of time the function needs to sleep to ensure it does not exceed the target_fps, when it is set. When 0 is provided for delta_time, the time will be measured. </p>
/// <p> This function should only be ran from the main thread. </p>
/// </summary>
/// <param name="world"> The world. </param>
/// <param name="delta_time"> Time elapsed since the last frame. </param>
/// <returns> The provided delta_time, or measured time if 0 was provided. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern float ecs_frame_begin(ecs_world_t* world, float delta_time);
/// <summary> End frame. This operation must be called at the end of the frame, and always after ecs_frame_begin. </summary>
/// <param name="world"> The world. </param>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_frame_end(ecs_world_t* world);
/// <summary> Register action to be executed once after frame. Post frame actions are typically used for calling operations that cannot be invoked during iteration, such as changing the number of threads. </summary>
/// <param name="world"> The world. </param>
/// <param name="action"> The function to execute. </param>
/// <param name="ctx"> Userdata to pass to the function. </param>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_run_post_frame(ecs_world_t* world, ecs_fini_action_t action, void* ctx);
/// <summary> Signal exit This operation signals that the application should quit. It will cause ecs_progress to return false. </summary>
/// <param name="world"> The world to quit. </param>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_quit(ecs_world_t* world);
/// <summary> Return whether a quit has been signaled. </summary>
/// <param name="world"> The world. </param>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern bool ecs_should_quit([Const] ecs_world_t* world);
/// <summary>
/// <p> Measure frame time. Frame time measurements measure the total time passed in a single frame, and how much of that time was spent on systems and on merging. </p>
/// <p> Frame time measurements add a small constant-time overhead to an application. When an application sets a target FPS, frame time measurements are enabled by default. </p>
/// </summary>
/// <param name="world"> The world. </param>
/// <param name="enable"> Whether to enable or disable frame time measuring. </param>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_measure_frame_time(ecs_world_t* world, bool enable);
/// <summary>
/// <p> Measure system time. System time measurements measure the time spent in each system. </p>
/// <p> System time measurements add overhead to every system invocation and therefore have a small but measurable impact on application performance. System time measurements must be enabled before obtaining system statistics. </p>
/// </summary>
/// <param name="world"> The world. </param>
/// <param name="enable"> Whether to enable or disable system time measuring. </param>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_measure_system_time(ecs_world_t* world, bool enable);
/// <summary>
/// <p> Set target frames per second (FPS) for application. Setting the target FPS ensures that ecs_progress is not invoked faster than the specified FPS. When enabled, ecs_progress tracks the time passed since the last invocation, and sleeps the remaining time of the frame (if any). </p>
/// <p> This feature ensures systems are ran at a consistent interval, as well as conserving CPU time by not running systems more often than required. </p>
/// <p> Note that ecs_progress only sleeps if there is time left in the frame. Both time spent in flecs as time spent outside of flecs are taken into account. </p>
/// </summary>
/// <param name="world"> The world. </param>
/// <param name="fps"> The target FPS. </param>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_set_target_fps(ecs_world_t* world, float fps);
/// <summary>
/// <p> Begin readonly mode. Readonly mode guarantees that no mutations will occur on the world, which makes the world safe to access from multiple threads. While the world is in readonly mode, operations are deferred. </p>
/// <p> Note that while similar to ecs_defer_begin, deferring only does not guarantee the world is not mutated. Operations that are not deferred (like creating a query) update data structures on the world and are allowed when deferring is enabled, but not when the world is in readonly mode. </p>
/// <p> A call to ecs_readonly_begin must be followed up with ecs_readonly_end. </p>
/// <p> The ecs_progress() function automatically enables readonly mode while systems are executed. </p>
/// <p> When a world has more than one stage, the specific stage must be provided to mutating ECS operations. Failing to do so will throw a readonly assert. A world typically has more than one stage when using threads. An example:. </p>
/// <p> ecs_set_stage_count(world, 2); ecs_stage_t *stage = ecs_get_stage(world, 1);. </p>
/// <p> ecs_readonly_begin(world); ecs_add(world, e, Tag); // readonly assert ecs_add(stage, e, Tag); // OK. </p>
/// </summary>
/// <param name="world"> The world. </param>
/// <returns> Whether world is in readonly mode. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern bool ecs_readonly_begin(ecs_world_t* world);
/// <summary> End readonly mode. This operation ends readonly mode, and must be called after ecs_readonly_begin. Operations that were deferred while the world was in readonly mode will be flushed. </summary>
/// <param name="world"> The world. </param>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_readonly_end(ecs_world_t* world);
/// <summary>
/// <p> Merge world or stage. When automatic merging is disabled, an application can call this operation on either an individual stage, or on the world which will merge all stages. This operation may only be called when staging is not enabled (either after progress() or after readonly_end()). </p>
/// <p> This operation may be called on an already merged stage or world. </p>
/// </summary>
/// <param name="world"> The world. </param>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_merge(ecs_world_t* world);
/// <summary>
/// <p> Defer operations until end of frame. When this operation is invoked while iterating, operations inbetween the defer_begin and defer_end operations are executed at the end of the frame. </p>
/// <p> This operation is thread safe. </p>
/// </summary>
/// <param name="world"> The world. </param>
/// <returns> true if world changed from non-deferred mode to deferred mode. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern bool ecs_defer_begin(ecs_world_t* world);
/// <summary> Test if deferring is enabled for current stage. </summary>
/// <param name="world"> The world. </param>
/// <returns> True if deferred, false if not. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern bool ecs_is_deferred([Const] ecs_world_t* world);
/// <summary>
/// <p> End block of operations to defer. See defer_begin. </p>
/// <p> This operation is thread safe. </p>
/// </summary>
/// <param name="world"> The world. </param>
/// <returns> true if world changed from deferred mode to non-deferred mode. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern bool ecs_defer_end(ecs_world_t* world);
/// <summary>
/// <p> Suspend deferring but do not flush queue. This operation can be used to do an undeferred operation while not flushing the operations in the queue. </p>
/// <p> An application should invoke ecs_defer_resume before ecs_defer_end is called. The operation may only be called when deferring is enabled. </p>
/// </summary>
/// <param name="world"> The world. </param>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_defer_suspend(ecs_world_t* world);
/// <summary> Resume deferring. See ecs_defer_suspend. </summary>
/// <param name="world"> The world. </param>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_defer_resume(ecs_world_t* world);
/// <summary>
/// <p> Enable/disable automerging for world or stage. When automerging is enabled, staged data will automatically be merged with the world when staging ends. This happens at the end of progress(), at a sync point or when readonly_end() is called. </p>
/// <p> Applications can exercise more control over when data from a stage is merged by disabling automerging. This requires an application to explicitly call merge() on the stage. </p>
/// <p> When this function is invoked on the world, it sets all current stages to the provided value and sets the default for new stages. When this function is invoked on a stage, automerging is only set for that specific stage. </p>
/// </summary>
/// <param name="world"> The world. </param>
/// <param name="automerge"> Whether to enable or disable automerging. </param>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_set_automerge(ecs_world_t* world, bool automerge);
/// <summary>
/// <p> Configure world to have N stages. This initializes N stages, which allows applications to defer operations to multiple isolated defer queues. This is typically used for applications with multiple threads, where each thread gets its own queue, and commands are merged when threads are synchronized. </p>
/// <p> Note that the ecs_set_threads function already creates the appropriate number of stages. The set_stage_count() operation is useful for applications that want to manage their own stages and/or threads. </p>
/// </summary>
/// <param name="world"> The world. </param>
/// <param name="stages"> The number of stages. </param>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_set_stage_count(ecs_world_t* world, int stages);
/// <summary> Get number of configured stages. Return number of stages set by ecs_set_stage_count. </summary>
/// <param name="world"> The world. </param>
/// <returns> The number of stages used for threading. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern int ecs_get_stage_count([Const] ecs_world_t* world);
/// <summary> Get current stage id. The stage id can be used by an application to learn about which stage it is using, which typically corresponds with the worker thread id. </summary>
/// <param name="world"> The world. </param>
/// <returns> The stage id. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern int ecs_get_stage_id([Const] ecs_world_t* world);
/// <summary>
/// <p> Get stage-specific world pointer. Flecs threads can safely invoke the API as long as they have a private context to write to, also referred to as the stage. This function returns a pointer to a stage, disguised as a world pointer. </p>
/// <p> Note that this function does not(!) create a new world. It simply wraps the existing world in a thread-specific context, which the API knows how to unwrap. The reason the stage is returned as an ecs_world_t is so that it can be passed transparently to the existing API functions, vs. having to create a dediated API for threading. </p>
/// </summary>
/// <param name="world"> The world. </param>
/// <param name="stage_id"> The index of the stage to retrieve. </param>
/// <returns> A thread-specific pointer to the world. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_world_t* ecs_get_stage([Const] ecs_world_t* world, int stage_id);
/// <summary> Test whether the current world is readonly. This function allows the code to test whether the currently used world is readonly or whether it allows for writing. </summary>
/// <param name="world"> A pointer to a stage or the world. </param>
/// <returns> True if the world or stage is readonly. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern bool ecs_stage_is_readonly([Const] ecs_world_t* world);
/// <summary>
/// <p> Create asynchronous stage. An asynchronous stage can be used to asynchronously queue operations for later merging with the world. An asynchronous stage is similar to a regular stage, except that it does not allow reading from the world. </p>
/// <p> Asynchronous stages are never merged automatically, and must therefore be manually merged with the ecs_merge function. It is not necessary to call defer_begin or defer_end before and after enqueuing commands, as an asynchronous stage unconditionally defers operations. </p>
/// <p> The application must ensure that no commands are added to the stage while the stage is being merged. </p>
/// <p> An asynchronous stage must be cleaned up by ecs_async_stage_free. </p>
/// </summary>
/// <param name="world"> The world. </param>
/// <returns> The stage. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_world_t* ecs_async_stage_new(ecs_world_t* world);
/// <summary> Free asynchronous stage. The provided stage must be an asynchronous stage. If a non-asynchronous stage is provided, the operation will fail. </summary>
/// <param name="stage"> The stage to free. </param>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_async_stage_free(ecs_world_t* stage);
/// <summary> Test whether provided stage is asynchronous. </summary>
/// <param name="stage"> The stage. </param>
/// <returns> True when the stage is asynchronous, false for a regular stage or world. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern bool ecs_stage_is_async(ecs_world_t* stage);
/// <summary> Set a world context. This operation allows an application to register custom data with a world that can be accessed anywhere where the application has the world. </summary>
/// <param name="world"> The world. </param>
/// <param name="ctx"> A pointer to a user defined structure. </param>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_set_context(ecs_world_t* world, void* ctx);
/// <summary> Get the world context. This operation retrieves a previously set world context. </summary>
/// <param name="world"> The world. </param>
/// <returns> The context set with ecs_set_context. If no context was set, the function returns NULL. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void* ecs_get_context([Const] ecs_world_t* world);
/// <summary> Get world info. </summary>
/// <param name="world"> The world. </param>
/// <returns> Pointer to the world info. This pointer will remain valid for as long as the world is valid. </returns>
[return: Const]
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_world_info_t* ecs_get_world_info([Const] ecs_world_t* world);
/// <summary> Dimension the world for a specified number of entities. This operation will preallocate memory in the world for the specified number of entities. Specifying a number lower than the current number of entities in the world will have no effect. </summary>
/// <param name="world"> The world. </param>
/// <param name="entity_count"> The number of entities to preallocate. </param>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_dim(ecs_world_t* world, int entity_count);
/// <summary>
/// <p> Set a range for issueing new entity ids. This function constrains the entity identifiers returned by ecs_new to the specified range. This operation can be used to ensure that multiple processes can run in the same simulation without requiring a central service that coordinates issueing identifiers. </p>
/// <p> If id_end is set to 0, the range is infinite. If id_end is set to a non-zero value, it has to be larger than id_start. If id_end is set and ecs_new is invoked after an id is issued that is equal to id_end, the application will abort. </p>
/// </summary>
/// <param name="world"> The world. </param>
/// <param name="id_start"> The start of the range. </param>
/// <param name="id_end"> The end of the range. </param>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_set_entity_range(ecs_world_t* world, ecs_entity_t id_start, ecs_entity_t id_end);
/// <summary> Enable/disable range limits. When an application is both a receiver of range-limited entities and a producer of range-limited entities, range checking needs to be temporarily disabled when inserting received entities. Range checking is disabled on a stage, so setting this value is thread safe. </summary>
/// <param name="world"> The world. </param>
/// <param name="enable"> True if range checking should be enabled, false to disable. </param>
/// <returns> The previous value. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern bool ecs_enable_range_check(ecs_world_t* world, bool enable);
/// <summary>
/// <p> Force aperiodic actions. The world may delay certain operations until they are necessary for the application to function correctly. This may cause observable side effects such as delayed triggering of events, which can be inconvenient when for example running a test suite. </p>
/// <p> The flags parameter specifies which aperiodic actions to run. Specify 0 to run all actions. Supported flags start with 'EcsAperiodic'. Flags identify internal mechanisms and may change unannounced. </p>
/// </summary>
/// <param name="world"> The world. </param>
/// <param name="flags"> The flags specifying which actions to run. </param>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_run_aperiodic(ecs_world_t* world, uint flags);
/// <summary>
/// <p> Cleanup empty tables. This operation cleans up empty tables that meet certain conditions. Having large amounts of empty tables does not negatively impact performance of the ECS, but can take up considerable amounts of memory, especially in applications with many components, and many components per entity. </p>
/// <p> The generation specifies the minimum number of times this operation has to be called before an empty table is cleaned up. If a table becomes non empty, the generation is reset. </p>
/// <p> The operation allows for both a "clear" generation and a "delete" generation. When the clear generation is reached, the table's resources are freed (like component arrays) but the table itself is not deleted. When the delete generation is reached, the empty table is deleted. </p>
/// <p> By specifying a non-zero id the cleanup logic can be limited to tables with a specific (component) id. The operation will only increase the generation count of matching tables. </p>
/// <p> The min_id_count specifies a lower bound for the number of components a table should have. Often the more components a table has, the more specific it is and therefore less likely to be reused. </p>
/// <p> The time budget specifies how long the operation should take at most. </p>
/// </summary>
/// <param name="world"> The world. </param>
/// <param name="id"> Optional component filter for the tables to evaluate. </param>
/// <param name="clear_generation"> Free table data when generation &gt; clear_generation. </param>
/// <param name="delete_generation"> Delete table when generation &gt; delete_generation. </param>
/// <param name="min_id_count"> Minimum number of component ids the table should have. </param>
/// <param name="time_budget_seconds"> Amount of time operation is allowed to spend. </param>
/// <returns> Number of deleted tables. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern int ecs_delete_empty_tables(ecs_world_t* world, ecs_id_t id, ushort clear_generation, ushort delete_generation, int min_id_count, double time_budget_seconds);
/// <summary> Get world from poly. </summary>
/// <param name="poly"> A pointer to a poly object. </param>
/// <returns> The world. </returns>
[return: Const]
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_world_t* ecs_get_world([Const] ecs_poly_t* poly);
/// <summary> Get entity from poly. </summary>
/// <param name="poly"> A pointer to a poly object. </param>
/// <returns> Entity associated with the poly object. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_entity_t ecs_get_entity([Const] ecs_poly_t* poly);
/// <summary>
/// <p> Test if pointer is of specified type. Usage: ecs_poly_is(ptr, ecs_world_t). </p>
/// <p> This operation only works for poly types. </p>
/// </summary>
/// <param name="object"> The object to test. </param>
/// <param name="type"> The id of the type. </param>
/// <returns> True if the pointer is of the specified type. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern bool _ecs_poly_is([Const] ecs_poly_t* @object, int type);
/// <summary> Make a pair id. This function is equivalent to using the ecs_pair macro, and is added for convenience to make it easier for non C/C++ bindings to work with pairs. </summary>
/// <param name="first"> The first element of the pair of the pair. </param>
/// <param name="second"> The target of the pair. </param>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_id_t ecs_make_pair(ecs_entity_t first, ecs_entity_t second);
/// <summary> Create new entity id. This operation returns an unused entity id. This operation is guaranteed to return an empty entity as it does not use values set by ecs_set_scope or ecs_set_with. </summary>
/// <param name="world"> The world. </param>
/// <returns> The new entity id. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_entity_t ecs_new_id(ecs_world_t* world);
/// <summary>
/// <p> Create new low id. This operation returns a new low id. Entity ids start after the ECS_HI_COMPONENT_ID constant. This reserves a range of low ids for things like components, and allows parts of the code to optimize operations. </p>
/// <p> Note that ECS_HI_COMPONENT_ID does not represent the maximum number of components that can be created, only the maximum number of components that can take advantage of these optimizations. </p>
/// <p> This operation is guaranteed to return an empty entity as it does not use values set by ecs_set_scope or ecs_set_with. </p>
/// <p> This operation does not recycle ids. </p>
/// </summary>
/// <param name="world"> The world. </param>
/// <returns> The new component id. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_entity_t ecs_new_low_id(ecs_world_t* world);
/// <summary> Create new entity with (component) id. This operation creates a new entity with an optional (component) id. When 0 is passed to the id paramter, no component is added to the new entity. </summary>
/// <param name="world"> The world. </param>
/// <param name="id"> The component id to initialize the new entity with. </param>
/// <returns> The new entity. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_entity_t ecs_new_w_id(ecs_world_t* world, ecs_id_t id);
/// <summary>
/// <p> Find or create an entity. This operation creates a new entity, or modifies an existing one. When a name is set in the ecs_entity_desc_t::name field and ecs_entity_desc_t::entity is not set, the operation will first attempt to find an existing entity by that name. If no entity with that name can be found, it will be created. </p>
/// <p> If both a name and entity handle are provided, the operation will check if the entity name matches with the provided name. If the names do not match, the function will fail and return 0. </p>
/// <p> If an id to a non-existing entity is provided, that entity id become alive. </p>
/// <p> See the documentation of ecs_entity_desc_t for more details. </p>
/// </summary>
/// <param name="world"> The world. </param>
/// <param name="desc"> Entity init parameters. </param>
/// <returns> A handle to the new or existing entity, or 0 if failed. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_entity_t ecs_entity_init(ecs_world_t* world, [Const] ecs_entity_desc_t* desc);
/// <summary>
/// <p> Bulk create/populate new entities. This operation bulk inserts a list of new or predefined entities into a single table. </p>
/// <p> The operation does not take ownership of component arrays provided by the application. Components that are non-trivially copyable will be moved into the storage. </p>
/// <p> The operation will emit OnAdd events for each added id, and OnSet events for each component that has been set. </p>
/// <p> If no entity ids are provided by the application, the returned array of ids points to an internal datastructure which changes when new entities are created/deleted. </p>
/// <p> If as a result of the operation triggers are invoked that deletes entities and no entity ids were provided by the application, the returned array of identifiers may be incorrect. To avoid this problem, an application can first call ecs_bulk_init to create empty entities, copy the array to one that is owned by the application, and then use this array to populate the entities. </p>
/// </summary>
/// <param name="world"> The world. </param>
/// <param name="desc"> Bulk creation parameters. </param>
/// <returns> Array with the list of entity ids created/populated. </returns>
[return: Const]
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_entity_t* ecs_bulk_init(ecs_world_t* world, [Const] ecs_bulk_desc_t* desc);
/// <summary> Create N new entities. This operation is the same as ecs_new_w_id, but creates N entities instead of one and does not recycle ids. </summary>
/// <param name="world"> The world. </param>
/// <param name="id"> The component id to create the entities with. </param>
/// <param name="count"> The number of entities to create. </param>
/// <returns> The first entity id of the newly created entities. </returns>
[return: Const]
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_entity_t* ecs_bulk_new_w_id(ecs_world_t* world, ecs_id_t id, int count);
/// <summary> Clone an entity This operation clones the components of one entity into another entity. If no destination entity is provided, a new entity will be created. Component values are not copied unless copy_value is true. </summary>
/// <param name="world"> The world. </param>
/// <param name="dst"> The entity to copy the components to. </param>
/// <param name="src"> The entity to copy the components from. </param>
/// <param name="copy_value"> If true, the value of components will be copied to dst. </param>
/// <returns> The destination entity. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_entity_t ecs_clone(ecs_world_t* world, ecs_entity_t dst, ecs_entity_t src, bool copy_value);
/// <summary> Delete an entity. This operation will delete an entity and all of its components. The entity id will be recycled. Repeatedly calling ecs_delete without ecs_new or ecs_new_w_id will cause a memory leak as it will cause the list with ids that can be recycled to grow unbounded. </summary>
/// <param name="world"> The world. </param>
/// <param name="entity"> The entity. </param>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_delete(ecs_world_t* world, ecs_entity_t entity);
/// <summary> Delete all entities with the specified id. This will delete all entities (tables) that have the specified id. The id may be a wildcard and/or a pair. </summary>
/// <param name="world"> The world. </param>
/// <param name="id"> The id. </param>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_delete_with(ecs_world_t* world, ecs_id_t id);
/// <summary> Add a (component) id to an entity. This operation adds a single (component) id to an entity. If the entity already has the id, this operation has no side effects. </summary>
/// <param name="world"> The world. </param>
/// <param name="entity"> The entity. </param>
/// <param name="id"> The id to add. </param>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_add_id(ecs_world_t* world, ecs_entity_t entity, ecs_id_t id);
/// <summary> Remove a (component) id from an entity. This operation removes a single (component) id to an entity. If the entity does not have the id, this operation has no side effects. </summary>
/// <param name="world"> The world. </param>
/// <param name="entity"> The entity. </param>
/// <param name="id"> The id to remove. </param>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_remove_id(ecs_world_t* world, ecs_entity_t entity, ecs_id_t id);
/// <summary>
/// <p> Add override for (component) id. Adding an override to an entity ensures that when the entity is instantiated (by adding an IsA relationship to it) the component with the override is copied to a component that is private to the instance. By default components reachable through an IsA relationship are shared. </p>
/// <p> Adding an override does not add the component. If an override is added to an entity that does not have the component, it will still be added to the instance, but with an uninitialized value (unless the component has a ctor). When the entity does have the entity, the component of the instance will be initialized with the value of the component on the entity. </p>
/// <p> This is the same as what happens when calling ecs_add_id for an id that is inherited (reachable through an IsA relationship). </p>
/// <p> This operation is equivalent to doing: ecs_add_id(world, entity, ECS_OVERRIDE | id);. </p>
/// </summary>
/// <param name="world"> The world. </param>
/// <param name="entity"> The entity. </param>
/// <param name="id"> The id to override. </param>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_override_id(ecs_world_t* world, ecs_entity_t entity, ecs_id_t id);
/// <summary> Clear all components. This operation will clear all components from an entity but will not delete the entity itself. This effectively prevents the entity id from being recycled. </summary>
/// <param name="world"> The world. </param>
/// <param name="entity"> The entity. </param>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_clear(ecs_world_t* world, ecs_entity_t entity);
/// <summary> Remove all instances of the specified id. This will remove the specified id from all entities (tables). Teh id may be a wildcard and/or a pair. </summary>
/// <param name="world"> The world. </param>
/// <param name="id"> The id. </param>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_remove_all(ecs_world_t* world, ecs_id_t id);
/// <summary> Set current with id. New entities are automatically created with the specified id. </summary>
/// <param name="world"> The world. </param>
/// <param name="id"> The id. </param>
/// <returns> The previous id. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_entity_t ecs_set_with(ecs_world_t* world, ecs_id_t id);
/// <summary> Get current with id. Get the id set with ecs_set_with. </summary>
/// <param name="world"> The world. </param>
/// <returns> The last id provided to ecs_set_with. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_id_t ecs_get_with([Const] ecs_world_t* world);
/// <summary> Enable or disable entity. This operation enables or disables an entity by adding or removing the EcsDisabled tag. A disabled entity will not be matched with any systems, unless the system explicitly specifies the EcsDisabled tag. </summary>
/// <param name="world"> The world. </param>
/// <param name="entity"> The entity to enable or disable. </param>
/// <param name="enabled"> true to enable the entity, false to disable. </param>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_enable(ecs_world_t* world, ecs_entity_t entity, bool enabled);
/// <summary> Enable or disable component. Enabling or disabling a component does not add or remove a component from an entity, but prevents it from being matched with queries. This operation can be useful when a component must be temporarily disabled without destroying its value. It is also a more performant operation for when an application needs to add/remove components at high frequency, as enabling/disabling is cheaper than a regular add or remove. </summary>
/// <param name="world"> The world. </param>
/// <param name="entity"> The entity. </param>
/// <param name="id"> The component. </param>
/// <param name="enable"> True to enable the component, false to disable. </param>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_enable_id(ecs_world_t* world, ecs_entity_t entity, ecs_id_t id, bool enable);
/// <summary> Test if component is enabled. Test whether a component is currently enabled or disabled. This operation will return true when the entity has the component and if it has not been disabled by ecs_enable_component. </summary>
/// <param name="world"> The world. </param>
/// <param name="entity"> The entity. </param>
/// <param name="id"> The component. </param>
/// <returns> True if the component is enabled, otherwise false. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern bool ecs_is_enabled_id([Const] ecs_world_t* world, ecs_entity_t entity, ecs_id_t id);
/// <summary> Get an immutable pointer to a component. This operation obtains a const pointer to the requested component. The operation accepts the component entity id. </summary>
/// <param name="world"> The world. </param>
/// <param name="entity"> The entity. </param>
/// <param name="id"> The id of the component to get. </param>
/// <returns> The component pointer, NULL if the entity does not have the component. </returns>
[return: Const]
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void* ecs_get_id([Const] ecs_world_t* world, ecs_entity_t entity, ecs_id_t id);
/// <summary> Create a component ref. A ref is a handle to an entity + component which caches a small amount of data to reduce overhead of repeatedly accessing the component. Use ecs_ref_get to get the component data. </summary>
/// <param name="world"> The world. </param>
/// <param name="entity"> The entity. </param>
/// <param name="id"> The id of the component. </param>
/// <returns> The reference. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_ref_t ecs_ref_init_id([Const] ecs_world_t* world, ecs_entity_t entity, ecs_id_t id);
/// <summary> Get component from ref. Get component pointer from ref. The ref must be created with ecs_ref_init. </summary>
/// <param name="world"> The world. </param>
/// <param name="ref"> The ref. </param>
/// <param name="id"> The component id. </param>
/// <returns> The component pointer, NULL if the entity does not have the component. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void* ecs_ref_get_id([Const] ecs_world_t* world, ecs_ref_t* @ref, ecs_id_t id);
/// <summary> Update ref. Ensures contents of ref are up to date. Same as ecs_ref_get_id, but does not return pointer to component id. </summary>
/// <param name="world"> The world. </param>
/// <param name="ref"> The ref. </param>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_ref_update([Const] ecs_world_t* world, ecs_ref_t* @ref);
/// <summary>
/// <p> Get a mutable pointer to a component. This operation is similar to ecs_get_id but it returns a mutable pointer. If this operation is invoked from inside a system, the entity will be staged and a pointer to the staged component will be returned. </p>
/// <p> If the entity did not yet have the component, the component will be added by this operation. In this case the is_added out parameter will be set to true. </p>
/// </summary>
/// <param name="world"> The world. </param>
/// <param name="entity"> The entity. </param>
/// <param name="id"> The entity id of the component to obtain. </param>
/// <returns> The component pointer. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void* ecs_get_mut_id(ecs_world_t* world, ecs_entity_t entity, ecs_id_t id);
/// <summary>
/// <p> Begin exclusive write access to entity. This operation provides safe exclusive access to the components of an entity without the overhead of deferring operations. </p>
/// <p> When this operation is called simultaneously for the same entity more than once it will throw an assert. Note that for this to happen, asserts must be enabled. It is up to the application to ensure that access is exclusive, for example by using a read-write mutex. </p>
/// <p> Exclusive access is enforced at the table level, so only one entity can be exclusively accessed per table. The exclusive access check is thread safe. </p>
/// <p> This operation must be followed up with ecs_write_end. </p>
/// </summary>
/// <param name="world"> The world. </param>
/// <param name="entity"> The entity. </param>
/// <returns> A record to the entity. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_record_t* ecs_write_begin(ecs_world_t* world, ecs_entity_t entity);
/// <summary> End exclusive write access to entity. This operation ends exclusive access, and must be called after ecs_write_begin. </summary>
/// <param name="record"> Record to the entity. </param>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_write_end(ecs_record_t* record);
/// <summary>
/// <p> Begin read access to entity. This operation provides safe read access to the components of an entity. Multiple simultaneous reads are allowed per entity. </p>
/// <p> This operation ensures that code attempting to mutate the entity's table will throw an assert. Note that for this to happen, asserts must be enabled. It is up to the application to ensure that this does not happen, for example by using a read-write mutex. </p>
/// <p> This operation does *not* provide the same guarantees as a read-write mutex, as it is possible to call ecs_read_begin after calling ecs_write_begin. It is up to application has to ensure that this does not happen. </p>
/// <p> This operation must be followed up with ecs_read_end. </p>
/// </summary>
/// <param name="world"> The world. </param>
/// <param name="entity"> The entity. </param>
/// <returns> A record to the entity. </returns>
[return: Const]
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_record_t* ecs_read_begin(ecs_world_t* world, ecs_entity_t entity);
/// <summary> End read access to entity. This operation ends read access, and must be called after ecs_read_begin. </summary>
/// <param name="record"> Record to the entity. </param>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_read_end([Const] ecs_record_t* record);
/// <summary>
/// <p> Get component from entity record. This operation returns a pointer to a component for the entity associated with the provided record. For safe access to the component, obtain the record with ecs_read_begin or ecs_write_begin. </p>
/// <p> Obtaining a component from a record is faster than obtaining it from the entity handle, as it reduces the number of lookups required. </p>
/// </summary>
/// <param name="world"> The world. </param>
/// <param name="record"> Record to the entity. </param>
/// <param name="id"> The (component) id. </param>
/// <returns> Pointer to component, or NULL if entity does not have the component. </returns>
[return: Const]
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void* ecs_record_get_id(ecs_world_t* world, [Const] ecs_record_t* record, ecs_id_t id);
/// <summary> Same as ecs_record_get_id, but returns a mutable pointer. For safe access to the component, obtain the record with ecs_write_begin. </summary>
/// <param name="world"> The world. </param>
/// <param name="record"> Record to the entity. </param>
/// <param name="id"> The (component) id. </param>
/// <returns> Pointer to component, or NULL if entity does not have the component. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void* ecs_record_get_mut_id(ecs_world_t* world, ecs_record_t* record, ecs_id_t id);
/// <summary>
/// <p> Emplace a component. Emplace is similar to get_mut except that the component constructor is not invoked for the returned pointer, allowing the component to be "constructed" directly in the storage. </p>
/// <p> Emplace can only be used if the entity does not yet have the component. If the entity has the component, the operation will fail. </p>
/// </summary>
/// <param name="world"> The world. </param>
/// <param name="entity"> The entity. </param>
/// <param name="id"> The component to obtain. </param>
/// <returns> The (uninitialized) component pointer. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void* ecs_emplace_id(ecs_world_t* world, ecs_entity_t entity, ecs_id_t id);
/// <summary>
/// <p> Signal that a component has been modified. This operation allows an application to signal to Flecs that a component has been modified. As a result, OnSet systems will be invoked. </p>
/// <p> This operation is commonly used together with ecs_get_mut. </p>
/// </summary>
/// <param name="world"> The world. </param>
/// <param name="entity"> The entity. </param>
/// <param name="id"> The id of the component that was modified. </param>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_modified_id(ecs_world_t* world, ecs_entity_t entity, ecs_id_t id);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_entity_t ecs_set_id(ecs_world_t* world, ecs_entity_t entity, ecs_id_t id, int size, [Const] void* ptr);
/// <summary>
/// <p> Test whether an entity is valid. Entities that are valid can be used with API functions. </p>
/// <p> An entity is valid if it is not 0 and if it is alive. If the provided id is a pair, the contents of the pair will be checked for validity. </p>
/// <p> is_valid will return true for ids that don't exist (alive or not alive). This allows for using ids that have never been created by ecs_new or similar. In this the function differs from ecs_is_alive, which will return false for entities that do not yet exist. </p>
/// <p> The operation will return false for an id that exists and is not alive, as using this id with an API operation would cause it to assert. </p>
/// </summary>
/// <param name="world"> The world. </param>
/// <param name="e"> The entity. </param>
/// <returns> True if the entity is valid, false if the entity is not valid. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern bool ecs_is_valid([Const] ecs_world_t* world, ecs_entity_t e);
/// <summary> Test whether an entity is alive. An entity is alive when it has been returned by ecs_new (or similar) or if it is not empty (componentts have been explicitly added to the id). </summary>
/// <param name="world"> The world. </param>
/// <param name="e"> The entity. </param>
/// <returns> True if the entity is alive, false if the entity is not alive. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern bool ecs_is_alive([Const] ecs_world_t* world, ecs_entity_t e);
/// <summary> Remove generation from entity id. </summary>
/// <param name="e"> The entity id. </param>
/// <returns> The entity id without the generation count. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_id_t ecs_strip_generation(ecs_entity_t e);
/// <summary>
/// <p> Override the generation of an entity. The generation count of an entity is increased each time an entity is deleted and is used to test whether an entity id is alive. </p>
/// <p> This operation overrides the current generation of an entity with the specified generation, which can be useful if an entity is externally managed, like for external pools, savefiles or netcode. </p>
/// </summary>
/// <param name="world"> The world. </param>
/// <param name="entity"> Entity for which to set the generation with the new generation. </param>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_set_entity_generation(ecs_world_t* world, ecs_entity_t entity);
/// <summary>
/// <p> Get alive identifier. In some cases an application may need to work with identifiers from which the generation has been stripped. A typical scenario in which this happens is when iterating relationships in an entity type. </p>
/// <p> For example, when obtaining the parent id from a ChildOf relationship, the parent (second element of the pair) will have been stored in a 32 bit value, which cannot store the entity generation. This function can retrieve the identifier with the current generation for that id. </p>
/// <p> If the provided identifier is not alive, the function will return 0. </p>
/// </summary>
/// <param name="world"> The world. </param>
/// <param name="e"> The for which to obtain the current alive entity id. </param>
/// <returns> The alive entity id if there is one, or 0 if the id is not alive. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_entity_t ecs_get_alive([Const] ecs_world_t* world, ecs_entity_t e);
/// <summary>
/// <p> Ensure id is alive. This operation ensures that the provided id is alive. This is useful in scenarios where an application has an existing id that has not been created with ecs_new (such as a global constant or an id from a remote application). </p>
/// <p> When this operation is successful it guarantees that the provided id exists, is valid and is alive. </p>
/// <p> Before this operation the id must either not be alive or have a generation that is equal to the passed in entity. </p>
/// <p> If the provided id has a non-zero generation count and the id does not exist in the world, the id will be created with the specified generation. </p>
/// <p> If the provided id is alive and has a generation count that does not match the provided id, the operation will fail. </p>
/// </summary>
/// <param name="world"> The world. </param>
/// <param name="entity"> The entity id to make alive. </param>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_ensure(ecs_world_t* world, ecs_entity_t entity);
/// <summary>
/// <p> Same as ecs_ensure, but for (component) ids. An id can be an entity or pair, and can contain id flags. This operation ensures that the entity (or entities, for a pair) are alive. </p>
/// <p> When this operation is successful it guarantees that the provided id can be used in operations that accept an id. </p>
/// <p> Since entities in a pair do not encode their generation ids, this operation will not fail when an entity with non-zero generation count already exists in the world. </p>
/// <p> This is different from ecs_ensure, which will fail if attempted with an id that has generation 0 and an entity with a non-zero generation is currently alive. </p>
/// </summary>
/// <param name="world"> The world. </param>
/// <param name="id"> The id to make alive. </param>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_ensure_id(ecs_world_t* world, ecs_id_t id);
/// <summary> Test whether an entity exists. Similar as ecs_is_alive, but ignores entity generation count. </summary>
/// <param name="world"> The world. </param>
/// <param name="entity"> The entity. </param>
/// <returns> True if the entity exists, false if the entity does not exist. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern bool ecs_exists([Const] ecs_world_t* world, ecs_entity_t entity);
/// <summary> Get the type of an entity. </summary>
/// <param name="world"> The world. </param>
/// <param name="entity"> The entity. </param>
/// <returns> The type of the entity, NULL if the entity has no components. </returns>
[return: Const]
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_type_t* ecs_get_type([Const] ecs_world_t* world, ecs_entity_t entity);
/// <summary> Get the table of an entity. </summary>
/// <param name="world"> The world. </param>
/// <param name="entity"> The entity. </param>
/// <returns> The table of the entity, NULL if the entity has no components/tags. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_table_t* ecs_get_table([Const] ecs_world_t* world, ecs_entity_t entity);
/// <summary> Convert type to string. The result of this operation must be freed with ecs_os_free. </summary>
/// <param name="world"> The world. </param>
/// <param name="type"> The type. </param>
/// <returns> The stringified type. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern char* ecs_type_str([Const] ecs_world_t* world, [Const] ecs_type_t* type);
/// <summary> Convert table to string. Same as ecs_type_str(world, ecs_table_get_type(table)). The result of this operation must be freed with ecs_os_free. </summary>
/// <param name="world"> The world. </param>
/// <param name="table"> The table. </param>
/// <returns> The stringified table type. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern char* ecs_table_str([Const] ecs_world_t* world, [Const] ecs_table_t* table);
/// <summary>
/// <p> Convert entity to string. Same as combining: - ecs_get_fullpath(world, entity) - ecs_type_str(world, ecs_get_type(world, entity)). </p>
/// <p> The result of this operation must be freed with ecs_os_free. </p>
/// </summary>
/// <param name="world"> The world. </param>
/// <param name="entity"> The entity. </param>
/// <returns> The entity path with stringified type. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern char* ecs_entity_str([Const] ecs_world_t* world, ecs_entity_t entity);
/// <summary> Test if an entity has an entity. This operation returns true if the entity has the provided entity in its type. </summary>
/// <param name="world"> The world. </param>
/// <param name="entity"> The entity. </param>
/// <param name="id"> The id to test for. </param>
/// <returns> True if the entity has the entity, false if not. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern bool ecs_has_id([Const] ecs_world_t* world, ecs_entity_t entity, ecs_id_t id);
/// <summary>
/// <p> Get the target of a relationship. This will return a target (second element of a pair) of the entity for the specified relationship. The index allows for iterating through the targets, if a single entity has multiple targets for the same relationship. </p>
/// <p> If the index is larger than the total number of instances the entity has for the relationship, the operation will return 0. </p>
/// </summary>
/// <param name="world"> The world. </param>
/// <param name="entity"> The entity. </param>
/// <param name="rel"> The relationship between the entity and the target. </param>
/// <param name="index"> The index of the relationship instance. </param>
/// <returns> The target for the relationship at the specified index. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_entity_t ecs_get_target([Const] ecs_world_t* world, ecs_entity_t entity, ecs_entity_t rel, int index);
/// <summary>
/// <p> Get the target of a relationship for a given id. This operation returns the first entity that has the provided id by following the specified relationship. If the entity itself has the id then entity will be returned. If the id cannot be found on the entity or by following the relationship, the operation will return 0. </p>
/// <p> This operation can be used to lookup, for example, which prefab is providing a component by specifying the IsA relationship:. </p>
/// <p> // Is Position provided by the entity or one of its base entities? ecs_get_target_for_id(world, entity, EcsIsA, ecs_id(Position)). </p>
/// </summary>
/// <param name="world"> The world. </param>
/// <param name="entity"> The entity. </param>
/// <param name="rel"> The relationship to follow. </param>
/// <param name="id"> The id to lookup. </param>
/// <returns> The entity for which the target has been found. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_entity_t ecs_get_target_for_id([Const] ecs_world_t* world, ecs_entity_t entity, ecs_entity_t rel, ecs_id_t id);
/// <summary> Return depth for entity in tree for relationship rel. Depth is determined by counting the number of targets encountered while traversing up the relationship tree for rel. Only acyclic relationships are supported. </summary>
/// <param name="world"> The world. </param>
/// <param name="entity"> The entity. </param>
/// <param name="rel"> The relationship. </param>
/// <returns> The depth of the entity in the tree. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern int ecs_get_depth([Const] ecs_world_t* world, ecs_entity_t entity, ecs_entity_t rel);
/// <summary> Count entities that have the specified id. Returns the number of entities that have the specified id. </summary>
/// <param name="world"> The world. </param>
/// <param name="entity"> The id to search for. </param>
/// <returns> The number of entities that have the id. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern int ecs_count_id([Const] ecs_world_t* world, ecs_id_t entity);
/// <summary> Get the name of an entity. This will return the name stored in (EcsIdentifier, EcsName). </summary>
/// <param name="world"> The world. </param>
/// <param name="entity"> The entity. </param>
/// <returns> The type of the entity, NULL if the entity has no name. </returns>
[return: Const]
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern char* ecs_get_name([Const] ecs_world_t* world, ecs_entity_t entity);
/// <summary> Get the symbol of an entity. This will return the symbol stored in (EcsIdentifier, EcsSymbol). </summary>
/// <param name="world"> The world. </param>
/// <param name="entity"> The entity. </param>
/// <returns> The type of the entity, NULL if the entity has no name. </returns>
[return: Const]
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern char* ecs_get_symbol([Const] ecs_world_t* world, ecs_entity_t entity);
/// <summary>
/// <p> Set the name of an entity. This will set or overwrite the name of an entity. If no entity is provided, a new entity will be created. </p>
/// <p> The name is stored in (EcsIdentifier, EcsName). </p>
/// </summary>
/// <param name="world"> The world. </param>
/// <param name="entity"> The entity. </param>
/// <param name="name"> The name. </param>
/// <returns> The provided entity, or a new entity if 0 was provided. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_entity_t ecs_set_name(ecs_world_t* world, ecs_entity_t entity, [Const] char* name);
/// <summary>
/// <p> Set the symbol of an entity. This will set or overwrite the symbol of an entity. If no entity is provided, a new entity will be created. </p>
/// <p> The symbol is stored in (EcsIdentifier, EcsSymbol). </p>
/// </summary>
/// <param name="world"> The world. </param>
/// <param name="entity"> The entity. </param>
/// <param name="symbol"> The symbol. </param>
/// <returns> The provided entity, or a new entity if 0 was provided. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_entity_t ecs_set_symbol(ecs_world_t* world, ecs_entity_t entity, [Const] char* symbol);
/// <summary>
/// <p> Set alias for entity. An entity can be looked up using its alias from the root scope without providing the fully qualified name if its parent. An entity can only have a single alias. </p>
/// <p> The symbol is stored in (EcsIdentifier, EcsAlias). </p>
/// </summary>
/// <param name="world"> The world. </param>
/// <param name="entity"> The entity. </param>
/// <param name="alias"> The alias. </param>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_set_alias(ecs_world_t* world, ecs_entity_t entity, [Const] char* alias);
/// <summary> Lookup an entity by name. Returns an entity that matches the specified name. Only looks for entities in the current scope (root if no scope is provided). </summary>
/// <param name="world"> The world. </param>
/// <param name="name"> The entity name. </param>
/// <returns> The entity with the specified name, or 0 if no entity was found. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_entity_t ecs_lookup([Const] ecs_world_t* world, [Const] char* name);
/// <summary> Lookup a child entity by name. Returns an entity that matches the specified name. Only looks for entities in the provided parent. If no parent is provided, look in the current scope ( root if no scope is provided). </summary>
/// <param name="world"> The world. </param>
/// <param name="name"> The entity name. </param>
/// <returns> The entity with the specified name, or 0 if no entity was found. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_entity_t ecs_lookup_child([Const] ecs_world_t* world, ecs_entity_t parent, [Const] char* name);
/// <summary>
/// <p> Lookup an entity from a path. Lookup an entity from a provided path, relative to the provided parent. The operation will use the provided separator to tokenize the path expression. If the provided path contains the prefix, the search will start from the root. </p>
/// <p> If the entity is not found in the provided parent, the operation will continue to search in the parent of the parent, until the root is reached. If the entity is still not found, the lookup will search in the flecs.core scope. If the entity is not found there either, the function returns 0. </p>
/// </summary>
/// <param name="world"> The world. </param>
/// <param name="parent"> The entity from which to resolve the path. </param>
/// <param name="path"> The path to resolve. </param>
/// <param name="sep"> The path separator. </param>
/// <param name="prefix"> The path prefix. </param>
/// <param name="recursive"> Recursively traverse up the tree until entity is found. </param>
/// <returns> The entity if found, else 0. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_entity_t ecs_lookup_path_w_sep([Const] ecs_world_t* world, ecs_entity_t parent, [Const] char* path, [Const] char* sep, [Const] char* prefix, bool recursive);
/// <summary>
/// <p> Lookup an entity by its symbol name. This looks up an entity by symbol stored in (EcsIdentifier, EcsSymbol). The operation does not take into account hierarchies. </p>
/// <p> This operation can be useful to resolve, for example, a type by its C identifier, which does not include the Flecs namespacing. </p>
/// </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_entity_t ecs_lookup_symbol([Const] ecs_world_t* world, [Const] char* symbol, bool lookup_as_path);
/// <summary>
/// <p> Get a path identifier for an entity. This operation creates a path that contains the names of the entities from the specified parent to the provided entity, separated by the provided separator. If no parent is provided the path will be relative to the root. If a prefix is provided, the path will be prefixed by the prefix. </p>
/// <p> If the parent is equal to the provided child, the operation will return an empty string. If a nonzero component is provided, the path will be created by looking for parents with that component. </p>
/// <p> The returned path should be freed by the application. </p>
/// </summary>
/// <param name="world"> The world. </param>
/// <param name="parent"> The entity from which to create the path. </param>
/// <param name="child"> The entity to which to create the path. </param>
/// <param name="sep"> The separator to use between path elements. </param>
/// <param name="prefix"> The initial character to use for root elements. </param>
/// <returns> The relative entity path. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern char* ecs_get_path_w_sep([Const] ecs_world_t* world, ecs_entity_t parent, ecs_entity_t child, [Const] char* sep, [Const] char* prefix);
/// <summary> Write path identifier to buffer. Same as ecs_get_path_w_sep, but writes result to an ecs_strbuf_t. </summary>
/// <param name="world"> The world. </param>
/// <param name="parent"> The entity from which to create the path. </param>
/// <param name="child"> The entity to which to create the path. </param>
/// <param name="sep"> The separator to use between path elements. </param>
/// <param name="prefix"> The initial character to use for root elements. </param>
/// <param name="buf"> The buffer to write to. </param>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_get_path_w_sep_buf([Const] ecs_world_t* world, ecs_entity_t parent, ecs_entity_t child, [Const] char* sep, [Const] char* prefix, ecs_strbuf_t* buf);
/// <summary>
/// <p> Find or create entity from path. This operation will find or create an entity from a path, and will create any intermediate entities if required. If the entity already exists, no entities will be created. </p>
/// <p> If the path starts with the prefix, then the entity will be created from the root scope. </p>
/// </summary>
/// <param name="world"> The world. </param>
/// <param name="parent"> The entity relative to which the entity should be created. </param>
/// <param name="path"> The path to create the entity for. </param>
/// <param name="sep"> The separator used in the path. </param>
/// <param name="prefix"> The prefix used in the path. </param>
/// <returns> The entity. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_entity_t ecs_new_from_path_w_sep(ecs_world_t* world, ecs_entity_t parent, [Const] char* path, [Const] char* sep, [Const] char* prefix);
/// <summary>
/// <p> Add specified path to entity. This operation is similar to ecs_new_from_path, but will instead add the path to an existing entity. </p>
/// <p> If an entity already exists for the path, it will be returned instead. </p>
/// </summary>
/// <param name="world"> The world. </param>
/// <param name="entity"> The entity to which to add the path. </param>
/// <param name="parent"> The entity relative to which the entity should be created. </param>
/// <param name="path"> The path to create the entity for. </param>
/// <param name="sep"> The separator used in the path. </param>
/// <param name="prefix"> The prefix used in the path. </param>
/// <returns> The entity. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_entity_t ecs_add_path_w_sep(ecs_world_t* world, ecs_entity_t entity, ecs_entity_t parent, [Const] char* path, [Const] char* sep, [Const] char* prefix);
/// <summary>
/// <p> Set the current scope. This operation sets the scope of the current stage to the provided entity. As a result new entities will be created in this scope, and lookups will be relative to the provided scope. </p>
/// <p> It is considered good practice to restore the scope to the old value. </p>
/// </summary>
/// <param name="world"> The world. </param>
/// <param name="scope"> The entity to use as scope. </param>
/// <returns> The previous scope. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_entity_t ecs_set_scope(ecs_world_t* world, ecs_entity_t scope);
/// <summary> Get the current scope. Get the scope set by ecs_set_scope. If no scope is set, this operation will return 0. </summary>
/// <param name="world"> The world. </param>
/// <returns> The current scope. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_entity_t ecs_get_scope([Const] ecs_world_t* world);
/// <summary> Set a name prefix for newly created entities. This is a utility that lets C modules use prefixed names for C types and C functions, while using names for the entity names that do not have the prefix. The name prefix is currently only used by ECS_COMPONENT. </summary>
/// <param name="world"> The world. </param>
/// <param name="prefix"> The name prefix to use. </param>
/// <returns> The previous prefix. </returns>
[return: Const]
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern char* ecs_set_name_prefix(ecs_world_t* world, [Const] char* prefix);
/// <summary>
/// <p> Set search path for lookup operations. This operation accepts an array of entity ids that will be used as search scopes by lookup operations. The operation returns the current search path. It is good practice to restore the old search path. </p>
/// <p> The search path will be evaluated starting from the last element. </p>
/// <p> The default search path includes flecs.core. When a custom search path is provided it overwrites the existing search path. Operations that rely on looking up names from flecs.core without providing the namespace may fail if the custom search path does not include flecs.core (EcsFlecsCore). </p>
/// <p> The search path array is not copied into managed memory. The application must ensure that the provided array is valid for as long as it is used as the search path. </p>
/// <p> The provided array must be terminated with a 0 element. This enables an application to push/pop elements to an existing array without invoking the ecs_set_lookup_path operation again. </p>
/// </summary>
/// <param name="world"> The world. </param>
/// <param name="lookup_path"> 0-terminated array with entity ids for the lookup path. </param>
/// <returns> Current lookup path array. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_entity_t* ecs_set_lookup_path(ecs_world_t* world, [Const] ecs_entity_t* lookup_path);
/// <summary> Get current lookup path. Returns value set by ecs_set_lookup_path. </summary>
/// <param name="world"> The world. </param>
/// <returns> The current lookup path. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_entity_t* ecs_get_lookup_path([Const] ecs_world_t* world);
/// <summary>
/// <p> Find or create a component. This operation creates a new component, or finds an existing one. The find or create behavior is the same as ecs_entity_init. </p>
/// <p> When an existing component is found, the size and alignment are verified with the provided values. If the values do not match, the operation will fail. </p>
/// <p> See the documentation of ecs_component_desc_t for more details. </p>
/// </summary>
/// <param name="world"> The world. </param>
/// <param name="desc"> Component init parameters. </param>
/// <returns> A handle to the new or existing component, or 0 if failed. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_entity_t ecs_component_init(ecs_world_t* world, [Const] ecs_component_desc_t* desc);
/// <summary>
/// <p> Register hooks for component. Hooks allow for the execution of user code when components are constructed, copied, moved, destructed, added, removed or set. Hooks can be assigned as as long as a component has not yet been used (added to an entity). </p>
/// <p> The hooks that are currently set can be accessed with ecs_get_type_info. </p>
/// </summary>
/// <param name="world"> The world. </param>
/// <param name="id"> The component id for which to register the actions. </param>
/// <param name="hooks"> Type that contains the component actions. </param>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_set_hooks_id(ecs_world_t* world, ecs_entity_t id, [Const] ecs_type_hooks_t* hooks);
/// <summary> Get hooks for component. </summary>
/// <param name="world"> The world. </param>
/// <param name="id"> The component id for which to retrieve the hooks. </param>
/// <returns> The hooks for the component, or NULL if not registered. </returns>
[return: Const]
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_type_hooks_t* ecs_get_hooks_id(ecs_world_t* world, ecs_entity_t id);
/// <summary>
/// <p> Returns whether specified id a tag. This operation returns whether the specified type is a tag (a component without data/size). </p>
/// <p> An id is a tag when: - it is an entity without the EcsComponent component - it has an EcsComponent with size member set to 0 - it is a pair where both elements are a tag - it is a pair where the first element has the EcsTag tag. </p>
/// </summary>
/// <param name="world"> The world. </param>
/// <param name="id"> The id. </param>
/// <returns> Whether the provided id is a tag. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_entity_t ecs_id_is_tag([Const] ecs_world_t* world, ecs_id_t id);
/// <summary> Returns whether specified id is in use. This operation returns whether an id is in use in the world. An id is in use if it has been added to one or more tables. </summary>
/// <param name="world"> The world. </param>
/// <param name="id"> The id. </param>
/// <returns> Whether the id is in use. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern bool ecs_id_in_use(ecs_world_t* world, ecs_id_t id);
/// <summary> Get the type for an id. This function returnsthe type information for an id. The specified id can be any valid id. For the rules on how type information is determined based on id, see ecs_get_typeid. </summary>
/// <param name="world"> The world. </param>
/// <param name="id"> The id. </param>
/// <returns> The type information of the id. </returns>
[return: Const]
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_type_info_t* ecs_get_type_info([Const] ecs_world_t* world, ecs_id_t id);
/// <summary>
/// <p> Get the type for an id. This operation returns the component id for an id, if the id is associated with a type. For a regular component with a non-zero size (an entity with the EcsComponent component) the operation will return the entity itself. </p>
/// <p> For an entity that does not have the EcsComponent component, or with an EcsComponent value with size 0, the operation will return 0. </p>
/// <p> For a pair id the operation will return the type associated with the pair, by applying the following rules in order: - The first pair element is returned if it is a component - 0 is returned if the relationship entity has the Tag property - The second pair element is returned if it is a component - 0 is returned. </p>
/// </summary>
/// <param name="world"> The world. </param>
/// <param name="id"> The id. </param>
/// <returns> The type id of the id. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_entity_t ecs_get_typeid([Const] ecs_world_t* world, ecs_id_t id);
/// <summary> Utility to match an id with a pattern. This operation returns true if the provided pattern matches the provided id. The pattern may contain a wildcard (or wildcards, when a pair). </summary>
/// <param name="id"> The id. </param>
/// <param name="pattern"> The pattern to compare with. </param>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern bool ecs_id_match(ecs_id_t id, ecs_id_t pattern);
/// <summary> Utility to check if id is a pair. </summary>
/// <param name="id"> The id. </param>
/// <returns> True if id is a pair. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern bool ecs_id_is_pair(ecs_id_t id);
/// <summary> Utility to check if id is a wildcard. </summary>
/// <param name="id"> The id. </param>
/// <returns> True if id is a wildcard or a pair containing a wildcard. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern bool ecs_id_is_wildcard(ecs_id_t id);
/// <summary>
/// <p> Utility to check if id is valid. A valid id is an id that can be added to an entity. Invalid ids are: - ids that contain wildcards - ids that contain invalid entities - ids that are 0 or contain 0 entities. </p>
/// <p> Note that the same rules apply to removing from an entity, with the exception of wildcards. </p>
/// </summary>
/// <param name="world"> The world. </param>
/// <param name="id"> The id. </param>
/// <returns> True if the id is valid. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern bool ecs_id_is_valid([Const] ecs_world_t* world, ecs_id_t id);
/// <summary> Get flags associated with id. This operation returns the internal flags (see api_flags.h) that are associated with the provided id. </summary>
/// <param name="world"> The world. </param>
/// <param name="id"> The id. </param>
/// <returns> Flags associated with the id, or 0 if the id is not in use. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern uint ecs_id_get_flags([Const] ecs_world_t* world, ecs_id_t id);
/// <summary> Convert id flag to string. This operation converts a id flag to a string. </summary>
/// <param name="id_flags"> The id flag. </param>
/// <returns> The id flag string, or NULL if no valid id is provided. </returns>
[return: Const]
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern char* ecs_id_flag_str(ecs_id_t id_flags);
/// <summary> Convert id to string. This operation interprets the structure of an id and converts it to a string. </summary>
/// <param name="world"> The world. </param>
/// <param name="id"> The id to convert to a string. </param>
/// <returns> The id converted to a string. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern char* ecs_id_str([Const] ecs_world_t* world, ecs_id_t id);
/// <summary> Write id string to buffer. Same as ecs_id_str but writes result to ecs_strbuf_t. </summary>
/// <param name="world"> The world. </param>
/// <param name="id"> The id to convert to a string. </param>
/// <param name="buf"> The buffer to write to. </param>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_id_str_buf([Const] ecs_world_t* world, ecs_id_t id, ecs_strbuf_t* buf);
/// <summary> Iterator for a single (component) id. A term iterator returns all entities (tables) that match a single (component) id. The search for the matching set of entities (tables) is performed in constant time. </summary>
/// <param name="world"> The world. </param>
/// <param name="term"> The term. </param>
/// <returns> The iterator. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_iter_t ecs_term_iter([Const] ecs_world_t* world, ecs_term_t* term);
/// <summary> Return a chained term iterator. A chained iterator applies a filter to the results of the input iterator. The resulting iterator must be iterated with ecs_term_next. </summary>
/// <param name="it"> The input iterator. </param>
/// <param name="term"> The term filter to apply to the iterator. </param>
/// <returns> The chained iterator. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_iter_t ecs_term_chain_iter([Const] ecs_iter_t* it, ecs_term_t* term);
/// <summary> Progress a term iterator. This operation progresses the term iterator to the next table. The iterator must have been initialized with `ecs_term_iter`. This operation must be invoked at least once before interpreting the contents of the iterator. </summary>
/// <param name="it"> The iterator. </param>
//// CXComment_BlockCommand
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern bool ecs_term_next(ecs_iter_t* it);
/// <summary> Iterator for a parent's children. This operation is equivalent to a term iterator for (ChildOf, parent). Iterate the result with ecs_children_next. </summary>
/// <param name="world"> The world. </param>
/// <param name="parent"> The parent for which to iterate the children. </param>
/// <returns> The iterator. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_iter_t ecs_children([Const] ecs_world_t* world, ecs_entity_t parent);
/// <summary> Progress a children iterator. Equivalent to ecs_term_next. </summary>
/// <param name="it"> The iterator. </param>
//// CXComment_BlockCommand
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern bool ecs_children_next(ecs_iter_t* it);
/// <summary> Test whether term id is set. </summary>
/// <param name="id"> The term id. </param>
/// <returns> True when set, false when not set. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern bool ecs_term_id_is_set([Const] ecs_term_id_t* id);
/// <summary>
/// <p> Test whether a term is set. This operation can be used to test whether a term has been initialized with values or whether it is empty. </p>
/// <p> An application generally does not need to invoke this operation. It is useful when initializing a 0-initialized array of terms (like in ecs_term_desc_t) as this operation can be used to find the last initialized element. </p>
/// </summary>
/// <param name="term"> The term. </param>
/// <returns> True when set, false when not set. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern bool ecs_term_is_initialized([Const] ecs_term_t* term);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern bool ecs_term_match_this([Const] ecs_term_t* term);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern bool ecs_term_match_0([Const] ecs_term_t* term);
/// <summary>
/// <p> Finalize term. Ensure that all fields of a term are consistent and filled out. This operation should be invoked before using and after assigning members to, or parsing a term. When a term contains unresolved identifiers, this operation will resolve and assign the identifiers. If the term contains any identifiers that cannot be resolved, the operation will fail. </p>
/// <p> An application generally does not need to invoke this operation as the APIs that use terms (such as filters, queries and triggers) will finalize terms when they are created. </p>
/// <p> The name and expr parameters are optional, and only used for giving more descriptive error messages. </p>
/// </summary>
/// <param name="world"> The world. </param>
/// <param name="term"> The term to finalize. </param>
/// <returns> Zero if success, nonzero if an error occurred. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern int ecs_term_finalize([Const] ecs_world_t* world, ecs_term_t* term);
/// <summary> Copy resources of a term to another term. This operation copies one term to another term. If the source term contains allocated resources (such as identifiers), they will be duplicated so that no memory is shared between the terms. </summary>
/// <param name="src"> The term to copy from. </param>
/// <returns> The destination term. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_term_t ecs_term_copy([Const] ecs_term_t* src);
/// <summary>
/// <p> Move resources of a term to another term. Same as copy, but moves resources from src, if src-&gt;move is set to true. If src-&gt;move is not set to true, this operation will do a copy. </p>
/// <p> The conditional move reduces redundant allocations in scenarios where a list of terms is partially created with allocated resources. </p>
/// </summary>
/// <param name="src"> The term to move from. </param>
/// <returns> The destination term. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_term_t ecs_term_move(ecs_term_t* src);
/// <summary> Free resources of term. This operation frees all resources (such as identifiers) of a term. The term itself is not freed. </summary>
/// <param name="term"> The term to free. </param>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_term_fini(ecs_term_t* term);
/// <summary>
/// <p> Initialize filter A filter is a lightweight object that can be used to query for entities in a world. Filters, as opposed to queries, do not cache results. They are therefore slower to iterate, but are faster to create. </p>
/// <p> When a filter is copied by value, make sure to use "ecs_filter_move" to ensure that the terms pointer still points to the inline array:. </p>
/// <p> ecs_filter_move( &dst _filter, &src _filter). </p>
/// <p> Alternatively, the ecs_filter_move function can be called with both arguments set to the same filter, to ensure the pointer is valid:. </p>
/// <p> ecs_filter_move( &f , &f ). </p>
/// <p> It is possible to create a filter without allocating any memory, by setting the .storage member in ecs_filter_desc_t. See the documentation for the member for more details. </p>
/// </summary>
/// <param name="world"> The world. </param>
/// <param name="desc"> Properties for the filter to create. </param>
/// <returns> The filter if successful, NULL if not successful. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_filter_t* ecs_filter_init(ecs_world_t* world, [Const] ecs_filter_desc_t* desc);
/// <summary> Deinitialize filter. Free resources associated with filter. </summary>
/// <param name="filter"> The filter to deinitialize. </param>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_filter_fini(ecs_filter_t* filter);
/// <summary>
/// <p> Finalize filter. When manually assigning an array of terms to the filter struct (so not when using ecs_filter_init), this operation should be used to ensure that all terms are assigned properly and all (derived) fields have been set. </p>
/// <p> When ecs_filter_init is used to create the filter, this function should not be called. The purpose of this operation is to support creation of filters without allocating memory. </p>
/// </summary>
/// <param name="filter"> The filter to finalize. </param>
/// <returns> Zero if filter is valid, non-zero if it contains errors. @. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern int ecs_filter_finalize([Const] ecs_world_t* world, ecs_filter_t* filter);
/// <summary>
/// <p> Find index for This variable. This operation looks up the index of the This variable. This index can be used in operations like ecs_iter_set_var and ecs_iter_get_var. </p>
/// <p> The operation will return -1 if the variable was not found. This happens when a filter only has terms that are not matched on the This variable, like a filter that exclusively matches singleton components. </p>
/// </summary>
/// <param name="filter"> The rule. </param>
/// <returns> The index of the This variable. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern int ecs_filter_find_this_var([Const] ecs_filter_t* filter);
/// <summary> Convert ter, to string expression. Convert term to a string expression. The resulting expression is equivalent to the same term, with the exception of And & Or operators. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern char* ecs_term_str([Const] ecs_world_t* world, [Const] ecs_term_t* term);
/// <summary> Convert filter to string expression. Convert filter terms to a string expression. The resulting expression can be parsed to create the same filter. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern char* ecs_filter_str([Const] ecs_world_t* world, [Const] ecs_filter_t* filter);
/// <summary> Return a filter iterator. A filter iterator lets an application iterate over entities that match the specified filter. If NULL is provided for the filter, the iterator will iterate all tables in the world. </summary>
/// <param name="world"> The world. </param>
/// <param name="filter"> The filter. </param>
/// <returns> An iterator that can be used with ecs_filter_next. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_iter_t ecs_filter_iter([Const] ecs_world_t* world, [Const] ecs_filter_t* filter);
/// <summary> Return a chained filter iterator. A chained iterator applies a filter to the results of the input iterator. The resulting iterator must be iterated with ecs_filter_next. </summary>
/// <param name="it"> The input iterator. </param>
/// <param name="filter"> The filter to apply to the iterator. </param>
/// <returns> The chained iterator. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_iter_t ecs_filter_chain_iter([Const] ecs_iter_t* it, [Const] ecs_filter_t* filter);
/// <summary>
/// <p> Get pivot term for filter. The pivot term is the term that matches the smallest set of tables, and is a good default starting point for a search. </p>
/// <p> The following conditions must be met for a term to be considered as pivot: - It must have a This subject - It must have the And operator. </p>
/// <p> When a filter does not have any terms that match those conditions, it will return -1. </p>
/// <p> If one or more terms in the filter have no matching tables the filter won't yield any results. In this case the operation will return -2 which gives a search function the option to early out. </p>
/// </summary>
/// <param name="world"> The world. </param>
/// <param name="filter"> The filter. </param>
/// <returns> Index of the pivot term (use with filter-&gt;terms). </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern int ecs_filter_pivot_term([Const] ecs_world_t* world, [Const] ecs_filter_t* filter);
/// <summary> Iterate tables matched by filter. This operation progresses the filter iterator to the next table. The iterator must have been initialized with `ecs_filter_iter`. This operation must be invoked at least once before interpreting the contents of the iterator. </summary>
/// <param name="it"> The iterator. </param>
/// <returns> True if more data is available, false if not. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern bool ecs_filter_next(ecs_iter_t* it);
/// <summary> Same as ecs_filter_next, but always instanced. See instanced property of ecs_filter_desc_t. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern bool ecs_filter_next_instanced(ecs_iter_t* it);
/// <summary> Move resources of one filter to another. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_filter_move(ecs_filter_t* dst, ecs_filter_t* src);
/// <summary> Copy resources of one filter to another. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_filter_copy(ecs_filter_t* dst, [Const] ecs_filter_t* src);
/// <summary>
/// <p> Create a query. This operation creates a query. Queries are used to iterate over entities that match a filter and are the fastest way to find and iterate over entities and their components. </p>
/// <p> Queries should be created once, and reused multiple times. While iterating a query is a cheap operation, creating and deleting a query is expensive. The reason for this is that queries are "prematched", which means that a query stores state about which entities (or rather, tables) match with the query. Building up this state happens during query creation. </p>
/// <p> Once a query is created, matching only happens when new tables are created. In most applications this is an infrequent process, since it only occurs when a new combination of components is introduced. While matching is expensive, it is importent to note that matching does not happen on a per-entity basis, but on a per-table basis. This means that the average time spent on matching per frame should rapidly approach zero over the lifetime of an application. </p>
/// <p> A query provides direct access to the component arrays. When an application creates/deletes entities or adds/removes components, these arrays can shift component values around, or may grow in size. This can cause unexpected or undefined behavior to occur if these operations are performed while iterating. To prevent this from happening an application should either not perform these operations while iterating, or use deferred operations (see ecs_defer_begin and ecs_defer_end). </p>
/// <p> Queries can be created and deleted dynamically. If a query was not deleted (using ecs_query_fini) before the world is deleted, it will be deleted automatically. </p>
/// </summary>
/// <param name="world"> The world. </param>
/// <param name="desc"> A structure describing the query properties. </param>
/// <returns> The new query. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_query_t* ecs_query_init(ecs_world_t* world, [Const] ecs_query_desc_t* desc);
/// <summary> Destroy a query. This operation destroys a query and its resources. If the query is used as the parent of subqueries, those subqueries will be orphaned and must be deinitialized as well. </summary>
/// <param name="query"> The query. </param>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_query_fini(ecs_query_t* query);
/// <summary> Get filter from a query. This operation obtains a pointer to the internally constructed filter of the query and can be used to introspect the query terms. </summary>
/// <param name="query"> The query. </param>
[return: Const]
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_filter_t* ecs_query_get_filter(ecs_query_t* query);
/// <summary>
/// <p> Return a query iterator. A query iterator lets an application iterate over entities that match the specified query. If a sorting function is specified, the query will check whether a resort is required upon creating the iterator. </p>
/// <p> Creating a query iterator is a cheap operation that does not allocate any resources. An application does not need to deinitialize or free a query iterator before it goes out of scope. </p>
/// <p> To iterate the iterator, an application should use ecs_query_next to progress the iterator and test if it has data. </p>
/// <p> Query iteration requires an outer and an inner loop. The outer loop uses ecs_query_next to test if new tables are available. The inner loop iterates the entities in the table, and is usually a for loop that uses iter.count to loop through the entities and component arrays. </p>
/// <p> The two loops are necessary because of how data is stored internally. Entities are grouped by the components they have, in tables. A single query can (and often does) match with multiple tables. Because each table has its own set of arrays, an application has to reobtain pointers to those arrays for each matching table. </p>
/// </summary>
/// <param name="world"> The world or stage, when iterating in readonly mode. </param>
/// <param name="query"> The query to iterate. </param>
/// <returns> The query iterator. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_iter_t ecs_query_iter([Const] ecs_world_t* world, ecs_query_t* query);
/// <summary> Progress the query iterator. This operation progresses the query iterator to the next table. The iterator must have been initialized with `ecs_query_iter`. This operation must be invoked at least once before interpreting the contents of the iterator. </summary>
/// <param name="iter"> The iterator. </param>
//// CXComment_BlockCommand
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern bool ecs_query_next(ecs_iter_t* iter);
/// <summary> Same as ecs_query_next, but always instanced. See "instanced" property of ecs_filter_desc_t. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern bool ecs_query_next_instanced(ecs_iter_t* iter);
/// <summary>
/// <p> Fast alternative to ecs_query_next that only returns matched tables. This operation only populates the ecs_iter_t::table field. To access the matched components, call ecs_query_populate. </p>
/// <p> If this operation is used with a query that has inout/out terms, those terms will not be marked dirty unless ecs_query_populate is called. </p>
/// </summary>
/// <param name="iter"> The iterator. </param>
//// CXComment_BlockCommand
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern bool ecs_query_next_table(ecs_iter_t* iter);
/// <summary>
/// <p> Populate iterator fields. This operation can be combined with ecs_query_next_table to populate the iterator fields for the current table. </p>
/// <p> Populating fields conditionally can save time when a query uses change detection, and only needs iterator data when the table has changed. When this operation is called, inout/out terms will be marked dirty. </p>
/// <p> In cases where inout/out terms are conditionally written and no changes were made after calling ecs_query_populate, the ecs_query_skip function can be called to prevent the matched table components from being marked dirty. </p>
/// <p> This operation does should not be used with queries that match disabled components, union relationships, or with queries that use order_by. </p>
/// </summary>
/// <param name="iter"> The iterator. </param>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_query_populate(ecs_iter_t* iter);
/// <summary>
/// <p> Returns whether the query data changed since the last iteration. The operation will return true after: - new entities have been matched with - new tables have been matched/unmatched with - matched entities were deleted - matched components were changed. </p>
/// <p> The operation will not return true after a write-only (EcsOut) or filter (EcsInOutNone) term has changed, when a term is not matched with the current table (This subject) or for tag terms. </p>
/// <p> The changed state of a table is reset after it is iterated. If a iterator was not iterated until completion, tables may still be marked as changed. </p>
/// <p> If no iterator is provided the operation will return the changed state of the all matched tables of the query. </p>
/// <p> If an iterator is provided, the operation will return the changed state of the currently returned iterator result. The following preconditions must be met before using an iterator with change detection:. </p>
/// <p> - The iterator is a query iterator (created with ecs_query_iter) - The iterator must be valid (ecs_query_next must have returned true) - The iterator must be instanced. </p>
/// </summary>
/// <param name="query"> The query (optional if 'it' is provided). </param>
/// <param name="it"> The iterator result to test (optional if 'query' is provided). </param>
/// <returns> true if entities changed, otherwise false. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern bool ecs_query_changed(ecs_query_t* query, [Const] ecs_iter_t* it);
/// <summary>
/// <p> Skip a table while iterating. This operation lets the query iterator know that a table was skipped while iterating. A skipped table will not reset its changed state, and the query will not update the dirty flags of the table for its out columns. </p>
/// <p> Only valid iterators must be provided (next has to be called at least once & return true) and the iterator must be a query iterator. </p>
/// </summary>
/// <param name="it"> The iterator result to skip. </param>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_query_skip(ecs_iter_t* it);
/// <summary>
/// <p> Set group to iterate for query iterator. This operation limits the results returned by the query to only the selected group id. The query must have a group_by function, and the iterator must be a query iterator. </p>
/// <p> Groups are sets of tables that are stored together in the query cache based on a group id, which is calculated per table by the group_by function. To iterate a group, an iterator only needs to know the first and last cache node for that group, which can both be found in a fast O(1) operation. </p>
/// <p> As a result, group iteration is one of the most efficient mechanisms to filter out large numbers of entities, even if those entities are distributed across many tables. This makes it a good fit for things like dividing up a world into cells, and only iterating cells close to a player. </p>
/// <p> The group to iterate must be set before the first call to ecs_query_next. No operations that can add/remove components should be invoked between calling ecs_query_set_group and ecs_query_next. </p>
/// </summary>
/// <param name="it"> The query iterator. </param>
/// <param name="group_id"> The group to iterate. </param>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_query_set_group(ecs_iter_t* it, ulong group_id);
/// <summary> Get context of query group. This operation returns the context of a query group as returned by the on_group_create callback. </summary>
/// <param name="query"> The query. </param>
/// <param name="group_id"> The group for which to obtain the context. </param>
/// <returns> The group context, NULL if the group doesn't exist. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void* ecs_query_get_group_ctx(ecs_query_t* query, ulong group_id);
/// <summary> Get information about query group. This operation returns information about a query group, including the group context returned by the on_group_create callback. </summary>
/// <param name="query"> The query. </param>
/// <param name="group_id"> The group for which to obtain the group info. </param>
/// <returns> The group info, NULL if the group doesn't exist. </returns>
[return: Const]
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_query_group_info_t* ecs_query_get_group_info(ecs_query_t* query, ulong group_id);
/// <summary> Returns whether query is orphaned. When the parent query of a subquery is deleted, it is left in an orphaned state. The only valid operation on an orphaned query is deleting it. Only subqueries can be orphaned. </summary>
/// <param name="query"> The query. </param>
/// <returns> true if query is orphaned, otherwise false. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern bool ecs_query_orphaned(ecs_query_t* query);
/// <summary> Convert query to string. </summary>
/// <param name="query"> The query. </param>
/// <returns> The query string. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern char* ecs_query_str([Const] ecs_query_t* query);
/// <summary> Returns number of tables query matched with. </summary>
/// <param name="query"> The query. </param>
/// <returns> The number of matched tables. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern int ecs_query_table_count([Const] ecs_query_t* query);
/// <summary> Returns number of empty tables query matched with. </summary>
/// <param name="query"> The query. </param>
/// <returns> The number of matched empty tables. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern int ecs_query_empty_table_count([Const] ecs_query_t* query);
/// <summary> Returns number of entities query matched with. This operation iterates all non-empty tables in the query cache to find the total number of entities. </summary>
/// <param name="query"> The query. </param>
/// <returns> The number of matched entities. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern int ecs_query_entity_count([Const] ecs_query_t* query);
/// <summary>
/// <p> Send event. This sends an event to matching triggers & is the mechanism used by flecs itself to send OnAdd, OnRemove, etc events. </p>
/// <p> Applications can use this function to send custom events, where a custom event can be any regular entity. </p>
/// <p> Applications should not send builtin flecs events, as this may violate assumptions the code makes about the conditions under which those events are sent. </p>
/// <p> Triggers are invoked synchronously. It is therefore safe to use stack-based data as event context, which can be set in the "param" member. </p>
/// <p> To send a notification for a single entity, an application should set the following members in the event descriptor:. </p>
/// <p> - table: set to the table of the entity - offset: set to the row of the entity in the table - count: set to 1. </p>
/// <p> The table & row of the entity can be obtained like this: ecs_record_t *r = ecs_record_find(world, e); desc.table = r-&gt;table; desc.offset = ECS_RECORD_TO_ROW(r-&gt;row);. </p>
/// </summary>
/// <param name="world"> The world. </param>
/// <param name="desc"> Event parameters. </param>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_emit(ecs_world_t* world, ecs_event_desc_t* desc);
/// <summary>
/// <p> Create observer. Observers are like triggers, but can subscribe for multiple terms. An observer only triggers when the source of the event meets all terms. </p>
/// <p> See the documentation for ecs_observer_desc_t for more details. </p>
/// </summary>
/// <param name="world"> The world. </param>
/// <param name="desc"> The observer creation parameters. </param>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_entity_t ecs_observer_init(ecs_world_t* world, [Const] ecs_observer_desc_t* desc);
/// <summary> Default run action for observer. This function can be called from a custom observer run action (see ecs_observer_desc_t::run for more details). This function ensures that the observer's filter is applied to the iterator's table, filters out duplicate events and implements EcsMonitor logic. </summary>
/// <param name="it"> The iterator. </param>
/// <returns> True if the observer was invoked. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern bool ecs_observer_default_run_action(ecs_iter_t* it);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void* ecs_get_observer_ctx([Const] ecs_world_t* world, ecs_entity_t observer);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void* ecs_get_observer_binding_ctx([Const] ecs_world_t* world, ecs_entity_t observer);
/// <summary>
/// <p> Create iterator from poly object. The provided poly object must have the iterable mixin. If an object is provided that does not have the mixin, the function will assert. </p>
/// <p> When a filter is provided, an array of two iterators must be passed to the function. This allows the mixin implementation to create a chained iterator when necessary, which requires two iterator objects. </p>
/// <p> If a filter is provided, the first element in the array of two iterators is the one that should be iterated. The mixin implementation may or may not set the second element, depending on whether an iterator chain is required. </p>
/// <p> Additionally, when a filter is provided the returned iterator will be for a single term with the provided filter id. If the iterator is chained, the previous iterator in the chain can be accessed through it-&gt;chain_it. </p>
/// </summary>
/// <param name="world"> The world or stage for which to create the iterator. </param>
/// <param name="poly"> The poly object from which to create the iterator. </param>
/// <param name="iter"> The iterator (out, ecs_iter_t[2] when filter is set). </param>
/// <param name="filter"> Optional term used for filtering the results. </param>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_iter_poly([Const] ecs_world_t* world, [Const] ecs_poly_t* poly, ecs_iter_t* iter, ecs_term_t* filter);
/// <summary>
/// <p> Progress any iterator. This operation is useful in combination with iterators for which it is not known what created them. Example use cases are functions that should accept any kind of iterator (such as serializers) or iterators created from poly objects. </p>
/// <p> This operation is slightly slower than using a type-specific iterator (e.g. ecs_filter_next, ecs_query_next) as it has to call a function pointer which introduces a level of indirection. </p>
/// </summary>
/// <param name="it"> The iterator. </param>
/// <returns> True if iterator has more results, false if not. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern bool ecs_iter_next(ecs_iter_t* it);
/// <summary>
/// <p> Cleanup iterator resources. This operation cleans up any resources associated with the iterator. </p>
/// <p> This operation should only be used when an iterator is not iterated until completion (next has not yet returned false). When an iterator is iterated until completion, resources are automatically freed. </p>
/// </summary>
/// <param name="it"> The iterator. </param>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_iter_fini(ecs_iter_t* it);
/// <summary>
/// <p> Count number of matched entities in query. This operation returns the number of matched entities. If a query contains no matched entities but still yields results (e.g. it has no terms with This sources) the operation will return 0. </p>
/// <p> To determine the number of matched entities, the operation iterates the iterator until it yields no more results. </p>
/// </summary>
/// <param name="it"> The iterator. </param>
/// <returns> True if iterator has more results, false if not. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern int ecs_iter_count(ecs_iter_t* it);
/// <summary>
/// <p> Test if iterator is true. This operation will return true if the iterator returns at least one result. This is especially useful in combination with fact-checking rules (see the rules addon). </p>
/// <p> The operation requires a valid iterator. After the operation is invoked, the application should no longer invoke next on the iterator and should treat it as if the iterator is iterated until completion. </p>
/// </summary>
/// <param name="it"> The iterator. </param>
/// <returns> true if the iterator returns at least one result. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern bool ecs_iter_is_true(ecs_iter_t* it);
/// <summary> Get first matching entity from iterator. After this operation the application should treat the iterator as if it has been iterated until completion. </summary>
/// <param name="it"> The iterator. </param>
/// <returns> The first matching entity, or 0 if no entities were matched. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_entity_t ecs_iter_first(ecs_iter_t* it);
/// <summary>
/// <p> Set value for iterator variable. This constrains the iterator to return only results for which the variable equals the specified value. The default value for all variables is EcsWildcard, which means the variable can assume any value. </p>
/// <p> Example:. </p>
/// <p> // Rule that matches (Eats, *) ecs_rule_t *r = ecs_rule_init(world, & (ecs_filter_desc_t){ .terms = { { .first.id = Eats, .second.name = "_Food" } } });. </p>
/// <p> int food_var = ecs_rule_find_var(r, "Food");. </p>
/// <p> // Set Food to Apples, so we're only matching (Eats, Apples) ecs_iter_t it = ecs_rule_iter(world, r); ecs_iter_set_var( &it , food_var, Apples);. </p>
/// <p> while (ecs_rule_next( &it )) { for (int i = 0; i &lt; it.count; i ++) { // iterate as usual } }. </p>
/// <p> The variable must be initialized after creating the iterator and before the first call to next. </p>
/// </summary>
/// <param name="it"> The iterator. </param>
/// <param name="var_id"> The variable index. </param>
/// <param name="entity"> The entity variable value. </param>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_iter_set_var(ecs_iter_t* it, int var_id, ecs_entity_t entity);
/// <summary> Same as ecs_iter_set_var, but for a table. This constrains the variable to all entities in a table. </summary>
/// <param name="it"> The iterator. </param>
/// <param name="var_id"> The variable index. </param>
/// <param name="table"> The table variable value. </param>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_iter_set_var_as_table(ecs_iter_t* it, int var_id, [Const] ecs_table_t* table);
/// <summary> Same as ecs_iter_set_var, but for a range of entities This constrains the variable to a range of entities in a table. </summary>
/// <param name="it"> The iterator. </param>
/// <param name="var_id"> The variable index. </param>
/// <param name="range"> The range variable value. </param>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_iter_set_var_as_range(ecs_iter_t* it, int var_id, [Const] ecs_table_range_t* range);
/// <summary>
/// <p> Get value of iterator variable as entity. A variable can be interpreted as entity if it is set to an entity, or if it is set to a table range with count 1. </p>
/// <p> This operation can only be invoked on valid iterators. The variable index must be smaller than the total number of variables provided by the iterator (as set in ecs_iter_t::variable_count). </p>
/// </summary>
/// <param name="it"> The iterator. </param>
/// <param name="var_id"> The variable index. </param>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_entity_t ecs_iter_get_var(ecs_iter_t* it, int var_id);
/// <summary>
/// <p> Get value of iterator variable as table. A variable can be interpreted as table if it is set as table range with both offset and count set to 0, or if offset is 0 and count matches the number of elements in the table. </p>
/// <p> This operation can only be invoked on valid iterators. The variable index must be smaller than the total number of variables provided by the iterator (as set in ecs_iter_t::variable_count). </p>
/// </summary>
/// <param name="it"> The iterator. </param>
/// <param name="var_id"> The variable index. </param>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_table_t* ecs_iter_get_var_as_table(ecs_iter_t* it, int var_id);
/// <summary>
/// <p> Get value of iterator variable as table range. A value can be interpreted as table range if it is set as table range, or if it is set to an entity with a non-empty type (the entity must have at least one component, tag or relationship in its type). </p>
/// <p> This operation can only be invoked on valid iterators. The variable index must be smaller than the total number of variables provided by the iterator (as set in ecs_iter_t::variable_count). </p>
/// </summary>
/// <param name="it"> The iterator. </param>
/// <param name="var_id"> The variable index. </param>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_table_range_t ecs_iter_get_var_as_range(ecs_iter_t* it, int var_id);
/// <summary>
/// <p> Returns whether variable is constrained. This operation returns true for variables set by one of the ecs_iter_set_var* operations. </p>
/// <p> A constrained variable is guaranteed not to change values while results are being iterated. </p>
/// </summary>
/// <param name="it"> The iterator. </param>
/// <param name="var_id"> The variable index. </param>
/// <returns> Whether the variable is constrained to a specified value. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern bool ecs_iter_var_is_constrained(ecs_iter_t* it, int var_id);
/// <summary>
/// <p> Create a paged iterator. Paged iterators limit the results to those starting from 'offset', and will return at most 'limit' results. </p>
/// <p> The iterator must be iterated with ecs_page_next. </p>
/// <p> A paged iterator acts as a passthrough for data exposed by the parent iterator, so that any data provided by the parent will also be provided by the paged iterator. </p>
/// </summary>
/// <param name="it"> The source iterator. </param>
/// <param name="offset"> The number of entities to skip. </param>
/// <param name="limit"> The maximum number of entities to iterate. </param>
/// <returns> A page iterator. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_iter_t ecs_page_iter([Const] ecs_iter_t* it, int offset, int limit);
/// <summary> Progress a paged iterator. Progresses an iterator created by ecs_page_iter. </summary>
/// <param name="it"> The iterator. </param>
/// <returns> true if iterator has more results, false if not. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern bool ecs_page_next(ecs_iter_t* it);
/// <summary>
/// <p> Create a worker iterator. Worker iterators can be used to equally divide the number of matched entities across N resources (usually threads). Each resource will process the total number of matched entities divided by 'count'. </p>
/// <p> Entities are distributed across resources such that the distribution is stable between queries. Two queries that match the same table are guaranteed to match the same entities in that table. </p>
/// <p> The iterator must be iterated with ecs_worker_next. </p>
/// <p> A worker iterator acts as a passthrough for data exposed by the parent iterator, so that any data provided by the parent will also be provided by the worker iterator. </p>
/// </summary>
/// <param name="it"> The source iterator. </param>
/// <param name="index"> The index of the current resource. </param>
/// <param name="count"> The total number of resources to divide entities between. </param>
/// <returns> A worker iterator. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_iter_t ecs_worker_iter([Const] ecs_iter_t* it, int index, int count);
/// <summary> Progress a worker iterator. Progresses an iterator created by ecs_worker_iter. </summary>
/// <param name="it"> The iterator. </param>
/// <returns> true if iterator has more results, false if not. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern bool ecs_worker_next(ecs_iter_t* it);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void* ecs_field_w_size([Const] ecs_iter_t* it, int size, int index);
/// <summary> Test whether the field is readonly. This operation returns whether the field is readonly. Readonly fields are annotated with [in], or are added as a const type in the C++ API. </summary>
/// <param name="it"> The iterator. </param>
/// <param name="index"> The index of the field in the iterator. </param>
/// <returns> Whether the field is readonly. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern bool ecs_field_is_readonly([Const] ecs_iter_t* it, int index);
/// <summary>
/// <p> Test whether the field is writeonly. This operation returns whether this is a writeonly field. Writeonly terms are annotated with [out]. </p>
/// <p> Serializers are not required to serialize the values of a writeonly field. </p>
/// </summary>
/// <param name="it"> The iterator. </param>
/// <param name="index"> The index of the field in the iterator. </param>
/// <returns> Whether the field is writeonly. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern bool ecs_field_is_writeonly([Const] ecs_iter_t* it, int index);
/// <summary> Test whether field is set. </summary>
/// <param name="it"> The iterator. </param>
/// <param name="index"> The index of the field in the iterator. </param>
/// <returns> Whether the field is set. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern bool ecs_field_is_set([Const] ecs_iter_t* it, int index);
/// <summary> Return id matched for field. </summary>
/// <param name="it"> The iterator. </param>
/// <param name="index"> The index of the field in the iterator. </param>
/// <returns> The id matched for the field. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_id_t ecs_field_id([Const] ecs_iter_t* it, int index);
/// <summary> Return field source. The field source is the entity on which the field was matched. </summary>
/// <param name="it"> The iterator. </param>
/// <param name="index"> The index of the field in the iterator. </param>
/// <returns> The source for the field. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_entity_t ecs_field_src([Const] ecs_iter_t* it, int index);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern int ecs_field_size([Const] ecs_iter_t* it, int index);
/// <summary>
/// <p> Test whether the field is matched on self. This operation returns whether the field is matched on the currently iterated entity. This function will return false when the field is owned by another entity, such as a parent or a prefab. </p>
/// <p> When this operation returns false, the field must be accessed as a single value instead of an array. Fields for which this operation returns true return arrays with it-&gt;count values. </p>
/// </summary>
/// <param name="it"> The iterator. </param>
/// <param name="index"> The index of the field in the iterator. </param>
/// <returns> Whether the field is matched on self. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern bool ecs_field_is_self([Const] ecs_iter_t* it, int index);
/// <summary>
/// <p> Convert iterator to string. Prints the contents of an iterator to a string. Useful for debugging and/or testing the output of an iterator. </p>
/// <p> The function only converts the currently iterated data to a string. To convert all data, the application has to manually call the next function and call ecs_iter_str on each result. </p>
/// </summary>
/// <param name="it"> The iterator. </param>
/// <returns> A string representing the contents of the iterator. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern char* ecs_iter_str([Const] ecs_iter_t* it);
/// <summary> Get type for table. </summary>
/// <param name="table"> The table. </param>
/// <returns> The type of the table. </returns>
[return: Const]
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_type_t* ecs_table_get_type([Const] ecs_table_t* table);
/// <summary> Get column from table. This operation returns the component array for the provided index. </summary>
/// <param name="table"> The table. </param>
/// <param name="index"> The index of the column (corresponds with element in type). </param>
/// <param name="offset"> The index of the first row to return (0 for entire column). </param>
/// <returns> The component array, or NULL if the index is not a component. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void* ecs_table_get_column([Const] ecs_table_t* table, int index, int offset);
/// <summary> Get column index for id. This operation returns the index for an id in the table's type. </summary>
/// <param name="world"> The world. </param>
/// <param name="table"> The table. </param>
/// <param name="id"> The id. </param>
/// <returns> The index of the id in the table type, or -1 if not found. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern int ecs_table_get_index([Const] ecs_world_t* world, [Const] ecs_table_t* table, ecs_id_t id);
/// <summary> Get column from table by component id. This operation returns the component array for the provided component id. </summary>
/// <param name="table"> The table. </param>
/// <param name="id"> The component id for the column. </param>
/// <param name="offset"> The index of the first row to return (0 for entire column). </param>
/// <returns> The component array, or NULL if the index is not a component. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void* ecs_table_get_id([Const] ecs_world_t* world, [Const] ecs_table_t* table, ecs_id_t id, int offset);
/// <summary> Return depth for table in tree for relationship rel. Depth is determined by counting the number of targets encountered while traversing up the relationship tree for rel. Only acyclic relationships are supported. </summary>
/// <param name="world"> The world. </param>
/// <param name="table"> The table. </param>
/// <param name="rel"> The relationship. </param>
/// <returns> The depth of the table in the tree. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern int ecs_table_get_depth([Const] ecs_world_t* world, [Const] ecs_table_t* table, ecs_entity_t rel);
/// <summary> Get storage type for table. </summary>
/// <param name="table"> The table. </param>
/// <returns> The storage type of the table (components only). </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_table_t* ecs_table_get_storage_table([Const] ecs_table_t* table);
/// <summary> Convert index in table type to index in table storage type. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern int ecs_table_type_to_storage_index([Const] ecs_table_t* table, int index);
/// <summary> Convert index in table storage type to index in table type. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern int ecs_table_storage_to_type_index([Const] ecs_table_t* table, int index);
/// <summary> Returns the number of records in the table. This operation returns the number of records that have been populated through the regular (entity) API as well as the number of records that have been inserted using the direct access API. </summary>
/// <param name="table"> The table. </param>
/// <returns> The number of records in a table. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern int ecs_table_count([Const] ecs_table_t* table);
/// <summary> Get table that has all components of current table plus the specified id. If the provided table already has the provided id, the operation will return the provided table. </summary>
/// <param name="world"> The world. </param>
/// <param name="table"> The table. </param>
/// <param name="id"> The id to add. </param>
//// CXComment_BlockCommand
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_table_t* ecs_table_add_id(ecs_world_t* world, ecs_table_t* table, ecs_id_t id);
/// <summary> Get table that has all components of current table minus the specified id. If the provided table doesn't have the provided id, the operation will return the provided table. </summary>
/// <param name="world"> The world. </param>
/// <param name="table"> The table. </param>
/// <param name="id"> The id to remove. </param>
//// CXComment_BlockCommand
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_table_t* ecs_table_remove_id(ecs_world_t* world, ecs_table_t* table, ecs_id_t id);
/// <summary>
/// <p> Lock or unlock table. When a table is locked, modifications to it will throw an assert. When the table is locked recursively, it will take an equal amount of unlock operations to actually unlock the table. </p>
/// <p> Table locks can be used to build safe iterators where it is guaranteed that the contents of a table are not modified while it is being iterated. </p>
/// <p> The operation only works when called on the world, and has no side effects when called on a stage. The assumption is that when called on a stage, operations are deferred already. </p>
/// </summary>
/// <param name="world"> The world. </param>
/// <param name="table"> The table to lock. </param>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_table_lock(ecs_world_t* world, ecs_table_t* table);
/// <summary> Unlock a table. Must be called after calling ecs_table_lock. </summary>
/// <param name="world"> The world. </param>
/// <param name="table"> The table to unlock. </param>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_table_unlock(ecs_world_t* world, ecs_table_t* table);
/// <summary> Returns whether table is a module or contains module contents Returns true for tables that have module contents. Can be used to filter out tables that do not contain application data. </summary>
/// <param name="table"> The table. </param>
/// <returns> true if table contains module contents, false if not. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern bool ecs_table_has_module(ecs_table_t* table);
/// <summary> Swaps two elements inside the table. This is useful for implementing custom table sorting algorithms. </summary>
/// <param name="world"> The world. </param>
/// <param name="table"> The table to swap elements in. </param>
/// <param name="row_1"> Table element to swap with row_2. </param>
/// <param name="row_2"> Table element to swap with row_1. </param>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_table_swap_rows(ecs_world_t* world, ecs_table_t* table, int row_1, int row_2);
/// <summary>
/// <p> Commit (move) entity to a table. This operation moves an entity from its current table to the specified table. This may cause the following actions: - Ctor for each component in the target table - Move for each overlapping component - Dtor for each component in the source table. - OnAdd triggers for non-overlapping components in the target table - OnRemove triggers for non-overlapping components in the source table. </p>
/// <p> This operation is a faster than adding/removing components individually. </p>
/// <p> The application must explicitly provide the difference in components between tables as the added/removed parameters. This can usually be derived directly from the result of ecs_table_add_id and esc_table_remove_id. These arrays are required to properly execute OnAdd/OnRemove triggers. </p>
/// </summary>
/// <param name="world"> The world. </param>
/// <param name="entity"> The entity to commit. </param>
/// <param name="record"> The entity's record (optional, providing it saves a lookup). </param>
/// <param name="table"> The table to commit the entity to. </param>
/// <returns> True if the entity got moved, false otherwise. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern bool ecs_commit(ecs_world_t* world, ecs_entity_t entity, ecs_record_t* record, ecs_table_t* table, [Const] ecs_type_t* added, [Const] ecs_type_t* removed);
/// <summary> Find record for entity. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_record_t* ecs_record_find([Const] ecs_world_t* world, ecs_entity_t entity);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void* ecs_record_get_column([Const] ecs_record_t* r, int column, int c_size);
/// <summary>
/// <p> Search for component id in table type. This operation returns the index of first occurrance of the id in the table type. The id may be a wildcard. </p>
/// <p> When id_out is provided, the function will assign it with the found id. The found id may be different from the provided id if it is a wildcard. </p>
/// <p> This is a constant time operation. </p>
/// </summary>
/// <param name="world"> The world. </param>
/// <param name="table"> The table. </param>
/// <param name="id"> The id to search for. </param>
/// <param name="id_out"> If provided, it will be set to the found id (optional). </param>
/// <returns> The index of the id in the table type. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern int ecs_search([Const] ecs_world_t* world, [Const] ecs_table_t* table, ecs_id_t id, ecs_id_t* id_out);
/// <summary>
/// <p> Search for component id in table type starting from an offset. This operation is the same as ecs_search, but starts searching from an offset in the table type. </p>
/// <p> This operation is typically called in a loop where the resulting index is used in the next iteration as offset:. </p>
/// <p> int32_t index = -1; while ((index = ecs_search_offset(world, table, offset, id, NULL))) { // do stuff }. </p>
/// <p> Depending on how the operation is used it is either linear or constant time. When the id has the form (id) or (rel, *) and the operation is invoked as in the above example, it is guaranteed to be constant time. </p>
/// <p> If the provided id has the form (*, tgt) the operation takes linear time. The reason for this is that ids for an target are not packed together, as they are sorted relationship first. </p>
/// <p> If the id at the offset does not match the provided id, the operation will do a linear search to find a matching id. </p>
/// </summary>
/// <param name="world"> The world. </param>
/// <param name="table"> The table. </param>
/// <param name="offset"> Offset from where to start searching. </param>
/// <param name="id"> The id to search for. </param>
/// <param name="id_out"> If provided, it will be set to the found id (optional). </param>
/// <returns> The index of the id in the table type. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern int ecs_search_offset([Const] ecs_world_t* world, [Const] ecs_table_t* table, int offset, ecs_id_t id, ecs_id_t* id_out);
/// <summary>
/// <p> Search for component/relationship id in table type starting from an offset. This operation is the same as ecs_search_offset, but has the additional capability of traversing relationships to find a component. For example, if an application wants to find a component for either the provided table or a prefab (using the IsA relationship) of that table, it could use the operation like this:. </p>
/// <p> int32_t index = ecs_search_relation( world, // the world table, // the table 0, // offset 0 ecs_id(Position), // the component id EcsIsA, // the relationship to traverse 0, // start at depth 0 (the table itself) 0, // no depth limit NULL, // (optional) entity on which component was found NULL, // see above NULL); // internal type with information about matched id. </p>
/// <p> The operation searches depth first. If a table type has 2 IsA relationships, the operation will first search the IsA tree of the first relationship. </p>
/// <p> When choosing betwen ecs_search, ecs_search_offset and ecs_search_relation, the simpler the function the better its performance. </p>
/// </summary>
/// <param name="world"> The world. </param>
/// <param name="table"> The table. </param>
/// <param name="offset"> Offset from where to start searching. </param>
/// <param name="id"> The id to search for. </param>
/// <param name="rel"> The relationship to traverse (optional). </param>
/// <param name="flags"> Whether to search EcsSelf and/or EcsUp. </param>
/// <param name="subject_out"> If provided, it will be set to the matched entity. </param>
/// <param name="id_out"> If provided, it will be set to the found id (optional). </param>
/// <param name="tr_out"> Internal datatype. </param>
/// <returns> The index of the id in the table type. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern int ecs_search_relation([Const] ecs_world_t* world, [Const] ecs_table_t* table, int offset, ecs_id_t id, ecs_entity_t rel, uint flags, ecs_entity_t* subject_out, ecs_id_t* id_out, void** tr_out);
/// <summary> Construct a value in existing storage. </summary>
/// <param name="world"> The world. </param>
/// <param name="type"> The type of the value to create. </param>
/// <param name="ptr"> Pointer to a value of type 'type'. </param>
/// <returns> Zero if success, nonzero if failed. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern int ecs_value_init([Const] ecs_world_t* world, ecs_entity_t type, void* ptr);
/// <summary> Construct a value in existing storage. </summary>
/// <param name="world"> The world. </param>
/// <param name="ti"> The type info of the type to create. </param>
/// <param name="ptr"> Pointer to a value of type 'type'. </param>
/// <returns> Zero if success, nonzero if failed. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern int ecs_value_init_w_type_info([Const] ecs_world_t* world, [Const] ecs_type_info_t* ti, void* ptr);
/// <summary> Construct a value in new storage. </summary>
/// <param name="world"> The world. </param>
/// <param name="type"> The type of the value to create. </param>
/// <returns> Pointer to type if success, NULL if failed. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void* ecs_value_new(ecs_world_t* world, ecs_entity_t type);
/// <summary> Destruct a value. </summary>
/// <param name="world"> The world. </param>
/// <param name="ti"> Type info of the value to destruct. </param>
/// <param name="ptr"> Pointer to constructed value of type 'type'. </param>
/// <returns> Zero if success, nonzero if failed. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern int ecs_value_fini_w_type_info([Const] ecs_world_t* world, [Const] ecs_type_info_t* ti, void* ptr);
/// <summary> Destruct a value. </summary>
/// <param name="world"> The world. </param>
/// <param name="type"> The type of the value to destruct. </param>
/// <param name="ptr"> Pointer to constructed value of type 'type'. </param>
/// <returns> Zero if success, nonzero if failed. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern int ecs_value_fini([Const] ecs_world_t* world, ecs_entity_t type, void* ptr);
/// <summary> Destruct a value, free storage. </summary>
/// <param name="world"> The world. </param>
/// <param name="type"> The type of the value to destruct. </param>
/// <returns> Zero if success, nonzero if failed. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern int ecs_value_free(ecs_world_t* world, ecs_entity_t type, void* ptr);
/// <summary> Copy value. </summary>
/// <param name="world"> The world. </param>
/// <param name="ti"> Type info of the value to copy. </param>
/// <param name="dst"> Pointer to the storage to copy to. </param>
/// <param name="src"> Pointer to the value to copy. </param>
/// <returns> Zero if success, nonzero if failed. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern int ecs_value_copy_w_type_info([Const] ecs_world_t* world, [Const] ecs_type_info_t* ti, void* dst, [Const] void* src);
/// <summary> Copy value. </summary>
/// <param name="world"> The world. </param>
/// <param name="type"> The type of the value to copy. </param>
/// <param name="dst"> Pointer to the storage to copy to. </param>
/// <param name="src"> Pointer to the value to copy. </param>
/// <returns> Zero if success, nonzero if failed. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern int ecs_value_copy([Const] ecs_world_t* world, ecs_entity_t type, void* dst, [Const] void* src);
/// <summary> Move value. </summary>
/// <param name="world"> The world. </param>
/// <param name="ti"> Type info of the value to move. </param>
/// <param name="dst"> Pointer to the storage to move to. </param>
/// <param name="src"> Pointer to the value to move. </param>
/// <returns> Zero if success, nonzero if failed. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern int ecs_value_move_w_type_info([Const] ecs_world_t* world, [Const] ecs_type_info_t* ti, void* dst, void* src);
/// <summary> Move value. </summary>
/// <param name="world"> The world. </param>
/// <param name="type"> The type of the value to move. </param>
/// <param name="dst"> Pointer to the storage to move to. </param>
/// <param name="src"> Pointer to the value to move. </param>
/// <returns> Zero if success, nonzero if failed. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern int ecs_value_move([Const] ecs_world_t* world, ecs_entity_t type, void* dst, void* src);
/// <summary> Move construct value. </summary>
/// <param name="world"> The world. </param>
/// <param name="ti"> Type info of the value to move. </param>
/// <param name="dst"> Pointer to the storage to move to. </param>
/// <param name="src"> Pointer to the value to move. </param>
/// <returns> Zero if success, nonzero if failed. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern int ecs_value_move_ctor_w_type_info([Const] ecs_world_t* world, [Const] ecs_type_info_t* ti, void* dst, void* src);
/// <summary> Move construct value. </summary>
/// <param name="world"> The world. </param>
/// <param name="type"> The type of the value to move. </param>
/// <param name="dst"> Pointer to the storage to move to. </param>
/// <param name="src"> Pointer to the value to move. </param>
/// <returns> Zero if success, nonzero if failed. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern int ecs_value_move_ctor([Const] ecs_world_t* world, ecs_entity_t type, void* dst, void* src);
/// <summary> ///////////////////////////////////////////////////////////////////////////// / Tracing /////////////////////////////////////////////////////////////////////////////. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void _ecs_deprecated([Const] char* file, int line, [Const] char* msg);
/// <summary> Increase log stack. This operation increases the indent_ value of the OS API and can be useful to make nested behavior more visible. </summary>
/// <param name="level"> The log level. </param>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void _ecs_log_push(int level);
/// <summary> Decrease log stack. This operation decreases the indent_ value of the OS API and can be useful to make nested behavior more visible. </summary>
/// <param name="level"> The log level. </param>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void _ecs_log_pop(int level);
/// <summary> Should current level be logged. This operation returns true when the specified log level should be logged with the current log level. </summary>
/// <param name="level"> The log level to check for. </param>
/// <returns> Whether logging is enabled for the current level. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern bool ecs_should_log(int level);
/// <summary> Get description for error code. </summary>
[return: Const]
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern char* ecs_strerror(int error_code);
/// <summary> ///////////////////////////////////////////////////////////////////////////// / Logging functions (do nothing when logging is enabled) /////////////////////////////////////////////////////////////////////////////. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void _ecs_print(int level, [Const] char* file, int line, [Const] char* fmt);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void _ecs_printv(int level, [Const] char* file, int line, [Const] char* fmt, int args);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void _ecs_log(int level, [Const] char* file, int line, [Const] char* fmt);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void _ecs_logv(int level, [Const] char* file, int line, [Const] char* fmt, int args);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void _ecs_abort(int error_code, [Const] char* file, int line, [Const] char* fmt);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern bool _ecs_assert(bool condition, int error_code, [Const] char* condition_str, [Const] char* file, int line, [Const] char* fmt);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void _ecs_parser_error([Const] char* name, [Const] char* expr, long column, [Const] char* fmt);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void _ecs_parser_errorv([Const] char* name, [Const] char* expr, long column, [Const] char* fmt, int args);
/// <summary>
/// <p> Enable or disable tracing. This will enable builtin tracing. For tracing to work, it will have to be compiled in which requires defining one of the following macros:. </p>
/// <p> FLECS_LOG_0 - All tracing is disabled FLECS_LOG_1 - Enable tracing level 1 FLECS_LOG_2 - Enable tracing level 2 and below FLECS_LOG_3 - Enable tracing level 3 and below. </p>
/// <p> If no tracing level is defined and this is a debug build, FLECS_LOG_3 will have been automatically defined. </p>
/// <p> The provided level corresponds with the tracing level. If -1 is provided as value, warnings are disabled. If -2 is provided, errors are disabled as well. </p>
/// </summary>
/// <param name="level"> Desired tracing level. </param>
/// <returns> Previous tracing level. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern int ecs_log_set_level(int level);
/// <summary> Enable/disable tracing with colors. By default colors are enabled. </summary>
/// <param name="enabled"> Whether to enable tracing with colors. </param>
/// <returns> Previous color setting. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern bool ecs_log_enable_colors(bool enabled);
/// <summary> Enable/disable logging timestamp. By default timestamps are disabled. Note that enabling timestamps introduces overhead as the logging code will need to obtain the current time. </summary>
/// <param name="enabled"> Whether to enable tracing with timestamps. </param>
/// <returns> Previous timestamp setting. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern bool ecs_log_enable_timestamp(bool enabled);
/// <summary>
/// <p> Enable/disable logging time since last log. By default deltatime is disabled. Note that enabling timestamps introduces overhead as the logging code will need to obtain the current time. </p>
/// <p> When enabled, this logs the amount of time in seconds passed since the last log, when this amount is non-zero. The format is a '+' character followed by the number of seconds:. </p>
/// <p> +1 trace: log message. </p>
/// </summary>
/// <param name="enabled"> Whether to enable tracing with timestamps. </param>
/// <returns> Previous timestamp setting. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern bool ecs_log_enable_timedelta(bool enabled);
/// <summary> Get last logged error code. Calling this operation resets the error code. </summary>
/// <returns> Last error, 0 if none was logged since last call to last_error. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern int ecs_log_last_error();
/// <summary>
/// <p> Run application. This will run the application with the parameters specified in desc. After the application quits (ecs_quit is called) the world will be cleaned up. </p>
/// <p> If a custom run action is set, it will be invoked by this operation. The default run action calls the frame action in a loop until it returns a non-zero value. </p>
/// </summary>
/// <param name="world"> The world. </param>
/// <param name="desc"> Application parameters. </param>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern int ecs_app_run(ecs_world_t* world, ecs_app_desc_t* desc);
/// <summary> Default frame callback. This operation will run a single frame. By default this operation will invoke ecs_progress directly, unless a custom frame action is set. </summary>
/// <param name="world"> The world. </param>
/// <param name="desc"> The desc struct passed to ecs_app_run. </param>
/// <returns> value returned by ecs_progress. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern int ecs_app_run_frame(ecs_world_t* world, [Const] ecs_app_desc_t* desc);
/// <summary> Set custom run action. See ecs_app_run. </summary>
/// <param name="callback"> The run action. </param>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern int ecs_app_set_run_action(ecs_app_run_action_t callback);
/// <summary> Set custom frame action. See ecs_app_run_frame. </summary>
/// <param name="callback"> The frame action. </param>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern int ecs_app_set_frame_action(ecs_app_frame_action_t callback);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void FlecsRestImport(ecs_world_t* world);
/// <summary>
/// <p> Set timer timeout. This operation executes any systems associated with the timer after the specified timeout value. If the entity contains an existing timer, the timeout value will be reset. The timer can be started and stopped with ecs_start_timer and ecs_stop_timer. </p>
/// <p> The timer is synchronous, and is incremented each frame by delta_time. </p>
/// <p> The tick_source entity will be be a tick source after this operation. Tick sources can be read by getting the EcsTickSource component. If the tick source ticked this frame, the 'tick' member will be true. When the tick source is a system, the system will tick when the timer ticks. </p>
/// </summary>
/// <param name="world"> The world. </param>
/// <param name="tick_source"> The timer for which to set the timeout (0 to create one). </param>
/// <param name="timeout"> The timeout value. </param>
/// <returns> The timer entity. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_entity_t ecs_set_timeout(ecs_world_t* world, ecs_entity_t tick_source, float timeout);
/// <summary>
/// <p> Get current timeout value for the specified timer. This operation returns the value set by ecs_set_timeout. If no timer is active for this entity, the operation returns 0. </p>
/// <p> After the timeout expires the EcsTimer component is removed from the entity. This means that if ecs_get_timeout is invoked after the timer is expired, the operation will return 0. </p>
/// <p> The timer is synchronous, and is incremented each frame by delta_time. </p>
/// <p> The tick_source entity will be be a tick source after this operation. Tick sources can be read by getting the EcsTickSource component. If the tick source ticked this frame, the 'tick' member will be true. When the tick source is a system, the system will tick when the timer ticks. </p>
/// </summary>
/// <param name="world"> The world. </param>
/// <param name="tick_source"> The timer. </param>
/// <returns> The current timeout value, or 0 if no timer is active. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern float ecs_get_timeout([Const] ecs_world_t* world, ecs_entity_t tick_source);
/// <summary>
/// <p> Set timer interval. This operation will continously invoke systems associated with the timer after the interval period expires. If the entity contains an existing timer, the interval value will be reset. </p>
/// <p> The timer is synchronous, and is incremented each frame by delta_time. </p>
/// <p> The tick_source entity will be be a tick source after this operation. Tick sources can be read by getting the EcsTickSource component. If the tick source ticked this frame, the 'tick' member will be true. When the tick source is a system, the system will tick when the timer ticks. </p>
/// </summary>
/// <param name="world"> The world. </param>
/// <param name="tick_source"> The timer for which to set the interval (0 to create one). </param>
/// <param name="interval"> The interval value. </param>
/// <returns> The timer entity. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_entity_t ecs_set_interval(ecs_world_t* world, ecs_entity_t tick_source, float interval);
/// <summary> Get current interval value for the specified timer. This operation returns the value set by ecs_set_interval. If the entity is not a timer, the operation will return 0. </summary>
/// <param name="world"> The world. </param>
/// <param name="tick_source"> The timer for which to set the interval. </param>
/// <returns> The current interval value, or 0 if no timer is active. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern float ecs_get_interval([Const] ecs_world_t* world, ecs_entity_t tick_source);
/// <summary> Start timer. This operation resets the timer and starts it with the specified timeout. The entity must have the EcsTimer component (added by ecs_set_timeout and ecs_set_interval). If the entity does not have the EcsTimer component this operation will assert. </summary>
/// <param name="world"> The world. </param>
/// <param name="tick_source"> The timer to start. </param>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_start_timer(ecs_world_t* world, ecs_entity_t tick_source);
/// <summary> Stop timer This operation stops a timer from triggering. The entity must have the EcsTimer component or this operation will assert. </summary>
/// <param name="world"> The world. </param>
/// <param name="tick_source"> The timer to stop. </param>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_stop_timer(ecs_world_t* world, ecs_entity_t tick_source);
/// <summary>
/// <p> Set rate filter. This operation initializes a rate filter. Rate filters sample tick sources and tick at a configurable multiple. A rate filter is a tick source itself, which means that rate filters can be chained. </p>
/// <p> Rate filters enable deterministic system execution which cannot be achieved with interval timers alone. For example, if timer A has interval 2.0 and timer B has interval 4.0, it is not guaranteed that B will tick at exactly twice the multiple of A. This is partly due to the indeterministic nature of timers, and partly due to floating point rounding errors. </p>
/// <p> Rate filters can be combined with timers (or other rate filters) to ensure that a system ticks at an exact multiple of a tick source (which can be another system). If a rate filter is created with a rate of 1 it will tick at the exact same time as its source. </p>
/// <p> If no tick source is provided, the rate filter will use the frame tick as source, which corresponds with the number of times ecs_progress is called. </p>
/// <p> The tick_source entity will be be a tick source after this operation. Tick sources can be read by getting the EcsTickSource component. If the tick source ticked this frame, the 'tick' member will be true. When the tick source is a system, the system will tick when the timer ticks. </p>
/// </summary>
/// <param name="world"> The world. </param>
/// <param name="tick_source"> The rate filter entity (0 to create one). </param>
/// <param name="rate"> The rate to apply. </param>
/// <param name="source"> The tick source (0 to use frames). </param>
/// <returns> The filter entity. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_entity_t ecs_set_rate(ecs_world_t* world, ecs_entity_t tick_source, int rate, ecs_entity_t source);
/// <summary>
/// <p> Assign tick source to system. Systems can be their own tick source, which can be any of the tick sources (one shot timers, interval times and rate filters). However, in some cases it is must be guaranteed that different systems tick on the exact same frame. </p>
/// <p> This cannot be guaranteed by giving two systems the same interval/rate filter as it is possible that one system is (for example) disabled, which would cause the systems to go out of sync. To provide these guarantees, systems must use the same tick source, which is what this operation enables. </p>
/// <p> When two systems share the same tick source, it is guaranteed that they tick in the same frame. The provided tick source can be any entity that is a tick source, including another system. If the provided entity is not a tick source the system will not be ran. </p>
/// <p> To disassociate a tick source from a system, use 0 for the tick_source parameter. </p>
/// </summary>
/// <param name="world"> The world. </param>
/// <param name="system"> The system to associate with the timer. </param>
/// <param name="tick_source"> The tick source to associate with the system. </param>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_set_tick_source(ecs_world_t* world, ecs_entity_t system, ecs_entity_t tick_source);
/// <summary> ///////////////////////////////////////////////////////////////////////////// / Module /////////////////////////////////////////////////////////////////////////////. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void FlecsTimerImport(ecs_world_t* world);
/// <summary> Create a custom pipeline. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_entity_t ecs_pipeline_init(ecs_world_t* world, [Const] ecs_pipeline_desc_t* desc);
/// <summary> Set a custom pipeline. This operation sets the pipeline to run when ecs_progress is invoked. </summary>
/// <param name="world"> The world. </param>
/// <param name="pipeline"> The pipeline to set. </param>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_set_pipeline(ecs_world_t* world, ecs_entity_t pipeline);
/// <summary> Get the current pipeline. This operation gets the current pipeline. </summary>
/// <param name="world"> The world. </param>
/// <returns> The current pipeline. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_entity_t ecs_get_pipeline([Const] ecs_world_t* world);
/// <summary>
/// <p> Progress a world. This operation progresses the world by running all systems that are both enabled and periodic on their matching entities. </p>
/// <p> An application can pass a delta_time into the function, which is the time passed since the last frame. This value is passed to systems so they can update entity values proportional to the elapsed time since their last invocation. </p>
/// <p> When an application passes 0 to delta_time, ecs_progress will automatically measure the time passed since the last frame. If an application does not uses time management, it should pass a non-zero value for delta_time (1.0 is recommended). That way, no time will be wasted measuring the time. </p>
/// </summary>
/// <param name="world"> The world to progress. </param>
/// <param name="delta_time"> The time passed since the last frame. </param>
/// <returns> false if ecs_quit has been called, true otherwise. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern bool ecs_progress(ecs_world_t* world, float delta_time);
/// <summary> Set time scale. Increase or decrease simulation speed by the provided multiplier. </summary>
/// <param name="world"> The world. </param>
/// <param name="scale"> The scale to apply (default = 1). </param>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_set_time_scale(ecs_world_t* world, float scale);
/// <summary> Reset world clock. Reset the clock that keeps track of the total time passed in the simulation. </summary>
/// <param name="world"> The world. </param>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_reset_clock(ecs_world_t* world);
/// <summary>
/// <p> Run pipeline. This will run all systems in the provided pipeline. This operation may be invoked from multiple threads, and only when staging is disabled, as the pipeline manages staging and, if necessary, synchronization between threads. </p>
/// <p> If 0 is provided for the pipeline id, the default pipeline will be ran (this is either the builtin pipeline or the pipeline set with set_pipeline()). </p>
/// <p> When using progress() this operation will be invoked automatically for the default pipeline (either the builtin pipeline or the pipeline set with set_pipeline()). An application may run additional pipelines. </p>
/// <p> Note: calling this function from an application currently only works in single threaded applications with a single stage. </p>
/// </summary>
/// <param name="world"> The world. </param>
/// <param name="pipeline"> The pipeline to run. </param>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_run_pipeline(ecs_world_t* world, ecs_entity_t pipeline, float delta_time);
/// <summary> Set number of worker threads. Setting this value to a value higher than 1 will start as many threads and will cause systems to evenly distribute matched entities across threads. The operation may be called multiple times to reconfigure the number of threads used, but never while running a system / pipeline. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_set_threads(ecs_world_t* world, int threads);
/// <summary> ///////////////////////////////////////////////////////////////////////////// / Module /////////////////////////////////////////////////////////////////////////////. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void FlecsPipelineImport(ecs_world_t* world);
/// <summary> Create a system. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_entity_t ecs_system_init(ecs_world_t* world, [Const] ecs_system_desc_t* desc);
/// <summary>
/// <p> Run a specific system manually. This operation runs a single system manually. It is an efficient way to invoke logic on a set of entities, as manual systems are only matched to tables at creation time or after creation time, when a new table is created. </p>
/// <p> Manual systems are useful to evaluate lists of prematched entities at application defined times. Because none of the matching logic is evaluated before the system is invoked, manual systems are much more efficient than manually obtaining a list of entities and retrieving their components. </p>
/// <p> An application may pass custom data to a system through the param parameter. This data can be accessed by the system through the param member in the ecs_iter_t value that is passed to the system callback. </p>
/// <p> Any system may interrupt execution by setting the interrupted_by member in the ecs_iter_t value. This is particularly useful for manual systems, where the value of interrupted_by is returned by this operation. This, in cominbation with the param argument lets applications use manual systems to lookup entities: once the entity has been found its handle is passed to interrupted_by, which is then subsequently returned. </p>
/// </summary>
/// <param name="world"> The world. </param>
/// <param name="system"> The system to run. </param>
/// <param name="delta_time"> The time passed since the last system invocation. </param>
/// <param name="param"> A user-defined parameter to pass to the system. </param>
/// <returns> handle to last evaluated entity if system was interrupted. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_entity_t ecs_run(ecs_world_t* world, ecs_entity_t system, float delta_time, void* param);
/// <summary> Same as ecs_run, but subdivides entities across number of provided stages. </summary>
/// <param name="world"> The world. </param>
/// <param name="system"> The system to run. </param>
/// <param name="stage_current"> The id of the current stage. </param>
/// <param name="stage_count"> The total number of stages. </param>
/// <param name="delta_time"> The time passed since the last system invocation. </param>
/// <param name="param"> A user-defined parameter to pass to the system. </param>
/// <returns> handle to last evaluated entity if system was interrupted. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_entity_t ecs_run_worker(ecs_world_t* world, ecs_entity_t system, int stage_current, int stage_count, float delta_time, void* param);
/// <summary>
/// <p> Run system with offset/limit and type filter. This operation is the same as ecs_run, but filters the entities that will be iterated by the system. </p>
/// <p> Entities can be filtered in two ways. Offset and limit control the range of entities that is iterated over. The range is applied to all entities matched with the system, thus may cover multiple archetypes. </p>
/// <p> The type filter controls which entity types the system will evaluate. Only types that contain all components in the type filter will be iterated over. A type filter is only evaluated once per table, which makes filtering cheap if the number of entities is large and the number of tables is small, but not as cheap as filtering in the system signature. </p>
/// </summary>
/// <param name="world"> The world. </param>
/// <param name="system"> The system to invoke. </param>
/// <param name="delta_time"> The time passed since the last system invocation. </param>
/// <param name="param"> A user-defined parameter to pass to the system. </param>
/// <returns> handle to last evaluated entity if system was interrupted. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_entity_t ecs_run_w_filter(ecs_world_t* world, ecs_entity_t system, float delta_time, int offset, int limit, void* param);
/// <summary> Get the query object for a system. Systems use queries under the hood. This enables an application to get access to the underlying query object of a system. This can be useful when, for example, an application needs to enable sorting for a system. </summary>
/// <param name="world"> The world. </param>
/// <param name="system"> The system from which to obtain the query. </param>
/// <returns> The query. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_query_t* ecs_system_get_query([Const] ecs_world_t* world, ecs_entity_t system);
/// <summary> Get system context. This operation returns the context pointer set for the system. If the provided entity is not a system, the function will return NULL. </summary>
/// <param name="world"> The world. </param>
/// <param name="system"> The system from which to obtain the context. </param>
/// <returns> The context. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void* ecs_get_system_ctx([Const] ecs_world_t* world, ecs_entity_t system);
/// <summary> Get system binding context. The binding context is a context typically used to attach any language binding specific data that is needed when invoking a callback that is implemented in another language. </summary>
/// <param name="world"> The world. </param>
/// <param name="system"> The system from which to obtain the context. </param>
/// <returns> The context. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void* ecs_get_system_binding_ctx([Const] ecs_world_t* world, ecs_entity_t system);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void FlecsSystemImport(ecs_world_t* world);
/// <summary> Get world statistics. </summary>
/// <param name="world"> The world. </param>
/// <param name="stats"> Out parameter for statistics. </param>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_world_stats_get([Const] ecs_world_t* world, ecs_world_stats_t* stats);
/// <summary> Reduce source measurement window into single destination measurement. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_world_stats_reduce(ecs_world_stats_t* dst, [Const] ecs_world_stats_t* src);
/// <summary> Reduce last measurement into previous measurement, restore old value. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_world_stats_reduce_last(ecs_world_stats_t* stats, [Const] ecs_world_stats_t* old, int count);
/// <summary> Repeat last measurement. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_world_stats_repeat_last(ecs_world_stats_t* stats);
/// <summary> Copy last measurement from source to destination. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_world_stats_copy_last(ecs_world_stats_t* dst, [Const] ecs_world_stats_t* src);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_world_stats_log([Const] ecs_world_t* world, [Const] ecs_world_stats_t* stats);
/// <summary> Get query statistics. Obtain statistics for the provided query. </summary>
/// <param name="world"> The world. </param>
/// <param name="query"> The query. </param>
/// <param name="stats"> Out parameter for statistics. </param>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_query_stats_get([Const] ecs_world_t* world, [Const] ecs_query_t* query, ecs_query_stats_t* stats);
/// <summary> Reduce source measurement window into single destination measurement. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_query_stats_reduce(ecs_query_stats_t* dst, [Const] ecs_query_stats_t* src);
/// <summary> Reduce last measurement into previous measurement, restore old value. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_query_stats_reduce_last(ecs_query_stats_t* stats, [Const] ecs_query_stats_t* old, int count);
/// <summary> Repeat last measurement. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_query_stats_repeat_last(ecs_query_stats_t* stats);
/// <summary> Copy last measurement from source to destination. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_query_stats_copy_last(ecs_query_stats_t* dst, [Const] ecs_query_stats_t* src);
/// <summary> Get system statistics. Obtain statistics for the provided system. </summary>
/// <param name="world"> The world. </param>
/// <param name="system"> The system. </param>
/// <param name="stats"> Out parameter for statistics. </param>
/// <returns> true if success, false if not a system. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern bool ecs_system_stats_get([Const] ecs_world_t* world, ecs_entity_t system, ecs_system_stats_t* stats);
/// <summary> Reduce source measurement window into single destination measurement. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_system_stats_reduce(ecs_system_stats_t* dst, [Const] ecs_system_stats_t* src);
/// <summary> Reduce last measurement into previous measurement, restore old value. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_system_stats_reduce_last(ecs_system_stats_t* stats, [Const] ecs_system_stats_t* old, int count);
/// <summary> Repeat last measurement. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_system_stats_repeat_last(ecs_system_stats_t* stats);
/// <summary> Copy last measurement from source to destination. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_system_stats_copy_last(ecs_system_stats_t* dst, [Const] ecs_system_stats_t* src);
/// <summary> Get pipeline statistics. Obtain statistics for the provided pipeline. </summary>
/// <param name="world"> The world. </param>
/// <param name="pipeline"> The pipeline. </param>
/// <param name="stats"> Out parameter for statistics. </param>
/// <returns> true if success, false if not a pipeline. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern bool ecs_pipeline_stats_get(ecs_world_t* world, ecs_entity_t pipeline, ecs_pipeline_stats_t* stats);
/// <summary> Free pipeline stats. </summary>
/// <param name="stats"> The stats to free. </param>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_pipeline_stats_fini(ecs_pipeline_stats_t* stats);
/// <summary> Reduce source measurement window into single destination measurement. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_pipeline_stats_reduce(ecs_pipeline_stats_t* dst, [Const] ecs_pipeline_stats_t* src);
/// <summary> Reduce last measurement into previous measurement, restore old value. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_pipeline_stats_reduce_last(ecs_pipeline_stats_t* stats, [Const] ecs_pipeline_stats_t* old, int count);
/// <summary> Repeat last measurement. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_pipeline_stats_repeat_last(ecs_pipeline_stats_t* stats);
/// <summary> Copy last measurement to destination. This operation copies the last measurement into the destination. It does not modify the cursor. </summary>
/// <param name="dst"> The metrics. </param>
/// <param name="src"> The metrics to copy. </param>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_pipeline_stats_copy_last(ecs_pipeline_stats_t* dst, [Const] ecs_pipeline_stats_t* src);
/// <summary> Reduce all measurements from a window into a single measurement. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_metric_reduce(ecs_metric_t* dst, [Const] ecs_metric_t* src, int t_dst, int t_src);
/// <summary> Reduce last measurement into previous measurement. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_metric_reduce_last(ecs_metric_t* m, int t, int count);
/// <summary> Copy measurement. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_metric_copy(ecs_metric_t* m, int dst, int src);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void FlecsMonitorImport(ecs_world_t* world);
//// CXComment_VerbatimLine
//// CXComment_BlockCommand
//// CXComment_VerbatimLine
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void FlecsCoreDocImport(ecs_world_t* world);
/// <summary> Add human-readable name to entity. Contrary to entity names, human readable names do not have to be unique and can contain special characters used in the query language like '*'. </summary>
/// <param name="world"> The world. </param>
/// <param name="entity"> The entity to which to add the name. </param>
/// <param name="name"> The name to add. </param>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_doc_set_name(ecs_world_t* world, ecs_entity_t entity, [Const] char* name);
/// <summary> Add brief description to entity. </summary>
/// <param name="world"> The world. </param>
/// <param name="entity"> The entity to which to add the description. </param>
/// <param name="description"> The description to add. </param>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_doc_set_brief(ecs_world_t* world, ecs_entity_t entity, [Const] char* description);
/// <summary> Add detailed description to entity. </summary>
/// <param name="world"> The world. </param>
/// <param name="entity"> The entity to which to add the description. </param>
/// <param name="description"> The description to add. </param>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_doc_set_detail(ecs_world_t* world, ecs_entity_t entity, [Const] char* description);
/// <summary> Add link to external documentation to entity. </summary>
/// <param name="world"> The world. </param>
/// <param name="entity"> The entity to which to add the link. </param>
/// <param name="link"> The link to add. </param>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_doc_set_link(ecs_world_t* world, ecs_entity_t entity, [Const] char* link);
/// <summary> Add color to entity. UIs can use color as hint to improve visualizing entities. </summary>
/// <param name="world"> The world. </param>
/// <param name="entity"> The entity to which to add the link. </param>
/// <param name="color"> The color to add. </param>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_doc_set_color(ecs_world_t* world, ecs_entity_t entity, [Const] char* color);
/// <summary>
/// <p> Get human readable name from entity. If entity does not have an explicit human readable name, this operation will return the entity name. </p>
/// <p> To test if an entity has a human readable name, use: ecs_has_pair(world, e, ecs_id(EcsDescription), EcsName); Or in C++: e.has &lt;flecs ::Description&gt;(flecs::Name);. </p>
/// </summary>
/// <param name="world"> The world. </param>
/// <param name="entity"> The entity from which to get the name. </param>
/// <returns> The name. </returns>
[return: Const]
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern char* ecs_doc_get_name([Const] ecs_world_t* world, ecs_entity_t entity);
/// <summary> Get brief description from entity. </summary>
/// <param name="world"> The world. </param>
/// <param name="entity"> The entity from which to get the description. </param>
/// <returns> The description. </returns>
[return: Const]
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern char* ecs_doc_get_brief([Const] ecs_world_t* world, ecs_entity_t entity);
/// <summary> Get detailed description from entity. </summary>
/// <param name="world"> The world. </param>
/// <param name="entity"> The entity from which to get the description. </param>
/// <returns> The description. </returns>
[return: Const]
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern char* ecs_doc_get_detail([Const] ecs_world_t* world, ecs_entity_t entity);
/// <summary> Get link to external documentation from entity. </summary>
/// <param name="world"> The world. </param>
/// <param name="entity"> The entity from which to get the link. </param>
/// <returns> The link. </returns>
[return: Const]
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern char* ecs_doc_get_link([Const] ecs_world_t* world, ecs_entity_t entity);
/// <summary> Get color from entity. </summary>
/// <param name="world"> The world. </param>
/// <param name="entity"> The entity from which to get the link. </param>
/// <returns> The color. </returns>
[return: Const]
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern char* ecs_doc_get_color([Const] ecs_world_t* world, ecs_entity_t entity);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void FlecsDocImport(ecs_world_t* world);
/// <summary> Parse JSON string into value. This operation parses a JSON expression into the provided pointer. The memory pointed to must be large enough to contain a value of the used type. </summary>
/// <param name="world"> The world. </param>
/// <param name="ptr"> The pointer to the expression to parse. </param>
/// <param name="type"> The type of the expression to parse. </param>
/// <param name="data_out"> Pointer to the memory to write to. </param>
/// <param name="desc"> Configuration parameters for deserializer. </param>
/// <returns> Pointer to the character after the last one read, or NULL if failed. </returns>
[return: Const]
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern char* ecs_parse_json([Const] ecs_world_t* world, [Const] char* ptr, ecs_entity_t type, void* data_out, [Const] ecs_parse_json_desc_t* desc);
/// <summary> Parse JSON object with multiple component values into entity. The format is the same as the one outputted by ecs_entity_to_json, but at the moment only supports the "ids" and "values" member. </summary>
[return: Const]
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern char* ecs_parse_json_values(ecs_world_t* world, ecs_entity_t e, [Const] char* ptr, [Const] ecs_parse_json_desc_t* desc);
/// <summary>
/// <p> Serialize value into JSON string. This operation serializes a value of the provided type to a JSON string. The memory pointed to must be large enough to contain a value of the used type. </p>
/// <p> If count is 0, the function will serialize a single value, not wrapped in array brackets. If count is &gt;= 1, the operation will serialize values to a a comma-separated list inside of array brackets. </p>
/// </summary>
/// <param name="world"> The world. </param>
/// <param name="type"> The type of the value to serialize. </param>
/// <param name="data"> The value to serialize. </param>
/// <param name="count"> The number of elements to serialize. </param>
/// <returns> String with JSON expression, or NULL if failed. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern char* ecs_array_to_json([Const] ecs_world_t* world, ecs_entity_t type, [Const] void* data, int count);
/// <summary> Serialize value into JSON string buffer. Same as ecs_array_to_json_buf, but serializes to an ecs_strbuf_t instance. </summary>
/// <param name="world"> The world. </param>
/// <param name="type"> The type of the value to serialize. </param>
/// <param name="data"> The value to serialize. </param>
/// <param name="count"> The number of elements to serialize. </param>
/// <param name="buf_out"> The strbuf to append the string to. </param>
/// <returns> Zero if success, non-zero if failed. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern int ecs_array_to_json_buf([Const] ecs_world_t* world, ecs_entity_t type, [Const] void* data, int count, ecs_strbuf_t* buf_out);
/// <summary> Serialize value into JSON string. Same as ecs_array_to_json, with count = 0. </summary>
/// <param name="world"> The world. </param>
/// <param name="type"> The type of the value to serialize. </param>
/// <param name="data"> The value to serialize. </param>
/// <returns> String with JSON expression, or NULL if failed. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern char* ecs_ptr_to_json([Const] ecs_world_t* world, ecs_entity_t type, [Const] void* data);
/// <summary> Serialize value into JSON string buffer. Same as ecs_ptr_to_json, but serializes to an ecs_strbuf_t instance. </summary>
/// <param name="world"> The world. </param>
/// <param name="type"> The type of the value to serialize. </param>
/// <param name="data"> The value to serialize. </param>
/// <param name="buf_out"> The strbuf to append the string to. </param>
/// <returns> Zero if success, non-zero if failed. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern int ecs_ptr_to_json_buf([Const] ecs_world_t* world, ecs_entity_t type, [Const] void* data, ecs_strbuf_t* buf_out);
/// <summary>
/// <p> Serialize type info to JSON. This serializes type information to JSON, and can be used to store/transmit the structure of a (component) value. </p>
/// <p> If the provided type does not have reflection data, "0" will be returned. </p>
/// </summary>
/// <param name="world"> The world. </param>
/// <param name="type"> The type to serialize to JSON. </param>
/// <returns> A JSON string with the serialized type info, or NULL if failed. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern char* ecs_type_info_to_json([Const] ecs_world_t* world, ecs_entity_t type);
/// <summary> Serialize type info into JSON string buffer. Same as ecs_type_info_to_json, but serializes to an ecs_strbuf_t instance. </summary>
/// <param name="world"> The world. </param>
/// <param name="type"> The type to serialize. </param>
/// <param name="buf_out"> The strbuf to append the string to. </param>
/// <returns> Zero if success, non-zero if failed. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern int ecs_type_info_to_json_buf([Const] ecs_world_t* world, ecs_entity_t type, ecs_strbuf_t* buf_out);
/// <summary>
/// <p> Serialize entity into JSON string. This creates a JSON object with the entity's (path) name, which components and tags the entity has, and the component values. </p>
/// <p> The operation may fail if the entity contains components with invalid values. </p>
/// </summary>
/// <param name="world"> The world. </param>
/// <param name="entity"> The entity to serialize to JSON. </param>
/// <returns> A JSON string with the serialized entity data, or NULL if failed. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern char* ecs_entity_to_json([Const] ecs_world_t* world, ecs_entity_t entity, [Const] ecs_entity_to_json_desc_t* desc);
/// <summary> Serialize entity into JSON string buffer. Same as ecs_entity_to_json, but serializes to an ecs_strbuf_t instance. </summary>
/// <param name="world"> The world. </param>
/// <param name="entity"> The entity to serialize. </param>
/// <param name="buf_out"> The strbuf to append the string to. </param>
/// <returns> Zero if success, non-zero if failed. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern int ecs_entity_to_json_buf([Const] ecs_world_t* world, ecs_entity_t entity, ecs_strbuf_t* buf_out, [Const] ecs_entity_to_json_desc_t* desc);
/// <summary> Serialize iterator into JSON string. This operation will iterate the contents of the iterator and serialize them to JSON. The function acccepts iterators from any source. </summary>
/// <param name="world"> The world. </param>
/// <param name="iter"> The iterator to serialize to JSON. </param>
/// <returns> A JSON string with the serialized iterator data, or NULL if failed. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern char* ecs_iter_to_json([Const] ecs_world_t* world, ecs_iter_t* iter, [Const] ecs_iter_to_json_desc_t* desc);
/// <summary> Serialize iterator into JSON string buffer. Same as ecs_iter_to_json, but serializes to an ecs_strbuf_t instance. </summary>
/// <param name="world"> The world. </param>
/// <param name="iter"> The iterator to serialize. </param>
/// <param name="buf_out"> The strbuf to append the string to. </param>
/// <returns> Zero if success, non-zero if failed. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern int ecs_iter_to_json_buf([Const] ecs_world_t* world, ecs_iter_t* iter, ecs_strbuf_t* buf_out, [Const] ecs_iter_to_json_desc_t* desc);
/// <summary> ///////////////////////////////////////////////////////////////////////////// / Module /////////////////////////////////////////////////////////////////////////////. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void FlecsUnitsImport(ecs_world_t* world);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_meta_cursor_t ecs_meta_cursor([Const] ecs_world_t* world, ecs_entity_t type, void* ptr);
/// <summary> Get pointer to current field. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void* ecs_meta_get_ptr(ecs_meta_cursor_t* cursor);
/// <summary> Move cursor to next field. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern int ecs_meta_next(ecs_meta_cursor_t* cursor);
/// <summary> Move cursor to a element. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern int ecs_meta_elem(ecs_meta_cursor_t* cursor, int elem);
/// <summary> Move cursor to member. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern int ecs_meta_member(ecs_meta_cursor_t* cursor, [Const] char* name);
/// <summary> Move cursor to member, supports dot-separated nested members. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern int ecs_meta_dotmember(ecs_meta_cursor_t* cursor, [Const] char* name);
/// <summary> Push a scope (required/only valid for structs & collections). </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern int ecs_meta_push(ecs_meta_cursor_t* cursor);
/// <summary> Pop a struct or collection scope (must follow a push). </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern int ecs_meta_pop(ecs_meta_cursor_t* cursor);
/// <summary> Is the current scope a collection?. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern bool ecs_meta_is_collection([Const] ecs_meta_cursor_t* cursor);
/// <summary> Get type of current element. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_entity_t ecs_meta_get_type([Const] ecs_meta_cursor_t* cursor);
/// <summary> Get unit of current element. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_entity_t ecs_meta_get_unit([Const] ecs_meta_cursor_t* cursor);
/// <summary> Get member name of current member. </summary>
[return: Const]
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern char* ecs_meta_get_member([Const] ecs_meta_cursor_t* cursor);
/// <summary> Set field with boolean value. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern int ecs_meta_set_bool(ecs_meta_cursor_t* cursor, bool value);
/// <summary> Set field with char value. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern int ecs_meta_set_char(ecs_meta_cursor_t* cursor, char value);
/// <summary> Set field with int value. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern int ecs_meta_set_int(ecs_meta_cursor_t* cursor, long value);
/// <summary> Set field with uint value. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern int ecs_meta_set_uint(ecs_meta_cursor_t* cursor, ulong value);
/// <summary> Set field with float value. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern int ecs_meta_set_float(ecs_meta_cursor_t* cursor, double value);
/// <summary> Set field with string value. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern int ecs_meta_set_string(ecs_meta_cursor_t* cursor, [Const] char* value);
/// <summary> Set field with string literal value (has enclosing ""). </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern int ecs_meta_set_string_literal(ecs_meta_cursor_t* cursor, [Const] char* value);
/// <summary> Set field with entity value. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern int ecs_meta_set_entity(ecs_meta_cursor_t* cursor, ecs_entity_t value);
/// <summary> Set field with null value. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern int ecs_meta_set_null(ecs_meta_cursor_t* cursor);
/// <summary> Set field with dynamic value. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern int ecs_meta_set_value(ecs_meta_cursor_t* cursor, [Const] ecs_value_t* value);
/// <summary> Get field value as boolean. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern bool ecs_meta_get_bool([Const] ecs_meta_cursor_t* cursor);
/// <summary> Get field value as char. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern char ecs_meta_get_char([Const] ecs_meta_cursor_t* cursor);
/// <summary> Get field value as signed integer. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern long ecs_meta_get_int([Const] ecs_meta_cursor_t* cursor);
/// <summary> Get field value as unsigned integer. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ulong ecs_meta_get_uint([Const] ecs_meta_cursor_t* cursor);
/// <summary> Get field value as float. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern double ecs_meta_get_float([Const] ecs_meta_cursor_t* cursor);
/// <summary> Get field value as string. This operation does not perform conversions. If the field is not a string, this operation will fail. </summary>
[return: Const]
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern char* ecs_meta_get_string([Const] ecs_meta_cursor_t* cursor);
/// <summary> Get field value as entity. This operation does not perform conversions. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_entity_t ecs_meta_get_entity([Const] ecs_meta_cursor_t* cursor);
/// <summary> Create a new primitive type. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_entity_t ecs_primitive_init(ecs_world_t* world, [Const] ecs_primitive_desc_t* desc);
/// <summary> Create a new enum type. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_entity_t ecs_enum_init(ecs_world_t* world, [Const] ecs_enum_desc_t* desc);
/// <summary> Create a new bitmask type. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_entity_t ecs_bitmask_init(ecs_world_t* world, [Const] ecs_bitmask_desc_t* desc);
/// <summary> Create a new array type. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_entity_t ecs_array_init(ecs_world_t* world, [Const] ecs_array_desc_t* desc);
/// <summary> Create a new vector type. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_entity_t ecs_vector_init(ecs_world_t* world, [Const] ecs_vector_desc_t* desc);
/// <summary> Create a new struct type. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_entity_t ecs_struct_init(ecs_world_t* world, [Const] ecs_struct_desc_t* desc);
/// <summary> Create a new unit. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_entity_t ecs_unit_init(ecs_world_t* world, [Const] ecs_unit_desc_t* desc);
/// <summary> Create a new unit prefix. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_entity_t ecs_unit_prefix_init(ecs_world_t* world, [Const] ecs_unit_prefix_desc_t* desc);
/// <summary> Create a new quantity. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_entity_t ecs_quantity_init(ecs_world_t* world, [Const] ecs_entity_desc_t* desc);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void FlecsMetaImport(ecs_world_t* world);
/// <summary> Write an escaped character. Write a character to an output string, insert escape character if necessary. </summary>
/// <param name="out"> The string to write the character to. </param>
/// <param name="in"> The input character. </param>
/// <param name="delimiter"> The delimiiter used (for example '"'). </param>
/// <returns> Pointer to the character after the last one written. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern char* ecs_chresc(char* @out, char @in, char delimiter);
/// <summary> Parse an escaped character. Parse a character with a potential escape sequence. </summary>
/// <param name="in"> Pointer to character in input string. </param>
/// <param name="out"> Output string. </param>
/// <returns> Pointer to the character after the last one read. </returns>
[return: Const]
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern char* ecs_chrparse([Const] char* @in, char* @out);
/// <summary> Write an escaped string. Write an input string to an output string, escape characters where necessary. To determine the size of the output string, call the operation with a NULL argument for 'out', and use the returned size to allocate a string that is large enough. </summary>
/// <param name="out"> Pointer to output string (msut be). </param>
/// <param name="size"> Maximum number of characters written to output. </param>
/// <param name="delimiter"> The delimiter used (for example '"'). </param>
/// <param name="in"> The input string. </param>
/// <returns> The number of characters that (would) have been written. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern int ecs_stresc(char* @out, int size, char delimiter, [Const] char* @in);
/// <summary> Return escaped string. Return escaped version of input string. Same as ecs_stresc, but returns an allocated string of the right size. </summary>
/// <param name="delimiter"> The delimiter used (for example '"'). </param>
/// <param name="in"> The input string. </param>
/// <returns> Escaped string. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern char* ecs_astresc(char delimiter, [Const] char* @in);
/// <summary> Init variable storage. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_vars_init(ecs_world_t* world, ecs_vars_t* vars);
/// <summary> Cleanup variable storage. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_vars_fini(ecs_vars_t* vars);
/// <summary> Push variable scope. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_vars_push(ecs_vars_t* vars);
/// <summary> Pop variable scope. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern int ecs_vars_pop(ecs_vars_t* vars);
/// <summary> Declare variable in current scope. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_expr_var_t* ecs_vars_declare(ecs_vars_t* vars, [Const] char* name, ecs_entity_t type);
/// <summary> Declare variable in current scope from value. This operation takes ownership of the value. The value pointer must be allocated with ecs_value_new. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_expr_var_t* ecs_vars_declare_w_value(ecs_vars_t* vars, [Const] char* name, ecs_value_t* value);
/// <summary> Lookup variable in scope and parent scopes. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_expr_var_t* ecs_vars_lookup(ecs_vars_t* vars, [Const] char* name);
/// <summary>
/// <p> Parse expression into value. This operation parses a flecs expression into the provided pointer. The memory pointed to must be large enough to contain a value of the used type. </p>
/// <p> If no type and pointer are provided for the value argument, the operation will discover the type from the expression and allocate storage for the value. The allocated value must be freed with ecs_value_free. </p>
/// </summary>
/// <param name="world"> The world. </param>
/// <param name="ptr"> The pointer to the expression to parse. </param>
/// <param name="value"> The value containing type & pointer to write to. </param>
/// <param name="desc"> Configuration parameters for deserializer. </param>
/// <returns> Pointer to the character after the last one read, or NULL if failed. </returns>
[return: Const]
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern char* ecs_parse_expr(ecs_world_t* world, [Const] char* ptr, ecs_value_t* value, [Const] ecs_parse_expr_desc_t* desc);
/// <summary> Serialize value into expression string. This operation serializes a value of the provided type to a string. The memory pointed to must be large enough to contain a value of the used type. </summary>
/// <param name="world"> The world. </param>
/// <param name="type"> The type of the value to serialize. </param>
/// <param name="data"> The value to serialize. </param>
/// <returns> String with expression, or NULL if failed. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern char* ecs_ptr_to_expr([Const] ecs_world_t* world, ecs_entity_t type, [Const] void* data);
/// <summary> Serialize value into string buffer. Same as ecs_ptr_to_expr, but serializes to an ecs_strbuf_t instance. </summary>
/// <param name="world"> The world. </param>
/// <param name="type"> The type of the value to serialize. </param>
/// <param name="data"> The value to serialize. </param>
/// <param name="buf"> The strbuf to append the string to. </param>
/// <returns> Zero if success, non-zero if failed. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern int ecs_ptr_to_expr_buf([Const] ecs_world_t* world, ecs_entity_t type, [Const] void* data, ecs_strbuf_t* buf);
/// <summary> Serialize primitive value into string buffer. Serializes a primitive value to an ecs_strbuf_t instance. This operation can be reused by other serializers to avoid having to write boilerplate code that serializes primitive values to a string. </summary>
/// <param name="world"> The world. </param>
/// <param name="kind"> The kind of primitive value. </param>
/// <param name="data"> The value ot serialize. </param>
/// <param name="buf"> The strbuf to append the string to. </param>
/// <returns> Zero if success, non-zero if failed. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern int ecs_primitive_to_expr_buf([Const] ecs_world_t* world, ecs_primitive_kind_t kind, [Const] void* data, ecs_strbuf_t* buf);
/// <summary> Parse expression token. Expression tokens can contain more characters (such as '|') than tokens parsed by the query (term) parser. </summary>
/// <param name="name"> The name of the expression (used for debug logs). </param>
/// <param name="expr"> The full expression (used for debug logs). </param>
/// <param name="ptr"> The pointer to the expression to parse. </param>
/// <param name="token"> The buffer to write to (must have size ECS_MAX_TOKEN_SIZE). </param>
/// <returns> Pointer to the character after the last one read, or NULL if failed. </returns>
[return: Const]
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern char* ecs_parse_expr_token([Const] char* name, [Const] char* expr, [Const] char* ptr, char* token);
/// <summary> Populate meta information from type descriptor. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern int ecs_meta_from_desc(ecs_world_t* world, ecs_entity_t component, ecs_type_kind_t kind, [Const] char* desc);
/// <summary> Parse plecs string. This parses a plecs string and instantiates the entities in the world. </summary>
/// <param name="world"> The world. </param>
/// <param name="name"> The script name (typically the file). </param>
/// <param name="str"> The plecs string. </param>
/// <returns> Zero if success, non-zero otherwise. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern int ecs_plecs_from_str(ecs_world_t* world, [Const] char* name, [Const] char* str);
/// <summary> Parse plecs file. This parses a plecs file and instantiates the entities in the world. This operation is equivalent to loading the file contents and passing it to ecs_plecs_from_str. </summary>
/// <param name="world"> The world. </param>
/// <param name="filename"> The plecs file name. </param>
/// <returns> Zero if success, non-zero otherwise. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern int ecs_plecs_from_file(ecs_world_t* world, [Const] char* filename);
/// <summary>
/// <p> Create a rule. A rule accepts the same descriptor as a filter, but has the additional ability to use query variables. </p>
/// <p> Query variables can be used to constrain wildcards across multiple terms to the same entity. Regular ECS queries do this in a limited form, as querying for Position, Velocity only returns entities that have both components. </p>
/// <p> Query variables expand this to constrain entities that are resolved while the query is being matched. Consider a query for all entities and the mission they are on: (Mission, *). </p>
/// <p> If an entity is on multiple missions, the wildcard will match it multiple times. Now say we want to only list combat missions. Naively we could try: (Mission, *), CombatMission(*). </p>
/// <p> But this doesn't work, as term 1 returns entities with missions, and term 2 returns all combat missions for all entities. Query variables make it possible to apply CombatMission to the found mission: (Mission, $M), CombatMission($M). </p>
/// <p> By using the same variable ('M') we ensure that CombatMission is applied to the mission found in the current result. </p>
/// <p> Variables can be used in each part of the term (predicate, subject, object). This is a valid query: Likes($X, $Y), Likes($Y, $X). </p>
/// <p> This is also a valid query: _Component, Serializable(_Component). </p>
/// <p> In the query expression syntax, variables are prefixed with a $. When using the descriptor, specify the variable kind: desc.terms[0].second = { .name = "X", .var = EcsVarIsVariable }. </p>
/// <p> Different terms with the same variable name are automatically correlated by the query engine. </p>
/// <p> A rule needs to be explicitly deleted with ecs_rule_fini. </p>
/// </summary>
/// <param name="world"> The world. </param>
/// <param name="desc"> The descriptor (see ecs_filter_desc_t). </param>
/// <returns> The rule. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_rule_t* ecs_rule_init(ecs_world_t* world, [Const] ecs_filter_desc_t* desc);
/// <summary> Delete a rule. </summary>
/// <param name="rule"> The rule. </param>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_rule_fini(ecs_rule_t* rule);
/// <summary> Obtain filter from rule. This operation returns the filter with which the rule was created. </summary>
/// <param name="rule"> The rule. </param>
/// <returns> The filter. </returns>
[return: Const]
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_filter_t* ecs_rule_get_filter([Const] ecs_rule_t* rule);
/// <summary> Return number of variables in rule. </summary>
/// <param name="rule"> The rule. </param>
/// <returns> The number of variables/. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern int ecs_rule_var_count([Const] ecs_rule_t* rule);
/// <summary> Find variable index. This operation looks up the index of a variable in the rule. This index can be used in operations like ecs_iter_set_var and ecs_iter_get_var. </summary>
/// <param name="rule"> The rule. </param>
/// <param name="name"> The variable name. </param>
/// <returns> The variable index. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern int ecs_rule_find_var([Const] ecs_rule_t* rule, [Const] char* name);
/// <summary> Get variable name. This operation returns the variable name for an index. </summary>
/// <param name="rule"> The rule. </param>
/// <param name="var_id"> The variable index. </param>
[return: Const]
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern char* ecs_rule_var_name([Const] ecs_rule_t* rule, int var_id);
/// <summary> Test if variable is an entity. Internally the rule engine has entity variables and table variables. When iterating through rule variables (by using ecs_rule_variable_count) only the values for entity variables are accessible. This operation enables an appliction to check if a variable is an entity variable. </summary>
/// <param name="rule"> The rule. </param>
/// <param name="var_id"> The variable id. </param>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern bool ecs_rule_var_is_entity([Const] ecs_rule_t* rule, int var_id);
/// <summary> Iterate a rule. Note that rule iterators may allocate memory, and that unless the iterator is iterated until completion, it may still hold resources. When stopping iteration before ecs_rule_next has returned false, use ecs_iter_fini to cleanup any remaining resources. </summary>
/// <param name="world"> The world. </param>
/// <param name="rule"> The rule. </param>
/// <returns> An iterator. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_iter_t ecs_rule_iter([Const] ecs_world_t* world, [Const] ecs_rule_t* rule);
/// <summary> Progress rule iterator. </summary>
/// <param name="it"> The iterator. </param>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern bool ecs_rule_next(ecs_iter_t* it);
/// <summary> Progress instanced iterator. Should not be called unless you know what you're doing :-). </summary>
/// <param name="it"> The iterator. </param>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern bool ecs_rule_next_instanced(ecs_iter_t* it);
/// <summary>
/// <p> Convert rule to a string. This will convert the rule program to a string which can aid in debugging the behavior of a rule. </p>
/// <p> The returned string must be freed with ecs_os_free. </p>
/// </summary>
/// <param name="rule"> The rule. </param>
/// <returns> The string. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern char* ecs_rule_str(ecs_rule_t* rule);
/// <summary> Create a snapshot. This operation makes a copy of the current state of the world. </summary>
/// <param name="world"> The world to snapshot. </param>
/// <returns> The snapshot. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_snapshot_t* ecs_snapshot_take(ecs_world_t* world);
/// <summary> Create a filtered snapshot. This operation is the same as ecs_snapshot_take, but accepts an iterator so an application can control what is stored by the snapshot. </summary>
/// <param name="iter"> An iterator to the data to be stored by the snapshot. </param>
/// <returns> The snapshot. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_snapshot_t* ecs_snapshot_take_w_iter(ecs_iter_t* iter);
/// <summary>
/// <p> Restore a snapshot. This operation restores the world to the state it was in when the specified snapshot was taken. A snapshot can only be used once for restoring, as its data replaces the data that is currently in the world. This operation also resets the last issued entity handle, so any calls to ecs_new may return entity ids that have been issued before restoring the snapshot. </p>
/// <p> The world in which the snapshot is restored must be the same as the world in which the snapshot is taken. </p>
/// </summary>
/// <param name="world"> The world to restore the snapshot to. </param>
/// <param name="snapshot"> The snapshot to restore. </param>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_snapshot_restore(ecs_world_t* world, ecs_snapshot_t* snapshot);
/// <summary> Obtain iterator to snapshot data. </summary>
/// <param name="snapshot"> The snapshot to iterate over. </param>
/// <returns> Iterator to snapshot data. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_iter_t ecs_snapshot_iter(ecs_snapshot_t* snapshot);
/// <summary> Progress snapshot iterator. </summary>
/// <param name="iter"> The snapshot iterator. </param>
/// <returns> True if more data is available, otherwise false. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern bool ecs_snapshot_next(ecs_iter_t* iter);
/// <summary> Free snapshot resources. This frees resources associated with a snapshot without restoring it. </summary>
/// <param name="snapshot"> The snapshot to free. </param>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_snapshot_free(ecs_snapshot_t* snapshot);
/// <summary> Skip whitespace characters. This function skips whitespace characters. Does not skip newlines. </summary>
/// <param name="ptr"> Pointer to (potential) whitespaces to skip. </param>
/// <returns> Pointer to the next non-whitespace character. </returns>
[return: Const]
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern char* ecs_parse_whitespace([Const] char* ptr);
/// <summary> Skip whitespace and newline characters. This function skips whitespace characters. </summary>
/// <param name="ptr"> Pointer to (potential) whitespaces to skip. </param>
/// <returns> Pointer to the next non-whitespace character. </returns>
[return: Const]
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern char* ecs_parse_eol_and_whitespace([Const] char* ptr);
/// <summary> Parse digit. This function will parse until the first non-digit character is found. The provided expression must contain at least one digit character. </summary>
/// <param name="ptr"> The expression to parse. </param>
/// <param name="token"> The output buffer. </param>
/// <returns> Pointer to the first non-digit character. </returns>
[return: Const]
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern char* ecs_parse_digit([Const] char* ptr, char* token);
/// <summary> Skip whitespaces and comments. This function skips whitespace characters and comments (single line, //). </summary>
/// <param name="ptr"> pointer to (potential) whitespaces/comments to skip. </param>
/// <returns> pointer to the next non-whitespace character. </returns>
[return: Const]
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern char* ecs_parse_fluff([Const] char* ptr, char** last_comment);
/// <summary> Parse a single token. This function can be used as simple tokenizer by other parsers. </summary>
/// <param name="name"> of program (used for logging). </param>
/// <param name="expr"> pointer to token to parse. </param>
/// <param name="ptr"> pointer to first character to parse. </param>
/// <param name="token_out"> Parsed token (buffer should be ECS_MAX_TOKEN_SIZE large). </param>
/// <returns> Pointer to the next token, or NULL if error occurred. </returns>
[return: Const]
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern char* ecs_parse_token([Const] char* name, [Const] char* expr, [Const] char* ptr, char* token_out, char delim);
/// <summary>
/// <p> Parse term in expression. This operation parses a single term in an expression and returns a pointer to the next term expression. </p>
/// <p> If the returned pointer points to the 0-terminator, the expression is fully parsed. The function would typically be called in a while loop:. </p>
/// <p> const char *ptr = expr; while (ptr[0] & & (ptr = ecs_parse_term(world, name, expr, ptr, &term ))) { }. </p>
/// <p> The operation does not attempt to find entity ids from the names in the expression. Use the ecs_term_resolve_ids function to resolve the identifiers in the parsed term. </p>
/// <p> The returned term will in most cases contain allocated resources, which should freed (or used) by the application. To free the resources for a term, use the ecs_term_free function. </p>
/// <p> The parser accepts expressions in the legacy string format. </p>
/// </summary>
/// <param name="world"> The world. </param>
/// <param name="name"> The name of the expression (optional, improves error logs). </param>
/// <param name="expr"> The expression to parse (optional, improves error logs). </param>
/// <param name="ptr"> The pointer to the current term (must be in expr). </param>
/// <param name="term_out"> Out parameter for the term. </param>
/// <returns> pointer to next term if successful, NULL if failed. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern char* ecs_parse_term([Const] ecs_world_t* world, [Const] char* name, [Const] char* expr, [Const] char* ptr, ecs_term_t* term_out);
/// <summary> Create server. Use ecs_http_server_start to start receiving requests. </summary>
/// <param name="desc"> Server configuration parameters. </param>
/// <returns> The new server, or NULL if creation failed. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_http_server_t* ecs_http_server_init([Const] ecs_http_server_desc_t* desc);
/// <summary> Destroy server. This operation will stop the server if it was still running. </summary>
/// <param name="server"> The server to destroy. </param>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_http_server_fini(ecs_http_server_t* server);
/// <summary> Start server. After this operation the server will be able to accept requests. </summary>
/// <param name="server"> The server to start. </param>
/// <returns> Zero if successful, non-zero if failed. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern int ecs_http_server_start(ecs_http_server_t* server);
/// <summary> Process server requests. This operation invokes the reply callback for each received request. No new requests will be enqueued while processing requests. </summary>
/// <param name="server"> The server for which to process requests. </param>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_http_server_dequeue(ecs_http_server_t* server, float delta_time);
/// <summary> Stop server. After this operation no new requests can be received. </summary>
/// <param name="server"> The server. </param>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_http_server_stop(ecs_http_server_t* server);
/// <summary> Find header in request. </summary>
/// <param name="req"> The request. </param>
/// <param name="name"> name of the header to find. </param>
/// <returns> The header value, or NULL if not found. </returns>
[return: Const]
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern char* ecs_http_get_header([Const] ecs_http_request_t* req, [Const] char* name);
/// <summary> Find query parameter in request. </summary>
/// <param name="req"> The request. </param>
/// <param name="name"> The parameter name. </param>
/// <returns> The decoded parameter value, or NULL if not found. </returns>
[return: Const]
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern char* ecs_http_get_param([Const] ecs_http_request_t* req, [Const] char* name);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_set_os_api_impl();
/// <summary>
/// <p> Import a module. This operation will load a modules and store the public module handles in the handles_out out parameter. The module name will be used to verify if the module was already loaded, in which case it won't be reimported. The name will be translated from PascalCase to an entity path (pascal.case) before the lookup occurs. </p>
/// <p> Module contents will be stored as children of the module entity. This prevents modules from accidentally defining conflicting identifiers. This is enforced by setting the scope before and after loading the module to the module entity id. </p>
/// <p> A more convenient way to import a module is by using the ECS_IMPORT macro. </p>
/// </summary>
/// <param name="world"> The world. </param>
/// <param name="module"> The module import function. </param>
/// <param name="module_name"> The name of the module. </param>
/// <returns> The module entity. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_entity_t ecs_import(ecs_world_t* world, ecs_module_action_t module, [Const] char* module_name);
/// <summary> Same as ecs_import, but with name to scope conversion. PascalCase names are automatically converted to scoped names. </summary>
/// <param name="world"> The world. </param>
/// <param name="module"> The module import function. </param>
/// <param name="module_name_c"> The name of the module. </param>
/// <returns> The module entity. </returns>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_entity_t ecs_import_c(ecs_world_t* world, ecs_module_action_t module, [Const] char* module_name_c);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_entity_t ecs_import_from_library(ecs_world_t* world, [Const] char* library_name, [Const] char* module_name);
/// <summary> Register a new module. </summary>
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_entity_t ecs_module_init(ecs_world_t* world, [Const] char* c_name, [Const] ecs_component_desc_t* desc);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern char* ecs_cpp_get_type_name(char* type_name, [Const] char* func_name, int len);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern char* ecs_cpp_get_symbol_name(char* symbol_name, [Const] char* type_name, int len);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern char* ecs_cpp_get_constant_name(char* constant_name, [Const] char* func_name, int len);
[return: Const]
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern char* ecs_cpp_trim_module(ecs_world_t* world, [Const] char* type_name);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_cpp_component_validate(ecs_world_t* world, ecs_entity_t id, [Const] char* name, [Const] char* symbol, int size, int alignment, bool implicit_name);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_entity_t ecs_cpp_component_register(ecs_world_t* world, ecs_entity_t id, [Const] char* name, [Const] char* symbol, int size, int alignment, bool implicit_name, bool* existing_out);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_entity_t ecs_cpp_component_register_explicit(ecs_world_t* world, ecs_entity_t s_id, ecs_entity_t id, [Const] char* name, [Const] char* type_name, [Const] char* symbol, int size, int alignment, bool is_component, bool* existing_out);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ecs_cpp_enum_init(ecs_world_t* world, ecs_entity_t id);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern ecs_entity_t ecs_cpp_enum_constant_register(ecs_world_t* world, ecs_entity_t parent, ecs_entity_t id, [Const] char* name, int value);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern int ecs_cpp_reset_count_get();
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern int ecs_cpp_reset_count_inc();
}