rudimentary framerate benchmarking (turning it on will make the game run significantly slower)

This commit is contained in:
minjaesong
2022-10-15 01:09:51 +09:00
parent 8533f92274
commit 93af194c8a
6 changed files with 44 additions and 4 deletions

View File

@@ -80,6 +80,9 @@ class CircularArray<T>(val size: Int, val overwriteOnOverflow: Boolean): Iterabl
}
}
/**
* To just casually add items to the list, use [appendHead], **please!**
*/
fun appendTail(item: T) {
// even if overflowing is enabled, appending at tail causes head element to be altered, therefore such action
// must be blocked by throwing overflow error
@@ -183,6 +186,12 @@ class CircularArray<T>(val size: Int, val overwriteOnOverflow: Boolean): Iterabl
return accumulator
}
fun toList(): List<T> {
val list = ArrayList<T>()
iterator().forEach { list.add(it) }
return list.toList()
}
private inline fun Int.wrap() = this fmod size
override fun toString(): String {