mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-12 19:44:05 +09:00
no more context fuckups on apploader
This commit is contained in:
@@ -2,7 +2,7 @@ package net.torvald.terrarum.ui
|
||||
|
||||
import com.badlogic.gdx.graphics.Camera
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.AppLoader
|
||||
import net.torvald.terrarum.floor
|
||||
import net.torvald.terrarum.ui.UIItemTextButton.Companion.Alignment
|
||||
|
||||
@@ -13,7 +13,7 @@ class UIItemTextArea(
|
||||
override val width: Int,
|
||||
override val height: Int,
|
||||
val lineGap: Int = 0,
|
||||
val lineCount: Int = ((height + lineGap) / Terrarum.fontGame.lineHeight).toInt(),
|
||||
val lineCount: Int = ((height + lineGap) / AppLoader.fontGame.lineHeight).toInt(),
|
||||
val align: Alignment = Alignment.LEFT
|
||||
) : UIItem(parentUI) {
|
||||
|
||||
@@ -40,12 +40,12 @@ class UIItemTextArea(
|
||||
for (i in scrollPos until minOf(lineCount + scrollPos, entireText.size)) {
|
||||
val yPtr = i - scrollPos
|
||||
|
||||
val textWidth = Terrarum.fontGame.getWidth(entireText[i])
|
||||
val textWidth = AppLoader.fontGame.getWidth(entireText[i])
|
||||
|
||||
when (align) {
|
||||
Alignment.LEFT -> Terrarum.fontGame.draw(batch, entireText[i], posX.toFloat(), posY + yPtr * (Terrarum.fontGame.lineHeight + lineGap))
|
||||
Alignment.CENTRE -> Terrarum.fontGame.draw(batch, entireText[i], posX + ((width - textWidth) / 2f).floor(), posY + yPtr * (Terrarum.fontGame.lineHeight + lineGap))
|
||||
Alignment.RIGHT -> Terrarum.fontGame.draw(batch, entireText[i], posX + width - textWidth.toFloat(), posY + yPtr * (Terrarum.fontGame.lineHeight + lineGap))
|
||||
Alignment.LEFT -> AppLoader.fontGame.draw(batch, entireText[i], posX.toFloat(), posY + yPtr * (AppLoader.fontGame.lineHeight + lineGap))
|
||||
Alignment.CENTRE -> AppLoader.fontGame.draw(batch, entireText[i], posX + ((width - textWidth) / 2f).floor(), posY + yPtr * (AppLoader.fontGame.lineHeight + lineGap))
|
||||
Alignment.RIGHT -> AppLoader.fontGame.draw(batch, entireText[i], posX + width - textWidth.toFloat(), posY + yPtr * (AppLoader.fontGame.lineHeight + lineGap))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user