Add (buggy) movement of components in the ClickGui class.
This commit is contained in:
parent
c06535047c
commit
7f916d82bb
|
@ -6,9 +6,23 @@ import fr.username404.snowygui.gui.SnowyScreen
|
|||
import net.minecraft.network.chat.TranslatableComponent
|
||||
|
||||
class ClickGui: SnowyScreen() {
|
||||
private companion object {
|
||||
var GuiDragging: Boolean = false
|
||||
}
|
||||
override val components: MutableSet<Element> = mutableSetOf(
|
||||
ClickBox(4.0, 4.0, TranslatableComponent("snowy.clickbox.misc")),
|
||||
ClickBox(90.0, 4.0, TranslatableComponent("snowy.clickbox.rendering"))
|
||||
// TODO Add components to the ClickGui
|
||||
)
|
||||
override fun mouseDragged(d: Double, e: Double, i: Int, f: Double, g: Double): Boolean {
|
||||
if (i == 0) {
|
||||
components.forEach {
|
||||
if (((d >= it.x) && (d <= (it.x + it.width))) and ((e >= it.y) && (e <= (it.y + it.height))) and !GuiDragging) {
|
||||
GuiDragging = true
|
||||
it.x = d + (d - (it.x + it.width))
|
||||
it.y = e + (e - (it.y + it.height))
|
||||
} else GuiDragging = false
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue