summaryrefslogtreecommitdiff
path: root/src/main/kotlin/gui/MessageUi.kt
blob: f4012da7e1fcf8414d59a066a26af22810b987f0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package moe.nea.ultranotifier.gui

import gg.essential.universal.UGraphics
import gg.essential.universal.UMatrixStack
import gg.essential.universal.UScreen
import java.awt.Color

class MessageUi : UScreen() {
	override fun onDrawScreen(matrixStack: UMatrixStack, mouseX: Int, mouseY: Int, partialTicks: Float) {
		super.onDrawScreen(matrixStack, mouseX, mouseY, partialTicks)
		fillRect(matrixStack,
		         0.0, 0.0, width.toDouble(), height.toDouble(), Color.RED)
	}

	fun fillRect(
		matrixStack: UMatrixStack,
		left: Double, top: Double, right: Double, bottom: Double,
		color: Color,
	) {
		val buffer = UGraphics.getFromTessellator()
		buffer.beginWithDefaultShader(UGraphics.DrawMode.QUADS, UGraphics.CommonVertexFormats.POSITION_COLOR)
		buffer.pos(matrixStack, left, top, 0.0).color(color).endVertex()
		buffer.pos(matrixStack, left, bottom, 0.0).color(color).endVertex()
		buffer.pos(matrixStack, right, bottom, 0.0).color(color).endVertex()
		buffer.pos(matrixStack, right, top, 0.0).color(color).endVertex()
		buffer.drawDirect()
	}

}