Cacao: Fix button not flooring offsets

This commit is contained in:
Shadowfacts 2021-03-28 13:39:52 -04:00
parent c15700bf5d
commit b435948ee3
Signed by: shadowfacts
GPG Key ID: 94A5AB95422746E5
1 changed files with 2 additions and 1 deletions

View File

@ -8,6 +8,7 @@ import net.shadowfacts.cacao.util.RenderHelper
import net.shadowfacts.cacao.view.NinePatchView import net.shadowfacts.cacao.view.NinePatchView
import net.shadowfacts.cacao.view.View import net.shadowfacts.cacao.view.View
import net.shadowfacts.kiwidsl.dsl import net.shadowfacts.kiwidsl.dsl
import kotlin.math.floor
/** /**
* An abstract button class. Cannot be constructed directly, used for creating button implementations with their own * An abstract button class. Cannot be constructed directly, used for creating button implementations with their own
@ -82,7 +83,7 @@ abstract class AbstractButton<Impl: AbstractButton<Impl>>(val content: View, val
override fun draw(matrixStack: MatrixStack, mouse: Point, delta: Float) { override fun draw(matrixStack: MatrixStack, mouse: Point, delta: Float) {
RenderHelper.pushMatrix() RenderHelper.pushMatrix()
RenderHelper.translate(frame.left, frame.top) RenderHelper.translate(floor(frame.left), floor(frame.top))
RenderHelper.fill(matrixStack, bounds, backgroundColor) RenderHelper.fill(matrixStack, bounds, backgroundColor)