diff options
| author | Joel Stålnacke <joel@saker.fi> | 2026-03-20 21:38:46 +0200 |
|---|---|---|
| committer | Joel Stålnacke <joel@saker.fi> | 2026-03-20 21:38:46 +0200 |
| commit | 3870982f640260822bf605e693782ce9f5d79cf6 (patch) | |
| tree | 29cba57f08ae2d0ea32968cba49b1c4e6f69987f /Djup.Native/src/Types.cs | |
| parent | 745406dc65aecc438a53f96badc387a32b7a338f (diff) | |
Diffstat (limited to 'Djup.Native/src/Types.cs')
| -rw-r--r-- | Djup.Native/src/Types.cs | 27 |
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 |
