mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-16 05:24:06 +09:00
utilising new mouselatch
This commit is contained in:
@@ -44,6 +44,24 @@ class MouseLatch(val button: List<Int> = listOf(App.getConfigInt("config_mousepr
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Your usual latch except it does not auto-unlatch
|
||||
*/
|
||||
fun latchNoRelease(action: () -> Unit) {
|
||||
if (isNotLatched() && button.any { Gdx.input.isButtonPressed(it) }) {
|
||||
status.set(true)
|
||||
action()
|
||||
}
|
||||
}
|
||||
|
||||
fun forceLatch() {
|
||||
status.set(true)
|
||||
}
|
||||
|
||||
fun forceUnlatch() {
|
||||
status.set(false)
|
||||
}
|
||||
|
||||
fun unlatch() {
|
||||
if (button.none { Gdx.input.isButtonPressed(it) }) {
|
||||
status.set(false)
|
||||
|
||||
Reference in New Issue
Block a user