more cleanup regarding fireRecalculateEvent

This commit is contained in:
minjaesong
2019-06-25 22:48:38 +09:00
parent ed58e72724
commit 04ea9aec42
7 changed files with 12 additions and 21 deletions

View File

@@ -2,6 +2,7 @@ package net.torvald.terrarum.gameworld
import com.badlogic.gdx.utils.Disposable
import net.torvald.UnsafeHelper
import net.torvald.UnsafePtr
import net.torvald.terrarum.AppLoader.printdbg
/**
@@ -13,7 +14,7 @@ import net.torvald.terrarum.AppLoader.printdbg
open class BlockLayer(val width: Int, val height: Int) : Disposable {
// using unsafe pointer gets you 100 fps, whereas using directbytebuffer gets you 90
private val ptr = UnsafeHelper.allocate(width * height * BYTES_PER_BLOCK)
internal val ptr: UnsafePtr = UnsafeHelper.allocate(width * height * BYTES_PER_BLOCK)
//private val directByteBuffer: ByteBuffer
@@ -142,8 +143,6 @@ open class BlockLayer(val width: Int, val height: Int) : Disposable {
printdbg(this, "BlockLayer successfully freed")
}
internal fun getPtr() = ptr
companion object {
@Transient val BYTES_PER_BLOCK = 2L
}

View File

@@ -472,6 +472,8 @@ open class GameWorld : Disposable {
disposed = true
}
override fun equals(other: Any?) = layerTerrain.ptr == (other as GameWorld).layerTerrain.ptr
companion object {
@Transient const val WALL = 0
@Transient const val TERRAIN = 1