Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasteles committed Mar 25, 2024
1 parent ed16f48 commit 16f12a2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions samples/SpaceWar/SaveInputsToFileListener.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public void OnConfirmed(in Frame frame, in ConfirmedInputs<PlayerInputs> inputs)
{
for (var i = 0; i < inputs.Count; i++)
{
var input = (ushort) inputs.Inputs[i];
var input = (ushort)inputs.Inputs[i];
Array.Clear(inputBuffer);
if (!input.TryFormat(inputBuffer, out _))
throw new InvalidOperationException("unable to save input");
Expand All @@ -39,7 +39,7 @@ public static IEnumerable<ConfirmedInputs<PlayerInputs>> GetInputs(int players,
for (var i = 0; i < players; i++)
{
if (ushort.TryParse(buffer.AsSpan().Slice(i * InputSize, InputSize), out var value))
inputsBuffer[i] = (PlayerInputs) value;
inputsBuffer[i] = (PlayerInputs)value;
}

yield return new ConfirmedInputs<PlayerInputs>(inputsBuffer.AsSpan()[..players]);
Expand Down

0 comments on commit 16f12a2

Please sign in to comment.