code cleanup

This commit is contained in:
minjaesong
2020-11-11 10:40:10 +09:00
parent 4db5bc1623
commit ab780fd246
36 changed files with 274 additions and 716 deletions

View File

@@ -3,8 +3,8 @@ package net.torvald.terrarum.ui
import com.badlogic.gdx.graphics.Camera
import com.badlogic.gdx.graphics.Texture
import com.badlogic.gdx.graphics.g2d.SpriteBatch
import net.torvald.terrarum.roundInt
import java.util.*
import kotlin.math.roundToInt
/**
* Image gallery. Images will be equally spaced, counted from top-left to bottom-right.
@@ -31,13 +31,13 @@ class UIItemImageGallery(
val gutter = (height - imageList[i].height.times(imageList.size)).toFloat().div(
imageList.size + 1f
)
return row((gutter * i.plus(1) + imageList[i].height * i).roundInt())
return row((gutter * i.plus(1) + imageList[i].height * i).roundToInt())
}
imageList.forEachIndexed { i, image ->
Toolkit.drawCentered(batch, image,
imagePosY(i),
width.toFloat().div(column).times(column(i).plus(1)).roundInt(),
width.toFloat().div(column).times(column(i).plus(1)).roundToInt(),
posX, posY
)
}