Skip to content

Instantly share code, notes, and snippets.

@raizam
Created May 2, 2019 10:10
Show Gist options
  • Save raizam/ad9f4c76c7866d8acdd87b193c3e7e86 to your computer and use it in GitHub Desktop.
Save raizam/ad9f4c76c7866d8acdd87b193c3e7e86 to your computer and use it in GitHub Desktop.
using System;
using System.Runtime.InteropServices;
using SharpC;
namespace FlecsSharp
{
#region Enums
//EcsSystemKind
public enum EcsSystemKind : Int32
{
OnLoad = 0,
PostLoad = 1,
PreUpdate = 2,
OnUpdate = 3,
OnValidate = 4,
PostUpdate = 5,
PreStore = 6,
OnStore = 7,
Manual = 8,
OnAdd = 9,
OnRemove = 10,
OnSet = 11,
}
#endregion
#region Typedefs
unsafe partial struct EcsEntityT
{
public EcsEntityT(UInt64 value)
{
Value = value;
}
public UInt64 Value;
}
unsafe partial struct EcsTypeT
{
public EcsTypeT(UInt32 value)
{
Value = value;
}
public UInt32 Value;
}
#endregion
#region Structs
//ecs_os_api_t
unsafe partial struct EcsOsApiT
{
internal Data* ptr;
internal EcsOsApiT(Data* ptr) => this.ptr = ptr;
[StructLayout(LayoutKind.Sequential)]
internal unsafe struct Data
{
public static implicit operator EcsOsApiT(Data data) => data.Ptr();
public static implicit operator Data(EcsOsApiT _ref) => *_ref.ptr;
public EcsOsApiT Ptr() { fixed(Data* ptr = &this) return new EcsOsApiT(ptr); }
internal IntPtr _malloc;
internal IntPtr _realloc;
internal IntPtr _calloc;
internal IntPtr _free;
internal IntPtr _threadNew;
internal IntPtr _threadJoin;
internal IntPtr _mutexNew;
internal IntPtr _mutexFree;
internal IntPtr _mutexLock;
internal IntPtr _mutexUnlock;
internal IntPtr _condNew;
internal IntPtr _condFree;
internal IntPtr _condSignal;
internal IntPtr _condBroadcast;
internal IntPtr _condWait;
internal IntPtr _sleep;
internal IntPtr _getTime;
internal IntPtr _log;
internal IntPtr _logError;
internal IntPtr _logDebug;
internal IntPtr _abort;
}
}
//ecs_time_t
[StructLayout(LayoutKind.Sequential)]
unsafe partial struct EcsTimeT
{
public EcsTimeT* Ptr() { fixed(EcsTimeT* ptr = &this) return ptr; }
internal int sec;
internal uint nanosec;
}
//EcsIter
unsafe partial struct EcsIter
{
internal Data* ptr;
internal EcsIter(Data* ptr) => this.ptr = ptr;
[StructLayout(LayoutKind.Sequential)]
internal unsafe struct Data
{
public static implicit operator EcsIter(Data data) => data.Ptr();
public static implicit operator Data(EcsIter _ref) => *_ref.ptr;
public EcsIter Ptr() { fixed(Data* ptr = &this) return new EcsIter(ptr); }
internal IntPtr ctx;
internal IntPtr data;
internal IntPtr _hasnext;
internal IntPtr _next;
internal IntPtr _release;
}
}
////EcsIter
//unsafe partial struct EcsIter
//{
// internal Data* ptr;
// internal EcsIter(Data* ptr) => this.ptr = ptr;
// [StructLayout(LayoutKind.Sequential)]
// internal unsafe struct Data
// {
// public static implicit operator EcsIter(Data data) => data.Ptr();
// public static implicit operator Data(EcsIter _ref) => *_ref.ptr;
// public EcsIter Ptr() { fixed(Data* ptr = &this) return new EcsIter(ptr); }
// internal IntPtr ctx;
// internal IntPtr data;
// internal IntPtr _hasnext;
// internal IntPtr _next;
// internal IntPtr _release;
// }
//}
//ecs_vector_params_t
unsafe partial struct EcsVectorParamsT
{
internal Data* ptr;
internal EcsVectorParamsT(Data* ptr) => this.ptr = ptr;
[StructLayout(LayoutKind.Sequential)]
internal unsafe struct Data
{
public static implicit operator EcsVectorParamsT(Data data) => data.Ptr();
public static implicit operator Data(EcsVectorParamsT _ref) => *_ref.ptr;
public EcsVectorParamsT Ptr() { fixed(Data* ptr = &this) return new EcsVectorParamsT(ptr); }
internal IntPtr _moveAction;
internal IntPtr moveCtx;
internal IntPtr ctx;
internal uint elementSize;
}
}
//ecs_world_stats_t
unsafe partial struct EcsWorldStatsT
{
internal Data* ptr;
internal EcsWorldStatsT(Data* ptr) => this.ptr = ptr;
[StructLayout(LayoutKind.Sequential)]
internal unsafe struct Data
{
public static implicit operator EcsWorldStatsT(Data data) => data.Ptr();
public static implicit operator Data(EcsWorldStatsT _ref) => *_ref.ptr;
public EcsWorldStatsT Ptr() { fixed(Data* ptr = &this) return new EcsWorldStatsT(ptr); }
internal uint systemCount;
internal uint tableCount;
internal uint entityCount;
internal uint threadCount;
internal uint tickCount;
internal float systemTime;
internal float frameTime;
internal float mergeTime;
internal EcsMemoryStats.Data memory;
internal EcsVectorT features;
internal EcsVectorT onLoadSystems;
internal EcsVectorT postLoadSystems;
internal EcsVectorT preUpdateSystems;
internal EcsVectorT onUpdateSystems;
internal EcsVectorT onValidateSystems;
internal EcsVectorT postUpdateSystems;
internal EcsVectorT preStoreSystems;
internal EcsVectorT onStoreSystems;
internal EcsVectorT taskSystems;
internal EcsVectorT inactiveSystems;
internal EcsVectorT onDemandSystems;
internal EcsVectorT onAddSystems;
internal EcsVectorT onRemoveSystems;
internal EcsVectorT onSetSystems;
internal EcsVectorT tables;
internal bool frameProfiling;
internal bool systemProfiling;
}
}
//EcsMemoryStats
unsafe partial struct EcsMemoryStats
{
internal Data* ptr;
internal EcsMemoryStats(Data* ptr) => this.ptr = ptr;
[StructLayout(LayoutKind.Sequential)]
internal unsafe struct Data
{
public static implicit operator EcsMemoryStats(Data data) => data.Ptr();
public static implicit operator Data(EcsMemoryStats _ref) => *_ref.ptr;
public EcsMemoryStats Ptr() { fixed(Data* ptr = &this) return new EcsMemoryStats(ptr); }
internal EcsMemoryStat.Data total;
internal EcsMemoryStat.Data components;
internal EcsMemoryStat.Data entities;
internal EcsMemoryStat.Data systems;
internal EcsMemoryStat.Data families;
internal EcsMemoryStat.Data tables;
internal EcsMemoryStat.Data stage;
internal EcsMemoryStat.Data world;
}
}
//EcsMemoryStat
unsafe partial struct EcsMemoryStat
{
internal Data* ptr;
internal EcsMemoryStat(Data* ptr) => this.ptr = ptr;
[StructLayout(LayoutKind.Sequential)]
internal unsafe struct Data
{
public static implicit operator EcsMemoryStat(Data data) => data.Ptr();
public static implicit operator Data(EcsMemoryStat _ref) => *_ref.ptr;
public EcsMemoryStat Ptr() { fixed(Data* ptr = &this) return new EcsMemoryStat(ptr); }
internal uint allocd;
internal uint used;
}
}
//ecs_rows_t
unsafe partial struct EcsRowsT
{
internal Data* ptr;
internal EcsRowsT(Data* ptr) => this.ptr = ptr;
[StructLayout(LayoutKind.Sequential)]
internal unsafe struct Data
{
public static implicit operator EcsRowsT(Data data) => data.Ptr();
public static implicit operator Data(EcsRowsT _ref) => *_ref.ptr;
public EcsRowsT Ptr() { fixed(Data* ptr = &this) return new EcsRowsT(ptr); }
internal EcsWorldT world;
internal EcsEntityT system;
internal int* columns;
internal ushort columnCount;
internal IntPtr table;
internal IntPtr tableColumns;
internal EcsReferenceT references;
internal void** refPtrs;
internal EcsEntityT* components;
internal EcsEntityT* entities;
internal IntPtr param;
internal float deltaTime;
internal uint frameOffset;
internal uint offset;
internal uint count;
internal EcsEntityT interruptedBy;
}
}
//ecs_reference_t
unsafe partial struct EcsReferenceT
{
internal Data* ptr;
internal EcsReferenceT(Data* ptr) => this.ptr = ptr;
[StructLayout(LayoutKind.Sequential)]
internal unsafe struct Data
{
public static implicit operator EcsReferenceT(Data data) => data.Ptr();
public static implicit operator Data(EcsReferenceT _ref) => *_ref.ptr;
public EcsReferenceT Ptr() { fixed(Data* ptr = &this) return new EcsReferenceT(ptr); }
internal EcsEntityT entity;
internal EcsEntityT component;
}
}
#endregion
#region OpaquePtrs
//ecs_vector_t
unsafe partial struct EcsVectorT
{
IntPtr ptr;
public EcsVectorT(IntPtr ptr) => this.ptr = ptr;
internal EcsVectorT* Ptr => (EcsVectorT*) ptr;
}
//ecs_map_t
unsafe partial struct EcsMapT
{
IntPtr ptr;
public EcsMapT(IntPtr ptr) => this.ptr = ptr;
internal EcsMapT* Ptr => (EcsMapT*) ptr;
}
//ecs_world_t
unsafe partial struct EcsWorldT
{
IntPtr ptr;
public EcsWorldT(IntPtr ptr) => this.ptr = ptr;
internal EcsWorldT* Ptr => (EcsWorldT*) ptr;
}
#endregion
#region Delegates
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal unsafe delegate IntPtr EcsOsApiMallocTDelegate(UIntPtr size);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal unsafe delegate IntPtr EcsOsApiReallocTDelegate(IntPtr ptr, UIntPtr size);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal unsafe delegate IntPtr EcsOsApiCallocTDelegate(UIntPtr num, UIntPtr size);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal unsafe delegate void EcsOsApiFreeTDelegate(IntPtr ptr);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal unsafe delegate UIntPtr EcsOsApiThreadNewTDelegate(UIntPtr ecsOsThreadT, EcsOsThreadCallbackTDelegate callback, IntPtr param);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal unsafe delegate IntPtr EcsOsThreadCallbackTDelegate(IntPtr param0);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal unsafe delegate IntPtr EcsOsApiThreadJoinTDelegate(UIntPtr thread);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal unsafe delegate UIntPtr EcsOsApiMutexNewTDelegate(UIntPtr ecsOsMutexT);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal unsafe delegate void EcsOsApiMutexFreeTDelegate(UIntPtr mutex);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal unsafe delegate void EcsOsApiMutexLockTDelegate(UIntPtr mutex);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal unsafe delegate UIntPtr EcsOsApiCondNewTDelegate(UIntPtr ecsOsCondT);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal unsafe delegate void EcsOsApiCondFreeTDelegate(UIntPtr cond);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal unsafe delegate void EcsOsApiCondSignalTDelegate(UIntPtr cond);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal unsafe delegate void EcsOsApiCondBroadcastTDelegate(UIntPtr cond);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal unsafe delegate void EcsOsApiCondWaitTDelegate(UIntPtr cond, UIntPtr mutex);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal unsafe delegate void EcsOsApiSleepTDelegate(uint sec, uint nanosec);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal unsafe delegate void EcsOsApiGetTimeTDelegate(EcsTimeT* timeOut);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal unsafe delegate void EcsOsApiLogTDelegate(CharPtr fmt, IntPtr args);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal unsafe delegate void EcsOsApiAbortTDelegate();
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal unsafe delegate bool HasnextDelegate(EcsIter param0);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal unsafe delegate IntPtr NextDelegate(EcsIter param0);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal unsafe delegate void ReleaseDelegate(EcsIter param0);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal unsafe delegate void EcsMoveDelegate(EcsVectorT array, EcsVectorParamsT @params, IntPtr to, IntPtr @from, IntPtr ctx);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal unsafe delegate int EcsComparatorDelegate(IntPtr p1, IntPtr p2);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal unsafe delegate void EcsSystemActionTDelegate(EcsRowsT data);
#endregion
internal unsafe static partial class ecs
{
const string DLL = "flecs.dll";
[DllImport(DLL, EntryPoint = "ecs_os_set_api", CallingConvention=CallingConvention.Cdecl)]
public static extern void os_set_api(EcsOsApiT osApi);
[DllImport(DLL, EntryPoint = "ecs_os_set_api_defaults", CallingConvention=CallingConvention.Cdecl)]
public static extern void os_set_api_defaults();
[DllImport(DLL, EntryPoint = "ecs_os_log", CallingConvention=CallingConvention.Cdecl)]
public static extern void os_log(CharPtr fmt);
[DllImport(DLL, EntryPoint = "ecs_os_err", CallingConvention=CallingConvention.Cdecl)]
public static extern void os_err(CharPtr fmt);
[DllImport(DLL, EntryPoint = "ecs_os_dbg", CallingConvention=CallingConvention.Cdecl)]
public static extern void os_dbg(CharPtr fmt);
[DllImport(DLL, EntryPoint = "ecs_os_enable_dbg", CallingConvention=CallingConvention.Cdecl)]
public static extern void os_enable_dbg(bool enable);
[DllImport(DLL, EntryPoint = "ecs_iter_hasnext", CallingConvention=CallingConvention.Cdecl)]
public static extern bool iter_hasnext(EcsIter iter);
[DllImport(DLL, EntryPoint = "ecs_iter_next", CallingConvention=CallingConvention.Cdecl)]
public static extern IntPtr iter_next(EcsIter iter);
[DllImport(DLL, EntryPoint = "ecs_iter_release", CallingConvention=CallingConvention.Cdecl)]
public static extern void iter_release(EcsIter iter);
[DllImport(DLL, EntryPoint = "ecs_vector_new", CallingConvention=CallingConvention.Cdecl)]
public static extern EcsVectorT vector_new(EcsVectorParamsT @params, uint size);
[DllImport(DLL, EntryPoint = "ecs_vector_new_from_buffer", CallingConvention=CallingConvention.Cdecl)]
public static extern EcsVectorT vector_new_from_buffer(EcsVectorParamsT @params, uint size, IntPtr buffer);
[DllImport(DLL, EntryPoint = "ecs_vector_free", CallingConvention=CallingConvention.Cdecl)]
public static extern void vector_free(EcsVectorT array);
[DllImport(DLL, EntryPoint = "ecs_vector_clear", CallingConvention=CallingConvention.Cdecl)]
public static extern void vector_clear(EcsVectorT array);
[DllImport(DLL, EntryPoint = "ecs_vector_add", CallingConvention=CallingConvention.Cdecl)]
public static extern IntPtr vector_add(EcsVectorT* arrayInout, EcsVectorParamsT @params);
[DllImport(DLL, EntryPoint = "ecs_vector_addn", CallingConvention=CallingConvention.Cdecl)]
public static extern IntPtr vector_addn(EcsVectorT* arrayInout, EcsVectorParamsT @params, uint count);
[DllImport(DLL, EntryPoint = "ecs_vector_get", CallingConvention=CallingConvention.Cdecl)]
public static extern IntPtr vector_get(EcsVectorT array, EcsVectorParamsT @params, uint index);
[DllImport(DLL, EntryPoint = "ecs_vector_get_index", CallingConvention=CallingConvention.Cdecl)]
public static extern uint vector_get_index(EcsVectorT array, EcsVectorParamsT @params, IntPtr elem);
[DllImport(DLL, EntryPoint = "ecs_vector_last", CallingConvention=CallingConvention.Cdecl)]
public static extern IntPtr vector_last(EcsVectorT array, EcsVectorParamsT @params);
[DllImport(DLL, EntryPoint = "ecs_vector_remove", CallingConvention=CallingConvention.Cdecl)]
public static extern uint vector_remove(EcsVectorT array, EcsVectorParamsT @params, IntPtr elem);
[DllImport(DLL, EntryPoint = "ecs_vector_remove_last", CallingConvention=CallingConvention.Cdecl)]
public static extern void vector_remove_last(EcsVectorT array);
[DllImport(DLL, EntryPoint = "ecs_vector_move_index", CallingConvention=CallingConvention.Cdecl)]
public static extern uint vector_move_index(EcsVectorT* dstArray, EcsVectorT srcArray, EcsVectorParamsT @params, uint index);
[DllImport(DLL, EntryPoint = "ecs_vector_remove_index", CallingConvention=CallingConvention.Cdecl)]
public static extern uint vector_remove_index(EcsVectorT array, EcsVectorParamsT @params, uint index);
[DllImport(DLL, EntryPoint = "ecs_vector_reclaim", CallingConvention=CallingConvention.Cdecl)]
public static extern void vector_reclaim(EcsVectorT* array, EcsVectorParamsT @params);
[DllImport(DLL, EntryPoint = "ecs_vector_set_size", CallingConvention=CallingConvention.Cdecl)]
public static extern uint vector_set_size(EcsVectorT* array, EcsVectorParamsT @params, uint size);
[DllImport(DLL, EntryPoint = "ecs_vector_set_count", CallingConvention=CallingConvention.Cdecl)]
public static extern uint vector_set_count(EcsVectorT* array, EcsVectorParamsT @params, uint size);
[DllImport(DLL, EntryPoint = "ecs_vector_count", CallingConvention=CallingConvention.Cdecl)]
public static extern uint vector_count(EcsVectorT array);
[DllImport(DLL, EntryPoint = "ecs_vector_size", CallingConvention=CallingConvention.Cdecl)]
public static extern uint vector_size(EcsVectorT array);
[DllImport(DLL, EntryPoint = "ecs_vector_first", CallingConvention=CallingConvention.Cdecl)]
public static extern IntPtr vector_first(EcsVectorT array);
[DllImport(DLL, EntryPoint = "ecs_vector_sort", CallingConvention=CallingConvention.Cdecl)]
public static extern void vector_sort(EcsVectorT array, EcsVectorParamsT @params, EcsComparatorDelegate compareAction);
[DllImport(DLL, EntryPoint = "ecs_vector_memory", CallingConvention=CallingConvention.Cdecl)]
public static extern void vector_memory(EcsVectorT array, EcsVectorParamsT @params, uint* allocd, uint* used);
[DllImport(DLL, EntryPoint = "ecs_map_new", CallingConvention=CallingConvention.Cdecl)]
public static extern EcsMapT map_new(uint size);
[DllImport(DLL, EntryPoint = "ecs_map_free", CallingConvention=CallingConvention.Cdecl)]
public static extern void map_free(EcsMapT map);
[DllImport(DLL, EntryPoint = "ecs_map_memory", CallingConvention=CallingConvention.Cdecl)]
public static extern void map_memory(EcsMapT map, uint* total, uint* used);
[DllImport(DLL, EntryPoint = "ecs_map_count", CallingConvention=CallingConvention.Cdecl)]
public static extern uint map_count(EcsMapT map);
[DllImport(DLL, EntryPoint = "ecs_map_set_size", CallingConvention=CallingConvention.Cdecl)]
public static extern uint map_set_size(EcsMapT map, uint size);
[DllImport(DLL, EntryPoint = "ecs_map_bucket_count", CallingConvention=CallingConvention.Cdecl)]
public static extern uint map_bucket_count(EcsMapT map);
[DllImport(DLL, EntryPoint = "ecs_map_clear", CallingConvention=CallingConvention.Cdecl)]
public static extern void map_clear(EcsMapT map);
[DllImport(DLL, EntryPoint = "ecs_map_set64", CallingConvention=CallingConvention.Cdecl)]
public static extern void map_set64(EcsMapT map, ulong keyHash, ulong data);
[DllImport(DLL, EntryPoint = "ecs_map_get64", CallingConvention=CallingConvention.Cdecl)]
public static extern ulong map_get64(EcsMapT map, ulong keyHash);
[DllImport(DLL, EntryPoint = "ecs_map_has", CallingConvention=CallingConvention.Cdecl)]
public static extern bool map_has(EcsMapT map, ulong keyHash, ulong* valueOut);
[DllImport(DLL, EntryPoint = "ecs_map_remove", CallingConvention=CallingConvention.Cdecl)]
public static extern int map_remove(EcsMapT map, ulong keyHash);
[DllImport(DLL, EntryPoint = "ecs_map_next", CallingConvention=CallingConvention.Cdecl)]
public static extern ulong map_next(EcsIter it, ulong* keyOut);
[DllImport(DLL, EntryPoint = "ecs_get_stats", CallingConvention=CallingConvention.Cdecl)]
public static extern void get_stats(EcsWorldT world, EcsWorldStatsT stats);
[DllImport(DLL, EntryPoint = "ecs_free_stats", CallingConvention=CallingConvention.Cdecl)]
public static extern void free_stats(EcsWorldStatsT stats);
[DllImport(DLL, EntryPoint = "ecs_measure_frame_time", CallingConvention=CallingConvention.Cdecl)]
public static extern void measure_frame_time(EcsWorldT world, bool enable);
[DllImport(DLL, EntryPoint = "ecs_measure_system_time", CallingConvention=CallingConvention.Cdecl)]
public static extern void measure_system_time(EcsWorldT world, bool enable);
[DllImport(DLL, EntryPoint = "ecs_sleepf", CallingConvention=CallingConvention.Cdecl)]
public static extern void sleepf(double t);
[DllImport(DLL, EntryPoint = "ecs_time_to_double", CallingConvention=CallingConvention.Cdecl)]
public static extern double time_to_double(EcsTimeT t);
[DllImport(DLL, EntryPoint = "ecs_time_sub", CallingConvention=CallingConvention.Cdecl)]
public static extern EcsTimeT time_sub(EcsTimeT t1, EcsTimeT t2);
[DllImport(DLL, EntryPoint = "ecs_time_measure", CallingConvention=CallingConvention.Cdecl)]
public static extern double time_measure(EcsTimeT* start);
[DllImport(DLL, EntryPoint = "ecs_init", CallingConvention=CallingConvention.Cdecl)]
public static extern EcsWorldT init();
[DllImport(DLL, EntryPoint = "ecs_init_w_args", CallingConvention=CallingConvention.Cdecl)]
public static extern EcsWorldT init_w_args(int argc, byte* argv);
[DllImport(DLL, EntryPoint = "ecs_fini", CallingConvention=CallingConvention.Cdecl)]
public static extern int fini(EcsWorldT world);
[DllImport(DLL, EntryPoint = "ecs_quit", CallingConvention=CallingConvention.Cdecl)]
public static extern void quit(EcsWorldT world);
[DllImport(DLL, EntryPoint = "ecs_import_from_library", CallingConvention=CallingConvention.Cdecl)]
public static extern EcsEntityT import_from_library(EcsWorldT world, CharPtr libraryName, CharPtr moduleName, int flags);
[DllImport(DLL, EntryPoint = "ecs_progress", CallingConvention=CallingConvention.Cdecl)]
public static extern bool progress(EcsWorldT world, float deltaTime);
[DllImport(DLL, EntryPoint = "ecs_merge", CallingConvention=CallingConvention.Cdecl)]
public static extern void merge(EcsWorldT world);
[DllImport(DLL, EntryPoint = "ecs_set_automerge", CallingConvention=CallingConvention.Cdecl)]
public static extern void set_automerge(EcsWorldT world, bool autoMerge);
[DllImport(DLL, EntryPoint = "ecs_set_threads", CallingConvention=CallingConvention.Cdecl)]
public static extern void set_threads(EcsWorldT world, uint threads);
[DllImport(DLL, EntryPoint = "ecs_set_target_fps", CallingConvention=CallingConvention.Cdecl)]
public static extern void set_target_fps(EcsWorldT world, float fps);
[DllImport(DLL, EntryPoint = "ecs_get_delta_time", CallingConvention=CallingConvention.Cdecl)]
public static extern float get_delta_time(EcsWorldT world);
[DllImport(DLL, EntryPoint = "ecs_set_context", CallingConvention=CallingConvention.Cdecl)]
public static extern void set_context(EcsWorldT world, IntPtr ctx);
[DllImport(DLL, EntryPoint = "ecs_get_context", CallingConvention=CallingConvention.Cdecl)]
public static extern IntPtr get_context(EcsWorldT world);
[DllImport(DLL, EntryPoint = "ecs_get_tick", CallingConvention=CallingConvention.Cdecl)]
public static extern uint get_tick(EcsWorldT world);
[DllImport(DLL, EntryPoint = "ecs_dim", CallingConvention=CallingConvention.Cdecl)]
public static extern void dim(EcsWorldT world, uint entityCount);
[DllImport(DLL, EntryPoint = "ecs_set_entity_range", CallingConvention=CallingConvention.Cdecl)]
public static extern void set_entity_range(EcsWorldT world, EcsEntityT idStart, EcsEntityT idEnd);
[DllImport(DLL, EntryPoint = "ecs_clone", CallingConvention=CallingConvention.Cdecl)]
public static extern EcsEntityT clone(EcsWorldT world, EcsEntityT entity, bool copyValue);
[DllImport(DLL, EntryPoint = "ecs_delete", CallingConvention=CallingConvention.Cdecl)]
public static extern void delete(EcsWorldT world, EcsEntityT entity);
[DllImport(DLL, EntryPoint = "ecs_adopt", CallingConvention=CallingConvention.Cdecl)]
public static extern void adopt(EcsWorldT world, EcsEntityT entity, EcsEntityT parent);
[DllImport(DLL, EntryPoint = "ecs_orphan", CallingConvention=CallingConvention.Cdecl)]
public static extern void orphan(EcsWorldT world, EcsEntityT child, EcsEntityT parent);
[DllImport(DLL, EntryPoint = "ecs_contains", CallingConvention=CallingConvention.Cdecl)]
public static extern bool contains(EcsWorldT world, EcsEntityT parent, EcsEntityT child);
[DllImport(DLL, EntryPoint = "ecs_get_parent", CallingConvention=CallingConvention.Cdecl)]
public static extern EcsEntityT get_parent(EcsWorldT world, EcsEntityT entity, EcsEntityT component);
[DllImport(DLL, EntryPoint = "ecs_get_type", CallingConvention=CallingConvention.Cdecl)]
public static extern EcsTypeT get_type(EcsWorldT world, EcsEntityT entity);
[DllImport(DLL, EntryPoint = "ecs_get_id", CallingConvention=CallingConvention.Cdecl)]
public static extern CharPtr get_id(EcsWorldT world, EcsEntityT entity);
[DllImport(DLL, EntryPoint = "ecs_is_empty", CallingConvention=CallingConvention.Cdecl)]
public static extern bool is_empty(EcsWorldT world, EcsEntityT entity);
[DllImport(DLL, EntryPoint = "ecs_lookup", CallingConvention=CallingConvention.Cdecl)]
public static extern EcsEntityT lookup(EcsWorldT world, CharPtr id);
[DllImport(DLL, EntryPoint = "ecs_lookup_child", CallingConvention=CallingConvention.Cdecl)]
public static extern EcsEntityT lookup_child(EcsWorldT world, EcsEntityT parent, CharPtr id);
[DllImport(DLL, EntryPoint = "ecs_type_from_entity", CallingConvention=CallingConvention.Cdecl)]
public static extern EcsTypeT type_from_entity(EcsWorldT world, EcsEntityT entity);
[DllImport(DLL, EntryPoint = "ecs_entity_from_type", CallingConvention=CallingConvention.Cdecl)]
public static extern EcsEntityT entity_from_type(EcsWorldT world, EcsTypeT type);
[DllImport(DLL, EntryPoint = "ecs_type_get_component", CallingConvention=CallingConvention.Cdecl)]
public static extern EcsEntityT type_get_component(EcsWorldT world, EcsTypeT type, uint index);
[DllImport(DLL, EntryPoint = "ecs_enable", CallingConvention=CallingConvention.Cdecl)]
public static extern void enable(EcsWorldT world, EcsEntityT system, bool enabled);
[DllImport(DLL, EntryPoint = "ecs_set_period", CallingConvention=CallingConvention.Cdecl)]
public static extern void set_period(EcsWorldT world, EcsEntityT system, float period);
[DllImport(DLL, EntryPoint = "ecs_is_enabled", CallingConvention=CallingConvention.Cdecl)]
public static extern bool is_enabled(EcsWorldT world, EcsEntityT system);
[DllImport(DLL, EntryPoint = "ecs_run", CallingConvention=CallingConvention.Cdecl)]
public static extern EcsEntityT run(EcsWorldT world, EcsEntityT system, float deltaTime, IntPtr param);
[DllImport(DLL, EntryPoint = "ecs_new_entity", CallingConvention=CallingConvention.Cdecl)]
public static extern EcsEntityT new_entity(EcsWorldT world, CharPtr id, CharPtr components);
[DllImport(DLL, EntryPoint = "ecs_new_component", CallingConvention=CallingConvention.Cdecl)]
public static extern EcsEntityT new_component(EcsWorldT world, CharPtr id, UIntPtr size);
[DllImport(DLL, EntryPoint = "ecs_new_system", CallingConvention=CallingConvention.Cdecl)]
public static extern EcsEntityT new_system(EcsWorldT world, CharPtr id, EcsSystemKind kind, CharPtr sig, EcsSystemActionTDelegate action);
[DllImport(DLL, EntryPoint = "ecs_new_type", CallingConvention=CallingConvention.Cdecl)]
public static extern EcsEntityT new_type(EcsWorldT world, CharPtr id, CharPtr components);
[DllImport(DLL, EntryPoint = "ecs_new_prefab", CallingConvention=CallingConvention.Cdecl)]
public static extern EcsEntityT new_prefab(EcsWorldT world, CharPtr id, CharPtr sig);
[DllImport(DLL, EntryPoint = "ecs_strerror", CallingConvention=CallingConvention.Cdecl)]
public static extern CharPtr strerror(uint errorCode);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment