SnowyGUI/common/src/main/kotlin/fr/username404/snowygui/utils/FontUtil.kt
Username404-59 445053f69d
Update to 26.1
Signed-off-by: Username404-59 <w.iron.zombie@gmail.com>
2026-04-15 22:04:27 +02:00

21 lines
772 B
Kotlin

package fr.username404.snowygui.utils
import net.minecraft.client.Minecraft
import fr.username404.snowygui.gui.feature.Colors
import net.minecraft.client.gui.GuiGraphicsExtractor as 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.text(
Minecraft.getInstance().font, text,
(x / scaleFactor).toInt(), (y / scaleFactor).toInt(),
ARGB.opaque(color.hexValue), false
)
val factorToOriginal = 1F / scaleFactor
stack.scale(factorToOriginal, factorToOriginal)
}
}