mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-14 20:44:05 +09:00
code cleanup
This commit is contained in:
@@ -217,7 +217,7 @@ class BasicDebugInfoWindow : UICanvas() {
|
||||
// memory pressure
|
||||
AppLoader.fontSmallNumbers.draw(batch, "${ccY}MEM ", (AppLoader.screenW - 23 * TinyAlphNum.W - 2).toFloat(), line(1))
|
||||
// thread count
|
||||
AppLoader.fontSmallNumbers.draw(batch, "${ccY}CPUs${if (AppLoader.MULTITHREAD) ccG else ccR}${AppLoader.THREADS.toString().padStart(2, ' ')}",
|
||||
AppLoader.fontSmallNumbers.draw(batch, "${ccY}CPUs${if (AppLoader.MULTITHREAD) ccG else ccR}${AppLoader.THREAD_COUNT.toString().padStart(2, ' ')}",
|
||||
(AppLoader.screenW - 2 - 8 * TinyAlphNum.W).toFloat(), line(2))
|
||||
|
||||
// memory texts
|
||||
|
||||
@@ -7,7 +7,7 @@ import com.badlogic.gdx.utils.Disposable
|
||||
import net.torvald.terrarum.AppLoader
|
||||
import net.torvald.terrarum.Second
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.roundInt
|
||||
import kotlin.math.roundToInt
|
||||
|
||||
|
||||
/**
|
||||
@@ -309,22 +309,22 @@ abstract class UICanvas(
|
||||
ui.handler.openCloseCounter / openCloseTime,
|
||||
-ui.width.toFloat(),
|
||||
0f
|
||||
).roundInt()
|
||||
).roundToInt()
|
||||
Position.TOP -> ui.handler.posY = Movement.fastPullOut(
|
||||
ui.handler.openCloseCounter / openCloseTime,
|
||||
-ui.height.toFloat(),
|
||||
0f
|
||||
).roundInt()
|
||||
).roundToInt()
|
||||
Position.RIGHT -> ui.handler.posX = Movement.fastPullOut(
|
||||
ui.handler.openCloseCounter / openCloseTime,
|
||||
AppLoader.screenWf,
|
||||
AppLoader.screenW - ui.width.toFloat()
|
||||
).roundInt()
|
||||
).roundToInt()
|
||||
Position.BOTTOM -> ui.handler.posY = Movement.fastPullOut(
|
||||
ui.handler.openCloseCounter / openCloseTime,
|
||||
AppLoader.screenHf,
|
||||
AppLoader.screenH - ui.height.toFloat()
|
||||
).roundInt()
|
||||
).roundToInt()
|
||||
}
|
||||
}
|
||||
fun doClosingPopOut(ui: UICanvas, openCloseTime: Second, position: Position) {
|
||||
@@ -333,22 +333,22 @@ abstract class UICanvas(
|
||||
ui.handler.openCloseCounter / openCloseTime,
|
||||
0f,
|
||||
-ui.width.toFloat()
|
||||
).roundInt()
|
||||
).roundToInt()
|
||||
Position.TOP -> ui.handler.posY = Movement.fastPullOut(
|
||||
ui.handler.openCloseCounter / openCloseTime,
|
||||
0f,
|
||||
-ui.height.toFloat()
|
||||
).roundInt()
|
||||
).roundToInt()
|
||||
Position.RIGHT -> ui.handler.posX = Movement.fastPullOut(
|
||||
ui.handler.openCloseCounter / openCloseTime,
|
||||
AppLoader.screenW - ui.width.toFloat(),
|
||||
AppLoader.screenWf
|
||||
).roundInt()
|
||||
).roundToInt()
|
||||
Position.BOTTOM -> ui.handler.posY = Movement.fastPullOut(
|
||||
ui.handler.openCloseCounter / openCloseTime,
|
||||
AppLoader.screenH - ui.height.toFloat(),
|
||||
AppLoader.screenHf
|
||||
).roundInt()
|
||||
).roundToInt()
|
||||
}
|
||||
}
|
||||
fun endOpeningPopOut(ui: UICanvas, position: Position) {
|
||||
|
||||
@@ -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
|
||||
)
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.badlogic.gdx.graphics.Color
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import net.torvald.terrarum.*
|
||||
import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack
|
||||
import kotlin.math.roundToInt
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 2017-03-13.
|
||||
@@ -74,7 +75,7 @@ class UIItemTextButtonList(
|
||||
val h = height.toFloat()
|
||||
val ss = labelsList.size.toFloat()
|
||||
val lh = itemHitboxSize
|
||||
val vertOff = (h/ss * i + (h/ss - lh) / 2f).roundInt()
|
||||
val vertOff = (h/ss * i + (h/ss - lh) / 2f).roundToInt()
|
||||
|
||||
if (!kinematic) {
|
||||
UIItemTextButton(
|
||||
|
||||
Reference in New Issue
Block a user