fixed memory leak
fixed trying to draw out of bounds
This commit is contained in:
@@ -138,9 +138,9 @@ public class Level {
|
|||||||
|
|
||||||
// ignore everything outside
|
// ignore everything outside
|
||||||
if (chunkX < 0) continue;
|
if (chunkX < 0) continue;
|
||||||
if (chunkX > chunksPerX) continue;
|
if (chunkX >= chunksPerX) continue;
|
||||||
if (chunkY < 0) continue;
|
if (chunkY < 0) continue;
|
||||||
if (chunkY > chunksPerY) continue;
|
if (chunkY >= chunksPerY) continue;
|
||||||
|
|
||||||
chunks[chunkX, chunkY].WritePixel<T>(ptX, ptY);
|
chunks[chunkX, chunkY].WritePixel<T>(ptX, ptY);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ public partial class Main : Node2D {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public override void _Process(double delta) {
|
public override void _Process(double delta) {
|
||||||
|
mLevelDrawer.Texture?.Dispose();
|
||||||
mLevelDrawer.Texture = ImageTexture.CreateFromImage(Level.DrawLevel());
|
mLevelDrawer.Texture = ImageTexture.CreateFromImage(Level.DrawLevel());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user