21 lines
754 B
Kotlin
21 lines
754 B
Kotlin
package fr.username404.snowygui.utils
|
|
|
|
import net.minecraft.client.Minecraft
|
|
import fr.username404.snowygui.gui.feature.Colors
|
|
import net.minecraft.client.gui.GuiGraphics
|
|
import net.minecraft.util.ARGB
|
|
|
|
object FontUtil {
|
|
fun drawScaled(guiGraphics: GuiGraphics, text: String, x: Double, y: Double, scaleFactor: Float, color: Colors = Colors.BLACK) {
|
|
val stack = guiGraphics.pose()
|
|
stack.scale(scaleFactor, scaleFactor)
|
|
guiGraphics.drawString(
|
|
Minecraft.getInstance().font, text,
|
|
(x / scaleFactor).toInt(), (y / scaleFactor).toInt(),
|
|
ARGB.opaque(color.hexValue), false
|
|
)
|
|
val factorToOriginal = 1F / scaleFactor
|
|
stack.scale(factorToOriginal, factorToOriginal)
|
|
}
|
|
}
|