2024-05-05 13:51:28 +02:00
|
|
|
using DisplayCommands;
|
2024-04-10 19:25:45 +02:00
|
|
|
using TanksServer.GameLogic;
|
2024-04-07 19:05:50 +02:00
|
|
|
|
2024-04-10 19:25:45 +02:00
|
|
|
namespace TanksServer.Graphics;
|
2024-04-07 19:05:50 +02:00
|
|
|
|
2024-04-13 14:07:14 +02:00
|
|
|
internal sealed class DrawMapStep(MapService map) : IDrawStep
|
2024-04-07 19:05:50 +02:00
|
|
|
{
|
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)
|
2024-04-07 19:05:50 +02:00
|
|
|
{
|
2024-04-14 21:10:21 +02:00
|
|
|
for (ushort y = 0; y < MapService.PixelsPerColumn; y++)
|
|
|
|
for (ushort x = 0; x < MapService.PixelsPerRow; x++)
|
2024-04-07 19:05:50 +02:00
|
|
|
{
|
2024-05-05 13:51:28 +02:00
|
|
|
if (!map.IsWall(x, y))
|
2024-04-07 19:05:50 +02:00
|
|
|
continue;
|
2024-04-15 20:34:23 +02:00
|
|
|
|
|
|
|
pixels[x, y].EntityType = GamePixelEntityType.Wall;
|
2024-04-07 19:05:50 +02:00
|
|
|
}
|
|
|
|
}
|
2024-05-05 13:51:28 +02:00
|
|
|
|
|
|
|
public static void Draw(PixelGrid pixels, Map map)
|
|
|
|
{
|
|
|
|
for (ushort y = 0; y < MapService.PixelsPerColumn; y++)
|
|
|
|
for (ushort x = 0; x < MapService.PixelsPerRow; x++)
|
|
|
|
{
|
|
|
|
if (!map.IsWall(x, y))
|
|
|
|
continue;
|
|
|
|
pixels[x, y] = true;
|
|
|
|
}
|
|
|
|
}
|
2024-04-13 14:07:14 +02:00
|
|
|
}
|