summaryrefslogtreecommitdiff
path: root/Djup.Native/Types.cs
diff options
context:
space:
mode:
authorJoel Stålnacke <joel@saker.fi>2024-10-11 13:31:44 +0300
committerJoel Stålnacke <joel@saker.fi>2024-10-13 13:34:46 +0300
commit53a1cdf5bee2955995dfbf441f5354d1dcfc1e0c (patch)
treebe8c2894226a2b7e1a47f7583f2041df75f795b3 /Djup.Native/Types.cs
parent4bac6ae2e725a1997674fd3369bf4ea032235d8b (diff)
Add Godot client
Diffstat (limited to 'Djup.Native/Types.cs')
-rw-r--r--Djup.Native/Types.cs41
1 files changed, 41 insertions, 0 deletions
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; }
+}