more commands, change display communication to new lib

This commit is contained in:
Vinzenz Schroeter 2024-04-12 16:05:24 +02:00
parent 38463ac109
commit 7213318838
31 changed files with 240 additions and 417 deletions

View file

@ -1,3 +1,3 @@
namespace TanksServer.Models;
internal record struct PixelPosition(int X, int Y);
internal record struct PixelPosition(ushort X, ushort Y);

View file

@ -10,15 +10,15 @@ internal static class PositionHelpers
Debug.Assert(subX < 8);
Debug.Assert(subY < 8);
return new PixelPosition(
X: position.X * MapService.TileSize + subX,
Y: position.Y * MapService.TileSize + subY
X: (ushort)(position.X * MapService.TileSize + subX),
Y: (ushort)(position.Y * MapService.TileSize + subY)
);
}
public static PixelPosition ToPixelPosition(this FloatPosition position) => new(
X: (int)position.X % MapService.PixelsPerRow,
Y: (int)position.Y % MapService.PixelsPerRow
X: (ushort)((int)position.X % MapService.PixelsPerRow),
Y: (ushort)((int)position.Y % MapService.PixelsPerRow)
);
public static TilePosition ToTilePosition(this PixelPosition position) => new(