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:
@@ -18,8 +18,8 @@ import net.torvald.terrarum.TerrarumGDX.mouseScreenY
|
||||
*/
|
||||
class BasicDebugInfoWindow : UICanvas {
|
||||
|
||||
override var width: Int = Gdx.graphics.width
|
||||
override var height: Int = Gdx.graphics.height
|
||||
override var width: Int = TerrarumGDX.WIDTH
|
||||
override var height: Int = TerrarumGDX.HEIGHT
|
||||
|
||||
override var openCloseTime: Float = 0f
|
||||
|
||||
@@ -142,8 +142,8 @@ class BasicDebugInfoWindow : UICanvas {
|
||||
|
||||
|
||||
drawHistogram(batch, LightmapRenderer.histogram,
|
||||
Gdx.graphics.width - histogramW - 30,
|
||||
Gdx.graphics.height - histogramH - 30
|
||||
TerrarumGDX.WIDTH - histogramW - 30,
|
||||
TerrarumGDX.HEIGHT - histogramH - 30
|
||||
)
|
||||
|
||||
batch.color = Color.WHITE
|
||||
@@ -152,7 +152,7 @@ class BasicDebugInfoWindow : UICanvas {
|
||||
drawGamepadAxis(batch,
|
||||
TerrarumGDX.controller!!.getAxisValue(3),
|
||||
TerrarumGDX.controller!!.getAxisValue(2),
|
||||
Gdx.graphics.width - 135,
|
||||
TerrarumGDX.WIDTH - 135,
|
||||
40
|
||||
)
|
||||
}
|
||||
@@ -162,32 +162,32 @@ class BasicDebugInfoWindow : UICanvas {
|
||||
*/
|
||||
|
||||
//g.color = GameFontBase.codeToCol["y"]
|
||||
TerrarumGDX.fontSmallNumbers.draw(batch, "${ccY}MEM ", (Gdx.graphics.width - 21 * 8 - 2).toFloat(), 2f)
|
||||
//g.draw(batch, "${ccY}FPS $ccG${Terrarum.appgc.fps}", (Gdx.graphics.width - 6 * 8 - 2).toFloat(), 10f)
|
||||
TerrarumGDX.fontSmallNumbers.draw(batch, "${ccY}MEM ", (TerrarumGDX.WIDTH - 21 * 8 - 2).toFloat(), 2f)
|
||||
//g.draw(batch, "${ccY}FPS $ccG${Terrarum.appgc.fps}", (TerrarumGDX.WIDTH - 6 * 8 - 2).toFloat(), 10f)
|
||||
TerrarumGDX.fontSmallNumbers.draw(batch, "${ccY}CPUs ${if (TerrarumGDX.MULTITHREAD) ccG else ccR}${TerrarumGDX.THREADS}",
|
||||
(Gdx.graphics.width - 2 - 6*8).toFloat(), 10f)
|
||||
(TerrarumGDX.WIDTH - 2 - 6*8).toFloat(), 10f)
|
||||
|
||||
//g.color = GameFontBase.codeToCol["g"]
|
||||
TerrarumGDX.fontSmallNumbers.draw(batch, "${TerrarumGDX.memInUse}M",
|
||||
(Gdx.graphics.width - 17 * 8 - 2).toFloat(), 2f)
|
||||
(TerrarumGDX.WIDTH - 17 * 8 - 2).toFloat(), 2f)
|
||||
TerrarumGDX.fontSmallNumbers.draw(batch, "/${TerrarumGDX.memTotal}M/",
|
||||
(Gdx.graphics.width - 12 * 8 - 2).toFloat(), 2f)
|
||||
(TerrarumGDX.WIDTH - 12 * 8 - 2).toFloat(), 2f)
|
||||
//TerrarumGDX.fontSmallNumbers.color = GameFontBase.codeToCol["m"]
|
||||
TerrarumGDX.fontSmallNumbers.draw(batch, "${TerrarumGDX.memXmx}M",
|
||||
(Gdx.graphics.width - 5 * 8 - 2).toFloat(), 2f)
|
||||
(TerrarumGDX.WIDTH - 5 * 8 - 2).toFloat(), 2f)
|
||||
|
||||
/**
|
||||
* Bottom left
|
||||
*/
|
||||
|
||||
TerrarumGDX.fontSmallNumbers.draw(batch, "${ccY}Actors total $ccG${TerrarumGDX.ingame!!.actorContainer.size + TerrarumGDX.ingame!!.actorContainerInactive.size}",
|
||||
2f, Gdx.graphics.height - 10f)
|
||||
2f, TerrarumGDX.HEIGHT - 10f)
|
||||
TerrarumGDX.fontSmallNumbers.draw(batch, "${ccY}Active $ccG${TerrarumGDX.ingame!!.actorContainer.size}",
|
||||
(2 + 17*8).toFloat(), Gdx.graphics.height - 10f)
|
||||
(2 + 17*8).toFloat(), TerrarumGDX.HEIGHT - 10f)
|
||||
TerrarumGDX.fontSmallNumbers.draw(batch, "${ccY}Dormant $ccG${TerrarumGDX.ingame!!.actorContainerInactive.size}",
|
||||
(2 + 28*8).toFloat(), Gdx.graphics.height - 10f)
|
||||
(2 + 28*8).toFloat(), TerrarumGDX.HEIGHT - 10f)
|
||||
TerrarumGDX.fontSmallNumbers.draw(batch, "${ccM}Particles $ccG${TerrarumGDX.ingame!!.particlesActive}",
|
||||
(2 + 41*8).toFloat(), Gdx.graphics.height - 10f)
|
||||
(2 + 41*8).toFloat(), TerrarumGDX.HEIGHT - 10f)
|
||||
}
|
||||
|
||||
private fun printLine(batch: SpriteBatch, l: Int, s: String) {
|
||||
|
||||
@@ -32,7 +32,7 @@ class ConsoleWindow : UICanvas, KeyControlled {
|
||||
private val LINE_HEIGHT = 20
|
||||
private val MESSAGES_DISPLAY_COUNT = 11
|
||||
|
||||
override var width: Int = Gdx.graphics.width
|
||||
override var width: Int = TerrarumGDX.WIDTH
|
||||
override var height: Int = LINE_HEIGHT * (MESSAGES_DISPLAY_COUNT + 1)
|
||||
|
||||
override var openCloseTime = 0f
|
||||
|
||||
@@ -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())
|
||||
}
|
||||
|
||||
@@ -98,13 +98,13 @@ interface UICanvas {
|
||||
).roundInt()
|
||||
Position.RIGHT -> handler!!.posX = Movement.fastPullOut(
|
||||
handler.openCloseCounter / openCloseTime,
|
||||
Gdx.graphics.width.toFloat(),
|
||||
Gdx.graphics.width - handler.UI.width.toFloat()
|
||||
TerrarumGDX.WIDTH.toFloat(),
|
||||
TerrarumGDX.WIDTH - handler.UI.width.toFloat()
|
||||
).roundInt()
|
||||
Position.BOTTOM -> handler!!.posY = Movement.fastPullOut(
|
||||
handler.openCloseCounter / openCloseTime,
|
||||
Gdx.graphics.height.toFloat(),
|
||||
Gdx.graphics.height - handler.UI.height.toFloat()
|
||||
TerrarumGDX.HEIGHT.toFloat(),
|
||||
TerrarumGDX.HEIGHT - handler.UI.height.toFloat()
|
||||
).roundInt()
|
||||
}
|
||||
}
|
||||
@@ -122,13 +122,13 @@ interface UICanvas {
|
||||
).roundInt()
|
||||
Position.RIGHT -> handler!!.posX = Movement.fastPullOut(
|
||||
handler.openCloseCounter / openCloseTime,
|
||||
Gdx.graphics.width - handler.UI.width.toFloat(),
|
||||
Gdx.graphics.width.toFloat()
|
||||
TerrarumGDX.WIDTH - handler.UI.width.toFloat(),
|
||||
TerrarumGDX.WIDTH.toFloat()
|
||||
).roundInt()
|
||||
Position.BOTTOM -> handler!!.posY = Movement.fastPullOut(
|
||||
handler.openCloseCounter / openCloseTime,
|
||||
Gdx.graphics.height - handler.UI.height.toFloat(),
|
||||
Gdx.graphics.height.toFloat()
|
||||
TerrarumGDX.HEIGHT - handler.UI.height.toFloat(),
|
||||
TerrarumGDX.HEIGHT.toFloat()
|
||||
).roundInt()
|
||||
}
|
||||
}
|
||||
@@ -136,16 +136,16 @@ interface UICanvas {
|
||||
when (position) {
|
||||
Position.LEFT -> handler!!.posX = 0
|
||||
Position.TOP -> handler!!.posY = 0
|
||||
Position.RIGHT -> handler!!.posX = Gdx.graphics.width - handler.UI.width
|
||||
Position.BOTTOM -> handler!!.posY = Gdx.graphics.height - handler.UI.height
|
||||
Position.RIGHT -> handler!!.posX = TerrarumGDX.WIDTH - handler.UI.width
|
||||
Position.BOTTOM -> handler!!.posY = TerrarumGDX.HEIGHT - handler.UI.height
|
||||
}
|
||||
}
|
||||
fun endClosingPopOut(handler: UIHandler?, position: Position) {
|
||||
when (position) {
|
||||
Position.LEFT -> handler!!.posX = -handler.UI.width
|
||||
Position.TOP -> handler!!.posY = -handler.UI.height
|
||||
Position.RIGHT -> handler!!.posX = Gdx.graphics.width
|
||||
Position.BOTTOM -> handler!!.posY = Gdx.graphics.height
|
||||
Position.RIGHT -> handler!!.posX = TerrarumGDX.WIDTH
|
||||
Position.BOTTOM -> handler!!.posY = TerrarumGDX.HEIGHT
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user