mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-13 12:04:06 +09:00
new map data format and its read/writer
!! UNTESTED !! UNTESTED !! UNTESTED !!
This commit is contained in:
@@ -3,14 +3,23 @@ package net.torvald.terrarum.gameworld
|
||||
/**
|
||||
* Created by minjaesong on 2016-01-17.
|
||||
*/
|
||||
open class MapLayer(val width: Int, val height: Int) : Iterable<Byte> {
|
||||
open class MapLayer : Iterable<Byte> {
|
||||
|
||||
val width: Int; val height: Int
|
||||
internal @Volatile var data: ByteArray // in parallel programming: do not trust your register; always read freshly from RAM!
|
||||
|
||||
init {
|
||||
constructor(width: Int, height: Int) {
|
||||
this.width = width
|
||||
this.height = height
|
||||
data = ByteArray(width * height)
|
||||
}
|
||||
|
||||
constructor(width: Int, height: Int, data: ByteArray) {
|
||||
this.data = data
|
||||
this.width = width
|
||||
this.height = height
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an iterator over elements of type `T`.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user