position is now center, socket improvements
This commit is contained in:
parent
40eba7a7c7
commit
d4d0abd013
1 changed files with 129 additions and 101 deletions
25
TanksServer/Graphics/DrawMapStep.cs
Normal file
25
TanksServer/Graphics/DrawMapStep.cs
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
using DisplayCommands;
|
||||
using TanksServer.GameLogic;
|
||||
|
||||
namespace TanksServer.Graphics;
|
||||
|
||||
internal sealed class DrawMapStep(MapService map) : IDrawStep
|
||||
{
|
||||
public void Draw(PixelGrid buffer)
|
||||
{
|
||||
for (ushort tileY = 0; tileY < MapService.TilesPerColumn; tileY++)
|
||||
for (ushort tileX = 0; tileX < MapService.TilesPerRow; tileX++)
|
||||
{
|
||||
var tile = new TilePosition(tileX, tileY);
|
||||
if (!map.IsCurrentlyWall(tile))
|
||||
continue;
|
||||
|
||||
for (byte pixelInTileY = 0; pixelInTileY < MapService.TileSize; pixelInTileY++)
|
||||
for (byte pixelInTileX = 0; pixelInTileX < MapService.TileSize; pixelInTileX++)
|
||||
{
|
||||
var position = tile.GetPixelRelative(pixelInTileX, pixelInTileY);
|
||||
buffer[position.X, position.Y] = pixelInTileX % 2 == pixelInTileY % 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in a new issue