no more context fuckups on apploader

This commit is contained in:
minjaesong
2019-07-02 04:57:43 +09:00
parent eb4bdbacde
commit 4c23cde4a9
81 changed files with 635 additions and 563 deletions

View File

@@ -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))
}
}
}