Memory leak alleviated FUCK YEAH?

This commit is contained in:
minjaesong
2018-12-08 04:26:01 +09:00
parent 7570c9674b
commit dffb3f95a2
3 changed files with 43 additions and 18 deletions

View File

@@ -740,6 +740,7 @@ object LightmapRenderer {
return ret
}
private var _init = false
fun resize(screenW: Int, screenH: Int) {
// make sure the BlocksDrawer is resized first!
@@ -748,6 +749,12 @@ object LightmapRenderer {
val tilesInHorizontal = (screenW.toFloat() / TILE_SIZE).ceilInt() + 1
val tilesInVertical = (screenH.toFloat() / TILE_SIZE).ceilInt() + 1
if (_init) {
lightBuffer.dispose()
}
else {
_init = true
}
lightBuffer = Pixmap(tilesInHorizontal, tilesInVertical, Pixmap.Format.RGBA8888)