This commit is contained in:
minjaesong
2020-04-13 05:03:53 +09:00
parent 0200fa8803
commit a61ff82ddd
2 changed files with 45 additions and 1 deletions

View File

@@ -17,7 +17,7 @@ uniform sampler2D u_texture;
uniform vec2 screenDimension;
uniform vec2 tilesInAxes; // basically a screen dimension; vec2(tiles_in_horizontal, tiles_in_vertical)
uniform vec2 tilesInAxes; // size of the tilemap texture; vec2(tiles_in_horizontal, tiles_in_vertical)
uniform sampler2D tilemap; // RGBA8888

View File

@@ -104,6 +104,16 @@ internal class UnsafePtr(pointer: Long, allocSize: Long) {
// NOTE: get/set multibyte values are NOT BYTE-ALIGNED!
fun getDouble(index: Long): Double {
checkNullPtr(index)
return UnsafeHelper.unsafe.getDouble(ptr + index)
}
fun getLong(index: Long): Long {
checkNullPtr(index)
return UnsafeHelper.unsafe.getLong(ptr + index)
}
fun getFloat(index: Long): Float {
checkNullPtr(index)
return UnsafeHelper.unsafe.getFloat(ptr + index)
@@ -114,6 +124,28 @@ internal class UnsafePtr(pointer: Long, allocSize: Long) {
return UnsafeHelper.unsafe.getInt(ptr + index)
}
fun getShort(index: Long): Short {
checkNullPtr(index)
return UnsafeHelper.unsafe.getShort(ptr + index)
}
fun getChar(index: Long): Char {
checkNullPtr(index)
return UnsafeHelper.unsafe.getChar(ptr + index)
}
fun setDouble(index: Long, value: Double) {
checkNullPtr(index)
UnsafeHelper.unsafe.putDouble(ptr + index, value)
}
fun setLong(index: Long, value: Long) {
checkNullPtr(index)
UnsafeHelper.unsafe.putLong(ptr + index, value)
}
fun setFloat(index: Long, value: Float) {
checkNullPtr(index)
UnsafeHelper.unsafe.putFloat(ptr + index, value)
@@ -124,6 +156,18 @@ internal class UnsafePtr(pointer: Long, allocSize: Long) {
UnsafeHelper.unsafe.putInt(ptr + index, value)
}
fun setShort(index: Long, value: Short) {
checkNullPtr(index)
UnsafeHelper.unsafe.putShort(ptr + index, value)
}
fun setChar(index: Long, value: Char) {
checkNullPtr(index)
UnsafeHelper.unsafe.putChar(ptr + index, value)
}
fun fillWith(byte: Byte) {
UnsafeHelper.unsafe.setMemory(ptr, size, byte)
}