servicepoint-tanks/tanks-backend/TanksServer/Graphics/DrawMapStep.cs

32 lines
897 B
C#
Raw Normal View History

2024-04-10 19:25:45 +02:00
using TanksServer.GameLogic;
2024-04-10 19:25:45 +02:00
namespace TanksServer.Graphics;
internal sealed class DrawMapStep(MapService map) : IDrawStep
{
2024-05-05 13:51:28 +02:00
public void Draw(GamePixelGrid pixels) => Draw(pixels, map.Current);
private static void Draw(GamePixelGrid pixels, Map map)
{
for (ulong y = 0; y < MapService.PixelsPerColumn; y++)
for (ulong x = 0; x < MapService.PixelsPerRow; x++)
{
if (!map.IsWall(x, y))
continue;
pixels[x, y].EntityType = GamePixelEntityType.Wall;
}
}
2024-05-05 13:51:28 +02:00
2024-10-16 20:15:32 +02:00
public static void Draw(Bitmap pixels, Map map)
2024-05-05 13:51:28 +02:00
{
for (ulong y = 0; y < MapService.PixelsPerColumn; y++)
for (ulong x = 0; x < MapService.PixelsPerRow; x++)
{
if (!map.IsWall(x, y))
continue;
pixels.Set(x, y, true);
}
2024-05-05 13:51:28 +02:00
}
}