disposable UI; loading screen mockup (i heard like loading screen -- sonic 06)

This commit is contained in:
minjaesong
2017-07-13 17:53:40 +09:00
parent 49a9278c59
commit d241e5cbb0
33 changed files with 253 additions and 33 deletions

View File

@@ -1,16 +1,20 @@
package net.torvald.dataclass
import java.util.*
import java.util.function.Consumer
/**
* Simple ArrayList wrapper that acts as history keeper. You can append any data but cannot delete.
*
* Created by minjaesong on 16-07-13.
*/
class HistoryArray<T>(val historyMax: Int) {
class HistoryArray<T>(val size: Int) {
val history = ArrayList<T?>(Math.min(historyMax, 256)) // 256: arbitrary set upper bound
val history = ArrayList<T?>(Math.min(size, 256)) // 256: arbitrary set upper bound
val lastIndex = size - 1
val elemCount: Int
get() = history.size
fun add(value: T) {
if (history.size == 0) {
@@ -20,11 +24,11 @@ class HistoryArray<T>(val historyMax: Int) {
// push existing values to an index
else {
for (i in history.size - 1 downTo 0) {
// if history.size is smaller than historyMax, make room by appending
if (i == history.size - 1 && i < historyMax - 1)
// if history.size is smaller than 'size', make room by appending
if (i == history.size - 1 && i < size - 1)
history.add(history[i])
// actually move if we have some room
else if (i < historyMax - 1)
else if (i < size - 1)
history[i + 1] = history[i]
}
}