summaryrefslogtreecommitdiff
path: root/Djup.Native/LibDjup.cs
blob: 0ecf7a834b47088d79a74888dccc7dae5d7071ce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
using System.Runtime.InteropServices;

namespace Djup.Native;

public static partial class LibDjup
{
    const string LibraryName = "djup";
    const string Prefix = "dp_";

    [LibraryImport(LibraryName, EntryPoint = Prefix + nameof(hello_world))]
    public static partial void hello_world();

    [LibraryImport(LibraryName, EntryPoint = Prefix + nameof(get_num))]
    public static partial int get_num();

    [LibraryImport(LibraryName, EntryPoint = Prefix + nameof(get_vec2))]
    public static partial Vec2 get_vec2();

    [LibraryImport(LibraryName, EntryPoint = Prefix + nameof(log_set_output))]
    public static partial Vec2 log_set_output([MarshalAs(UnmanagedType.FunctionPtr)] LoggerDelegate logger);

    [LibraryImport(LibraryName, EntryPoint = Prefix + nameof(log_set_level))]
    public static partial Vec2 log_set_level(LogLevel minLevel);

    [LibraryImport(LibraryName, EntryPoint = Prefix + nameof(world_create))]
    public static partial IntPtr world_create();

    [LibraryImport(LibraryName, EntryPoint = Prefix + nameof(world_free))]
    public static partial void world_free(IntPtr world);

    [LibraryImport(LibraryName, EntryPoint = Prefix + nameof(world_create_entity))]
    public static partial int world_create_entity(IntPtr world, EntityKind kind);

    [LibraryImport(LibraryName, EntryPoint = Prefix + nameof(world_find_entity))]
    public static unsafe partial Entity* world_find_entity(IntPtr world, int entityId);

    [LibraryImport(LibraryName, EntryPoint = Prefix + nameof(world_remove_entity))]
    public static partial void world_remove_entity(IntPtr world, int entityId);

    [LibraryImport(LibraryName, EntryPoint = Prefix + nameof(world_tick))]
    public static partial int world_tick(IntPtr world, double delta);
}