mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-07 20:31:51 +09:00
bringing back onscreen debug info
This commit is contained in:
@@ -209,6 +209,8 @@ object Terrarum : Screen {
|
||||
val systemArch = System.getProperty("os.arch")
|
||||
val processor = GetCpuName.getModelName()
|
||||
val processorVendor = GetCpuName.getCPUID()
|
||||
lateinit var renderer: String
|
||||
lateinit var rendererVendor: String
|
||||
|
||||
val is32BitJVM = !System.getProperty("sun.arch.data.model").contains("64")
|
||||
|
||||
@@ -325,9 +327,15 @@ object Terrarum : Screen {
|
||||
testTexture = Texture(Gdx.files.internal("./assets/test_texture.tga"))
|
||||
|
||||
|
||||
val glInfo = Gdx.graphics.glVersion.debugVersionString
|
||||
|
||||
println("GL_VERSION = $GL_VERSION")
|
||||
println("GL_MAX_TEXTURE_SIZE = $GL_MAX_TEXTURE_SIZE")
|
||||
println("GL info:\n${Gdx.graphics.glVersion.debugVersionString}") // debug info
|
||||
println("GL info:\n$glInfo") // debug info
|
||||
|
||||
// set up renderer info variables
|
||||
renderer = Gdx.graphics.glVersion.rendererString
|
||||
rendererVendor = Gdx.graphics.glVersion.vendorString
|
||||
|
||||
|
||||
if (GL_VERSION < MINIMAL_GL_VERSION || GL_MAX_TEXTURE_SIZE < MINIMAL_GL_MAX_TEXTURE_SIZE) {
|
||||
|
||||
@@ -216,8 +216,6 @@ class TitleScreen(val batch: SpriteBatch) : Screen {
|
||||
}
|
||||
|
||||
fun updateScreen(delta: Float) {
|
||||
//Gdx.graphics.setTitle(Ingame.getCanonicalTitle())
|
||||
|
||||
demoWorld.globalLight = WeatherMixer.globalLightNow
|
||||
demoWorld.updateWorldTime(delta)
|
||||
WeatherMixer.update(delta, cameraPlayer, demoWorld)
|
||||
@@ -236,6 +234,8 @@ class TitleScreen(val batch: SpriteBatch) : Screen {
|
||||
}
|
||||
|
||||
fun renderScreen() {
|
||||
Gdx.graphics.setTitle(Ingame.getCanonicalTitle())
|
||||
|
||||
|
||||
//camera.setToOrtho(true, Terrarum.WIDTH.toFloat(), Terrarum.HEIGHT.toFloat())
|
||||
|
||||
|
||||
@@ -460,11 +460,6 @@ open class Ingame(batch: SpriteBatch) : IngameInstance(batch) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//Gdx.graphics.setTitle(getCanonicalTitle())
|
||||
|
||||
// ASYNCHRONOUS UPDATE AND RENDER //
|
||||
|
||||
|
||||
@@ -568,6 +563,8 @@ open class Ingame(batch: SpriteBatch) : IngameInstance(batch) {
|
||||
|
||||
|
||||
private fun renderGame() {
|
||||
Gdx.graphics.setTitle(getCanonicalTitle())
|
||||
|
||||
IngameRenderer.invoke(
|
||||
world as GameWorldExtension,
|
||||
actorsRenderBehind,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package net.torvald.terrarum.ui
|
||||
|
||||
import com.badlogic.gdx.Gdx
|
||||
import com.badlogic.gdx.graphics.Camera
|
||||
import com.badlogic.gdx.graphics.Color
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
@@ -174,20 +175,22 @@ class BasicDebugInfoWindow : UICanvas() {
|
||||
* Top right
|
||||
*/
|
||||
|
||||
//g.color = GameFontBase.codeToCol["y"]
|
||||
// memory pressure
|
||||
Terrarum.fontSmallNumbers.draw(batch, "${ccY}MEM ", (Terrarum.WIDTH - 21 * 8 - 2).toFloat(), 2f)
|
||||
//g.draw(batch, "${ccY}FPS $ccG${Terrarum.appgc.fps}", (Terrarum.WIDTH - 6 * 8 - 2).toFloat(), 10f)
|
||||
Terrarum.fontSmallNumbers.draw(batch, "${ccY}CPUs ${if (Terrarum.MULTITHREAD) ccG else ccR}${Terrarum.THREADS}",
|
||||
// thread count
|
||||
Terrarum.fontSmallNumbers.draw(batch, "${ccY}CPUs${if (Terrarum.MULTITHREAD) ccG else ccR}${Terrarum.THREADS.toString().padStart(2, ' ')}",
|
||||
(Terrarum.WIDTH - 2 - 6 * 8).toFloat(), 10f)
|
||||
|
||||
//g.color = GameFontBase.codeToCol["g"]
|
||||
// memory texts
|
||||
Terrarum.fontSmallNumbers.draw(batch, "${Terrarum.memJavaHeap}M",
|
||||
(Terrarum.WIDTH - 17 * 8 - 2).toFloat(), 2f)
|
||||
Terrarum.fontSmallNumbers.draw(batch, "/${Terrarum.memNativeHeap}M/",
|
||||
(Terrarum.WIDTH - 12 * 8 - 2).toFloat(), 2f)
|
||||
//Terrarum.fontSmallNumbers.color = GameFontBase.codeToCol["m"]
|
||||
Terrarum.fontSmallNumbers.draw(batch, "${Terrarum.memXmx}M",
|
||||
(Terrarum.WIDTH - 5 * 8 - 2).toFloat(), 2f)
|
||||
// FPS count
|
||||
Terrarum.fontSmallNumbers.draw(batch, "${ccY}FPS${ccG}${Gdx.graphics.framesPerSecond.toString().padStart(3, ' ')}",
|
||||
(Terrarum.WIDTH - 2 - 13 * 8).toFloat(), 10F)
|
||||
|
||||
/**
|
||||
* Bottom left
|
||||
@@ -201,8 +204,21 @@ class BasicDebugInfoWindow : UICanvas() {
|
||||
(2 + 28*8).toFloat(), Terrarum.HEIGHT - 10f)
|
||||
Terrarum.fontSmallNumbers.draw(batch, "${ccM}Particles $ccG${ingame.particlesActive}",
|
||||
(2 + 41*8).toFloat(), Terrarum.HEIGHT - 10f)
|
||||
|
||||
|
||||
/**
|
||||
* Bottom right
|
||||
*/
|
||||
|
||||
// processor and renderer
|
||||
Terrarum.fontSmallNumbers.draw(batch, "$ccY$totalHardwareName",
|
||||
(Terrarum.WIDTH - 2 - totalHardwareName.length * 8).toFloat(), Terrarum.HEIGHT - 10f)
|
||||
}
|
||||
|
||||
private val processorName = Terrarum.processor.replace(Regex(""" Processor|( CPU)? @ [0-9.]+GHz"""), "")
|
||||
private val rendererName = Terrarum.renderer
|
||||
private val totalHardwareName = "$processorName $rendererName"
|
||||
|
||||
private fun printLine(batch: SpriteBatch, l: Int, s: String) {
|
||||
Terrarum.fontSmallNumbers.draw(batch,
|
||||
s, 10f, line(l)
|
||||
|
||||
Reference in New Issue
Block a user