mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-09 10:04:05 +09:00
25 lines
417 B
Kotlin
25 lines
417 B
Kotlin
package net.torvald.terrarum
|
|
|
|
/**
|
|
* Created by minjaesong on 2023-09-05.
|
|
*/
|
|
object TerrarumGlobalState {
|
|
|
|
val HAS_KEYBOARD_INPUT_FOCUS = CountedBool()
|
|
|
|
}
|
|
|
|
class CountedBool {
|
|
private var counter = 0L
|
|
|
|
fun set() {
|
|
counter += 1
|
|
}
|
|
fun unset() {
|
|
if (counter >= 1) counter -= 1
|
|
}
|
|
val value: Boolean
|
|
get() = counter > 0
|
|
fun isOn() = value
|
|
fun isOff() = !value
|
|
} |