mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-11 02:54:04 +09:00
the f'ing computer now renders
This commit is contained in:
Binary file not shown.
@@ -99,13 +99,13 @@ internal class UIHomeComputer : UICanvas(
|
|||||||
|
|
||||||
init {
|
init {
|
||||||
batch = SpriteBatch()
|
batch = SpriteBatch()
|
||||||
camera = OrthographicCamera(560f, 448f)
|
camera = OrthographicCamera(width.toFloat(), height.toFloat())
|
||||||
//val m = Matrix4()
|
//val m = Matrix4()
|
||||||
//m.setToOrtho2D(0f, 0f, width.toFloat(), height.toFloat())
|
//m.setToOrtho2D(0f, 0f, width.toFloat(), height.toFloat())
|
||||||
batch.projectionMatrix = camera.combined
|
batch.projectionMatrix = camera.combined
|
||||||
}
|
}
|
||||||
|
|
||||||
private val fbo = FrameBuffer(Pixmap.Format.RGBA8888, 560, 448, true)
|
private val fbo = FrameBuffer(Pixmap.Format.RGBA8888, width, height, true)
|
||||||
|
|
||||||
override fun updateUI(delta: Float) {
|
override fun updateUI(delta: Float) {
|
||||||
}
|
}
|
||||||
@@ -113,29 +113,25 @@ internal class UIHomeComputer : UICanvas(
|
|||||||
override fun renderUI(otherBatch: SpriteBatch, otherCamera: Camera) {
|
override fun renderUI(otherBatch: SpriteBatch, otherCamera: Camera) {
|
||||||
otherBatch.end()
|
otherBatch.end()
|
||||||
|
|
||||||
fbo.inAction(otherCamera as OrthographicCamera, otherBatch) {
|
fbo.inAction(camera, batch) {
|
||||||
(vm.peripheralTable[1].peripheral as? GraphicsAdapter)?.let { gpu ->
|
(vm.peripheralTable[1].peripheral as? GraphicsAdapter)?.let { gpu ->
|
||||||
val clearCol = gpu.getBackgroundColour()
|
val clearCol = gpu.getBackgroundColour()
|
||||||
Gdx.gl.glClearColor(0f,0f,0f,0f)
|
Gdx.gl.glClearColor(clearCol.r, clearCol.g, clearCol.b, clearCol.a)
|
||||||
//Gdx.gl.glClearColor(clearCol.r, clearCol.g, clearCol.b, clearCol.a)
|
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT)
|
||||||
//Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT)
|
|
||||||
gpu.render(Gdx.graphics.deltaTime, otherBatch, 0f, 0f, true)
|
gpu.render(Gdx.graphics.deltaTime, batch, drawOffX, drawOffY, true, fbo) // gpu.render will internally end() the fbo then begin() again before using the batch I've fed in
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
otherBatch.begin()
|
otherBatch.begin()
|
||||||
|
otherBatch.shader = null
|
||||||
|
blendNormal(otherBatch)
|
||||||
otherBatch.color = Color.WHITE
|
otherBatch.color = Color.WHITE
|
||||||
otherBatch.draw(fbo.colorBufferTexture, posX.toFloat(), posY.toFloat(), width.toFloat(), height.toFloat())
|
otherBatch.draw(fbo.colorBufferTexture, posX.toFloat(), posY.toFloat(), width.toFloat(), height.toFloat())
|
||||||
otherBatch.color = Toolkit.Theme.COL_INACTIVE
|
otherBatch.color = Toolkit.Theme.COL_INACTIVE
|
||||||
Toolkit.drawBoxBorder(otherBatch, posX - 1, posY - 1, width + 2, height + 2)
|
Toolkit.drawBoxBorder(otherBatch, posX - 1, posY - 1, width + 2, height + 2)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setCameraPosition(newX: Float, newY: Float) {
|
|
||||||
// camera.position.set((-newX + width / 2), (-newY + height / 2), 0f) // deliberate integer division
|
|
||||||
// camera.update()
|
|
||||||
// batch.projectionMatrix = camera.combined
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun doOpening(delta: Float) {
|
override fun doOpening(delta: Float) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user