mirror of
https://gitlab.com/cable-mc/cobblemon.git
synced 2026-11-29 11:38:52 -05:00
Fix NavigationButton hover
This commit is contained in:
1 parent
2d9523b9a1
commit
d478eecf47
1 file changed
+2
-5
@@ -32,7 +32,6 @@ class NavigationButton(
|
||||
}
|
||||
|
||||
override fun renderWidget(context: GuiGraphics, pMouseX: Int, pMouseY: Int, pPartialTicks: Float) {
|
||||
val hovered = (isHovered(pMouseX.toDouble(), pMouseY.toDouble()))
|
||||
blitk(
|
||||
matrixStack = context.pose(),
|
||||
x = x / SCALE,
|
||||
@@ -40,7 +39,7 @@ class NavigationButton(
|
||||
texture = if (forward) forwardButtonResource else backwardsButtonResource,
|
||||
width = WIDTH,
|
||||
height = HEIGHT,
|
||||
vOffset = if (hovered) HEIGHT else 0,
|
||||
vOffset = if (isHovered()) HEIGHT else 0,
|
||||
textureHeight = HEIGHT * 2,
|
||||
scale = SCALE
|
||||
)
|
||||
@@ -49,6 +48,4 @@ class NavigationButton(
|
||||
override fun playDownSound(soundManager: SoundManager) {
|
||||
soundManager.play(SimpleSoundInstance.forUI(CobblemonSounds.PC_CLICK, 1.0F))
|
||||
}
|
||||
|
||||
fun isHovered(mouseX: Double, mouseY: Double) = mouseX.toFloat() in (x.toFloat()..(x.toFloat() + (WIDTH * SCALE))) && mouseY.toFloat() in (y.toFloat()..(y.toFloat() + (HEIGHT * SCALE)))
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user