using System.Runtime.InteropServices; namespace Djup.Native; public static partial class LibDjup { const string LibraryName = "djup"; [LibraryImport(LibraryName, EntryPoint = nameof(vec2_dot))] public static partial Vec2 vec2_dot(Vec2 a, Vec2 b); [LibraryImport(LibraryName, EntryPoint = nameof(vec2_length))] public static partial float vec2_length(Vec2 v); [LibraryImport(LibraryName, EntryPoint = nameof(vec2_normal))] public static partial Vec2 vec2_normal(Vec2 v); [LibraryImport(LibraryName, EntryPoint = nameof(sim_log_init))] public static partial void sim_log_init(IntPtr simulation, [MarshalAs(UnmanagedType.FunctionPtr)] LoggerDelegate logger, [MarshalAs(UnmanagedType.FunctionPtr)] AssertDelegate assert); [LibraryImport(LibraryName, EntryPoint = nameof(sim_set_log_level))] public static partial void sim_set_log_level(IntPtr simulation, LogLevel minLevel); [LibraryImport(LibraryName, EntryPoint = nameof(sim_create))] public static partial IntPtr sim_create(int snapshots, int entities); [LibraryImport(LibraryName, EntryPoint = nameof(sim_free))] public static partial void sim_free(IntPtr simulation); [LibraryImport(LibraryName, EntryPoint = nameof(sim_get_snapshot))] public unsafe static partial Snapshot* sim_get_snapshot(IntPtr simulation); [LibraryImport(LibraryName, EntryPoint = nameof(sim_return_snapshot))] public unsafe static partial void sim_return_snapshot(IntPtr simulation, Snapshot* snapshot); [LibraryImport(LibraryName, EntryPoint = nameof(sim_tick))] public unsafe static partial void sim_tick(Snapshot* current, Snapshot* next); [LibraryImport(LibraryName, EntryPoint = nameof(snapshot_create_entity))] public unsafe static partial EntityId snapshot_create_entity(Snapshot* snapshot); public enum ComponentAddError { None, InvalidArg, InvalidId, EntityNotFound } [LibraryImport(LibraryName, EntryPoint = nameof(snapshot_add_component))] public unsafe static partial ComponentAddError snapshot_add_component(Snapshot* snapshot, EntityId entity, Component component, void* init); public enum ComponentRemoveError { None, InvalidArg, InvalidId, EntityNotFound } [LibraryImport(LibraryName, EntryPoint = nameof(snapshot_remove_components))] public unsafe static partial ComponentRemoveError snapshot_remove_components(Snapshot* snapshot, EntityId entity, Components components); [LibraryImport(LibraryName, EntryPoint = nameof(snapshot_reset_entity))] public unsafe static partial ComponentRemoveError snapshot_reset_entity(Snapshot* snapshot, EntityId entity); }