summaryrefslogtreecommitdiff
path: root/Djup.Native/src/Types.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Djup.Native/src/Types.cs')
-rw-r--r--Djup.Native/src/Types.cs27
1 files changed, 11 insertions, 16 deletions
diff --git a/Djup.Native/src/Types.cs b/Djup.Native/src/Types.cs
index 7d9c41e..3afce83 100644
--- a/Djup.Native/src/Types.cs
+++ b/Djup.Native/src/Types.cs
@@ -1,5 +1,4 @@
using System.Diagnostics;
-using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
namespace Djup.Native;
@@ -56,24 +55,20 @@ public struct Bullet
}
[StructLayout(LayoutKind.Sequential)]
-public struct Snapshot
+public unsafe struct Snapshot
{
- [InlineArray(Constants.WorldMaxPlayers)]
- public struct PlayerArray
- {
- private Player _element0;
- }
-
- [InlineArray(Constants.WorldMaxBullets)]
- public struct BallArray
- {
- private Bullet _element0;
- }
-
private byte active;
public uint Tick { get; }
- public PlayerArray Players { get; }
- public BallArray Bullets { get; }
+ private int playersLength;
+ private Player* players;
+ private int bulletsLength;
+ private Bullet* bullets;
+
+ public ReadOnlySpan<Player> Players =>
+ new ReadOnlySpan<Player>(players, playersLength);
+
+ public ReadOnlySpan<Bullet> Bullets =>
+ new ReadOnlySpan<Bullet>(bullets, bulletsLength);
}
public enum LogLevel