fix: 'q' would close the ui when you're typing in something

This commit is contained in:
minjaesong
2023-09-05 00:41:43 +09:00
parent d0e1555ad0
commit cf98c13111
7 changed files with 54 additions and 11 deletions

View File

@@ -0,0 +1,25 @@
package net.torvald.terrarum
/**
* Created by minjaesong on 2023-09-05.
*/
object TerrarumGlobalState {
var 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
}