From 3870982f640260822bf605e693782ce9f5d79cf6 Mon Sep 17 00:00:00 2001 From: Joel Stålnacke Date: Fri, 20 Mar 2026 21:38:46 +0200 Subject: Get a player drawing on screen --- Djup.Native/src/Types.cs | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) (limited to 'Djup.Native/src/Types.cs') 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 Players => + new ReadOnlySpan(players, playersLength); + + public ReadOnlySpan Bullets => + new ReadOnlySpan(bullets, bulletsLength); } public enum LogLevel -- cgit v1.2.3