Improve the ClickGui.boxContext() method

This commit is contained in:
Username404-59 2021-06-07 00:18:22 +02:00
parent c992b24b16
commit 1b4037be02
Signed by: Username404-59
GPG Key ID: 7AB361FBB257A5D1
1 changed files with 1 additions and 1 deletions

View File

@ -10,7 +10,7 @@ object ClickGui: SnowyScreen() {
override val components = mutableSetOf<Element>()
val clickBoxes get() = components.filterIsInstance<ClickBox>()
inline fun boxContext(args: ClickBox.() -> Unit) = components.filterIsInstance<ClickBox>().forEach(args)
inline fun boxContext(args: ClickBox.() -> Unit) = clickBoxes.forEach(args)
private inline fun buttonsContext(args: ColoredElement.() -> Unit) = boxContext { buttons.forEach(args) }
override fun mouseClicked(d: Double, e: Double, i: Int): Boolean { buttonsContext { this.mouseClicked(d, e, i) }; return false }
override fun mouseReleased(d: Double, e: Double, i: Int): Boolean { buttonsContext { this.mouseReleased(d, e, i) }; return false }