mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-12 03:24:06 +09:00
downsampling sorta works, ONLY WHEN (width or height % 4) is 0 or 1
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
package net.torvald.terrarum.ui
|
||||
|
||||
import com.badlogic.gdx.Gdx
|
||||
import com.badlogic.gdx.graphics.Texture
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import net.torvald.terrarum.TerrarumGDX
|
||||
|
||||
|
||||
/**
|
||||
@@ -11,7 +11,7 @@ import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
object DrawUtil {
|
||||
fun drawCentered(batch: SpriteBatch, image: Texture, screenPosY: Int, ui: UICanvas? = null) {
|
||||
val imageW = image.width
|
||||
val targetW = if (ui == null) Gdx.graphics.width else ui.width
|
||||
val targetW = if (ui == null) TerrarumGDX.WIDTH else ui.width
|
||||
|
||||
batch.draw(image, targetW.minus(imageW).ushr(1).toFloat(), screenPosY.toFloat())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user