mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-12 11:34:05 +09:00
debug window: toggle visibility of timers using U key
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
package net.torvald.terrarum.ui
|
package net.torvald.terrarum.ui
|
||||||
|
|
||||||
import com.badlogic.gdx.Gdx
|
import com.badlogic.gdx.Gdx
|
||||||
|
import com.badlogic.gdx.Input
|
||||||
import com.badlogic.gdx.graphics.Camera
|
import com.badlogic.gdx.graphics.Camera
|
||||||
import com.badlogic.gdx.graphics.Color
|
import com.badlogic.gdx.graphics.Color
|
||||||
import com.badlogic.gdx.graphics.Texture
|
import com.badlogic.gdx.graphics.Texture
|
||||||
@@ -60,6 +61,9 @@ class BasicDebugInfoWindow : UICanvas() {
|
|||||||
private val MASS = 0xD5.toChar()
|
private val MASS = 0xD5.toChar()
|
||||||
private val HEIGHT = 0xC7.toChar()
|
private val HEIGHT = 0xC7.toChar()
|
||||||
|
|
||||||
|
private val KEY_TIMERS = Input.Keys.U
|
||||||
|
|
||||||
|
private var showTimers = false
|
||||||
|
|
||||||
override fun updateUI(delta: Float) {
|
override fun updateUI(delta: Float) {
|
||||||
val player = ingame?.actorNowPlaying
|
val player = ingame?.actorNowPlaying
|
||||||
@@ -121,7 +125,7 @@ class BasicDebugInfoWindow : UICanvas() {
|
|||||||
batch.color = Color(1f, 1f, 1f, 0.65f)
|
batch.color = Color(1f, 1f, 1f, 0.65f)
|
||||||
batch.draw(back, gap - 5f, gap - 5f)
|
batch.draw(back, gap - 5f, gap - 5f)
|
||||||
|
|
||||||
|
showTimers = showTimers xor Gdx.input.isKeyJustPressed(KEY_TIMERS)
|
||||||
|
|
||||||
batch.color = Color(0xFFEE88FF.toInt())
|
batch.color = Color(0xFFEE88FF.toInt())
|
||||||
|
|
||||||
@@ -226,10 +230,12 @@ class BasicDebugInfoWindow : UICanvas() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// print time
|
// print time
|
||||||
var dbgCnt = 10
|
if (showTimers) {
|
||||||
App.debugTimers.forEach { t, u ->
|
var dbgCnt = 10
|
||||||
// printLine(batch, dbgCnt, "$ccO$t $ccG${formatNanoTime(u as? Long)}$ccY ns")
|
App.debugTimers.forEach { t, u ->
|
||||||
dbgCnt++
|
printLine(batch, dbgCnt, "$ccO$t $ccG${formatNanoTime(u as? Long)}$ccY ns")
|
||||||
|
dbgCnt++
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user