mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-10 02:24:05 +09:00
debug info for upcoming wires
This commit is contained in:
@@ -13,6 +13,7 @@ import com.badlogic.gdx.graphics.glutils.ShapeRenderer
|
|||||||
import com.badlogic.gdx.math.Matrix4
|
import com.badlogic.gdx.math.Matrix4
|
||||||
import net.torvald.terrarum.gamecontroller.KeyToggler
|
import net.torvald.terrarum.gamecontroller.KeyToggler
|
||||||
import net.torvald.terrarum.ui.BasicDebugInfoWindow
|
import net.torvald.terrarum.ui.BasicDebugInfoWindow
|
||||||
|
import net.torvald.terrarum.worlddrawer.BlocksDrawer
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Must be called by the App Loader
|
* Must be called by the App Loader
|
||||||
@@ -37,6 +38,8 @@ object PostProcessor {
|
|||||||
|
|
||||||
private val debugUI = BasicDebugInfoWindow()
|
private val debugUI = BasicDebugInfoWindow()
|
||||||
|
|
||||||
|
private var functionRowHelper = Texture(Gdx.files.internal("assets/graphics/function_row_help.png"))
|
||||||
|
|
||||||
fun dispose() {
|
fun dispose() {
|
||||||
batch.dispose()
|
batch.dispose()
|
||||||
shapeRenderer.dispose()
|
shapeRenderer.dispose()
|
||||||
@@ -78,6 +81,25 @@ object PostProcessor {
|
|||||||
drawSafeArea()
|
drawSafeArea()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (KeyToggler.isOn(Input.Keys.F1)) {
|
||||||
|
batch.color = Color.WHITE
|
||||||
|
batch.inUse {
|
||||||
|
it.draw(functionRowHelper,
|
||||||
|
(AppLoader.screenW - functionRowHelper.width) / 2f,
|
||||||
|
functionRowHelper.height.toFloat(),
|
||||||
|
functionRowHelper.width.toFloat(),
|
||||||
|
functionRowHelper.height * -1f
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (KeyToggler.isOn(Input.Keys.F10)) {
|
||||||
|
batch.color = Color.WHITE
|
||||||
|
batch.inUse {
|
||||||
|
AppLoader.fontSmallNumbers.draw(it, "Wire draw bits: ${BlocksDrawer.drawWires.toString(2)}", 2f, 2f)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (KeyToggler.isOn(Input.Keys.F3)) {
|
if (KeyToggler.isOn(Input.Keys.F3)) {
|
||||||
if (!debugUI.isOpened && !debugUI.isOpening) debugUI.setAsOpen()
|
if (!debugUI.isOpened && !debugUI.isOpening) debugUI.setAsOpen()
|
||||||
batch.inUse { debugUI.renderUI(batch, camera) }
|
batch.inUse { debugUI.renderUI(batch, camera) }
|
||||||
|
|||||||
@@ -39,6 +39,5 @@ class WirePieceSignalWire(override val originalID: ItemID) : GameItem() {
|
|||||||
|
|
||||||
override fun effectWhenEquipped(delta: Float) {
|
override fun effectWhenEquipped(delta: Float) {
|
||||||
IngameRenderer.selectedWireBitToDraw = Wire.BIT_SIGNAL_RED
|
IngameRenderer.selectedWireBitToDraw = Wire.BIT_SIGNAL_RED
|
||||||
//println("wires!")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -215,6 +215,9 @@ internal object BlocksDrawer {
|
|||||||
renderUsingBuffer(FLUID, projectionMatrix)
|
renderUsingBuffer(FLUID, projectionMatrix)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var drawWires = 0
|
||||||
|
private set
|
||||||
|
|
||||||
internal fun drawFront(projectionMatrix: Matrix4, drawWires: Int) {
|
internal fun drawFront(projectionMatrix: Matrix4, drawWires: Int) {
|
||||||
// blend mul
|
// blend mul
|
||||||
Gdx.gl.glEnable(GL20.GL_TEXTURE_2D)
|
Gdx.gl.glEnable(GL20.GL_TEXTURE_2D)
|
||||||
@@ -228,8 +231,9 @@ internal object BlocksDrawer {
|
|||||||
|
|
||||||
gdxSetBlendNormal()
|
gdxSetBlendNormal()
|
||||||
|
|
||||||
|
this.drawWires = drawWires
|
||||||
if (drawWires != 0) {
|
if (drawWires != 0) {
|
||||||
//println("drawing wires")
|
//println("Wires! draw: $drawWires") // use F10 instead
|
||||||
renderUsingBuffer(WIRE, projectionMatrix)
|
renderUsingBuffer(WIRE, projectionMatrix)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user