mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-11 11:04:05 +09:00
font bug sorta fixed, new splash: warning health and safety
Former-commit-id: f79503873f57e781480fa742ed1a058becb6c7a1 Former-commit-id: daeeed816b339958786746c3717670c724676a44
This commit is contained in:
17
src/net/torvald/terrarum/ui/DrawUtil.kt
Normal file
17
src/net/torvald/terrarum/ui/DrawUtil.kt
Normal file
@@ -0,0 +1,17 @@
|
||||
package net.torvald.terrarum.ui
|
||||
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import org.newdawn.slick.Graphics
|
||||
import org.newdawn.slick.Image
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 16-08-04.
|
||||
*/
|
||||
object DrawUtil {
|
||||
fun drawCentered(g: Graphics, image: Image, screenPosY: Int, ui: UICanvas? = null) {
|
||||
val imageW = image.width
|
||||
val targetW = if (ui == null) Terrarum.WIDTH else ui.width
|
||||
|
||||
g.drawImage(image, targetW.minus(imageW).ushr(1).toFloat(), screenPosY.toFloat())
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,15 @@
|
||||
package net.torvald.terrarum.ui
|
||||
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import org.newdawn.slick.Graphics
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 16-07-06.
|
||||
*/
|
||||
object Typesetter {
|
||||
fun printCentered(string: String, screenPosY: Int, ui: UICanvas, g: Graphics) {
|
||||
object Typography {
|
||||
fun printCentered(g: Graphics, string: String, screenPosY: Int, ui: UICanvas? = null) {
|
||||
val stringW = g.font.getWidth(string)
|
||||
val targetW = ui.width
|
||||
val targetW = if (ui == null) Terrarum.WIDTH else ui.width
|
||||
|
||||
g.drawString(string, targetW.minus(stringW).ushr(1).toFloat(), screenPosY.toFloat())
|
||||
}
|
||||
Reference in New Issue
Block a user