From 572e02956cb4d27957db43834012bc037e03ff0f Mon Sep 17 00:00:00 2001 From: rogo Date: Sun, 27 Apr 2025 13:18:18 +0200 Subject: [PATCH] fixed benchmark placement --- Scripts/Level.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Scripts/Level.cs b/Scripts/Level.cs index e4993a3..666b7ed 100644 --- a/Scripts/Level.cs +++ b/Scripts/Level.cs @@ -69,7 +69,7 @@ public class Level { GD.Print("benchmark"); for (int x = 0; x < chunksPerX; x++) { for (int y = 0; y < chunksPerY; y++) { - WritePixel(x * chunkResX/2, y * chunkResY/2, 100); + WritePixel((x * chunkResX) + chunkResX/2, (y * chunkResY) + chunkResY/2, 100); } } } @@ -148,13 +148,18 @@ public class Level { } public Image DrawLevel() { + // chunk for (int cx = 0; cx < chunksPerX; cx++) { for (int cy = 0; cy < chunksPerY; cy++) { + // pixel in chunk for (int x = 0; x < chunkResX; x++) { for (int y = 0; y < chunkResY; y++) { // TODO: multithreading here! use Chunk.DrawLevel() and stitch images together - image.SetPixel(cx*chunkResX + x, cy*chunkResY + y, chunks[cx,cy].Elements[x, y].Color); + + Element e = chunks[cx, cy].Elements[x, y]; + if (e.WasMoved()) + image.SetPixel(cx*chunkResX + x, cy*chunkResY + y, e.Color); } } }