From 53a1cdf5bee2955995dfbf441f5354d1dcfc1e0c Mon Sep 17 00:00:00 2001 From: Joel Stålnacke Date: Fri, 11 Oct 2024 13:31:44 +0300 Subject: Add Godot client --- Djup.Native/Types.cs | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 Djup.Native/Types.cs (limited to 'Djup.Native/Types.cs') diff --git a/Djup.Native/Types.cs b/Djup.Native/Types.cs new file mode 100644 index 0000000..c930bd6 --- /dev/null +++ b/Djup.Native/Types.cs @@ -0,0 +1,41 @@ +using System.Runtime.InteropServices; + +namespace Djup.Native; + +[StructLayout(LayoutKind.Sequential)] +public struct Vec2 +{ + public float X { get; } + public float Y { get; } + + public Vec2(float x, float y) + { + X = x; + Y = y; + } + + public override string ToString() => $"({X}, {Y})"; +} + +public enum EntityKind +{ + None = 0, + Ball +} + +[StructLayout(LayoutKind.Explicit)] +public struct Entity +{ + [FieldOffset(0)] + public EntityKind kind; + + [FieldOffset(4)] + public Ball ball; +} + +[StructLayout(LayoutKind.Sequential)] +public struct Ball +{ + public Vec2 Position { get; set; } + public Vec2 Velocity { get; set; } +} -- cgit v1.2.3