PhysicalConnectivity/src/main/kotlin/net/shadowfacts/cacao/view/TextureView.kt

23 lines
600 B
Kotlin
Raw Normal View History

2021-02-19 04:12:43 +00:00
package net.shadowfacts.cacao.view
import net.minecraft.client.util.math.MatrixStack
import net.shadowfacts.cacao.geometry.Point
import net.shadowfacts.cacao.util.RenderHelper
import net.shadowfacts.cacao.util.texture.Texture
/**
* A helper class for drawing a [Texture] in a view.
* `TextureView` will draw the given texture filling the bounds of the view.
*
* @author shadowfacts
*/
2021-03-24 21:28:03 +00:00
class TextureView(var texture: Texture?): View() {
2021-02-19 04:12:43 +00:00
override fun drawContent(matrixStack: MatrixStack, mouse: Point, delta: Float) {
2021-03-24 21:28:03 +00:00
texture?.also {
RenderHelper.draw(matrixStack, bounds, it)
}
2021-02-19 04:12:43 +00:00
}
2021-02-27 18:24:17 +00:00
}