wip move to new uniffi language binding

This commit is contained in:
Vinzenz Schroeter 2024-11-12 18:27:04 +01:00
parent f7a5d8f823
commit 53cbdd8440
30 changed files with 211 additions and 187 deletions

View file

@ -5,7 +5,7 @@ namespace TanksServer.Graphics;
internal sealed class DrawTanksStep(MapEntityManager entityManager) : IDrawStep
{
private readonly SpriteSheet _tankSprites =
SpriteSheet.FromImageFile("assets/tank.png", MapService.TileSize, MapService.TileSize);
SpriteSheet.FromImageFile("assets/tank.png", (int)MapService.TileSize, (int)MapService.TileSize);
public void Draw(GamePixelGrid pixels)
{
@ -14,16 +14,16 @@ internal sealed class DrawTanksStep(MapEntityManager entityManager) : IDrawStep
var tankPosition = tank.Bounds.TopLeft;
for (byte dy = 0; dy < MapService.TileSize; dy++)
for (byte dx = 0; dx < MapService.TileSize; dx++)
{
var pixel = _tankSprites[tank.Orientation][dx, dy];
if (!pixel.HasValue || !pixel.Value)
continue;
for (byte dx = 0; dx < MapService.TileSize; dx++)
{
var pixel = _tankSprites[tank.Orientation][dx, dy];
if (!pixel.HasValue || !pixel.Value)
continue;
var (x, y) = tankPosition.GetPixelRelative(dx, dy);
pixels[x, y].EntityType = GamePixelEntityType.Tank;
pixels[x, y].BelongsTo = tank.Owner;
}
var (x, y) = tankPosition.GetPixelRelative(dx, dy);
pixels[x, y].EntityType = GamePixelEntityType.Tank;
pixels[x, y].BelongsTo = tank.Owner;
}
}
}
}