fixed benchmark placement

This commit is contained in:
2025-04-27 13:18:18 +02:00
parent de99d54ad6
commit 572e02956c

View File

@@ -69,7 +69,7 @@ public class Level {
GD.Print("benchmark"); GD.Print("benchmark");
for (int x = 0; x < chunksPerX; x++) { for (int x = 0; x < chunksPerX; x++) {
for (int y = 0; y < chunksPerY; y++) { for (int y = 0; y < chunksPerY; y++) {
WritePixel<Dirt>(x * chunkResX/2, y * chunkResY/2, 100); WritePixel<Dirt>((x * chunkResX) + chunkResX/2, (y * chunkResY) + chunkResY/2, 100);
} }
} }
} }
@@ -148,13 +148,18 @@ public class Level {
} }
public Image DrawLevel() { public Image DrawLevel() {
// chunk
for (int cx = 0; cx < chunksPerX; cx++) { for (int cx = 0; cx < chunksPerX; cx++) {
for (int cy = 0; cy < chunksPerY; cy++) { for (int cy = 0; cy < chunksPerY; cy++) {
// pixel in chunk
for (int x = 0; x < chunkResX; x++) { for (int x = 0; x < chunkResX; x++) {
for (int y = 0; y < chunkResY; y++) { for (int y = 0; y < chunkResY; y++) {
// TODO: multithreading here! use Chunk.DrawLevel() and stitch images together // 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);
} }
} }
} }