new param 'frameDelta' on every render() function

This commit is contained in:
minjaesong
2024-01-04 16:38:58 +09:00
parent f2ecb109e6
commit f54a2133f9
116 changed files with 374 additions and 348 deletions

View File

@@ -119,7 +119,7 @@ class WearableWorldRadarUI(val device: VM) : UICanvas() {
device.update(delta) device.update(delta)
} }
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) { override fun renderUI(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera) {
batch.end() batch.end()
batch.color = Color.WHITE batch.color = Color.WHITE

View File

@@ -50,7 +50,7 @@ internal class UIHomeComputer : UICanvas(
override fun updateUI(delta: Float) { override fun updateUI(delta: Float) {
} }
override fun renderUI(otherBatch: SpriteBatch, otherCamera: OrthographicCamera) { override fun renderUI(frameDelta: Float, otherBatch: SpriteBatch, otherCamera: OrthographicCamera) {
otherBatch.end() otherBatch.end()
fbo.inAction(camera, batch) { fbo.inAction(camera, batch) {

View File

@@ -36,8 +36,8 @@ class BTeXDocument {
pages.last().appendDrawCall(drawCall) pages.last().appendDrawCall(drawCall)
} }
fun render(batch: SpriteBatch, page: Int, x: Int, y: Int) { fun render(frameDelta: Float, batch: SpriteBatch, page: Int, x: Int, y: Int) {
pages[page].render(batch, x, y) pages[page].render(frameDelta, batch, x, y)
} }
} }
@@ -52,7 +52,7 @@ class BTeXPage(
drawCalls.add(drawCall) drawCalls.add(drawCall)
} }
fun render(batch: SpriteBatch, x: Int, y: Int) { fun render(frameDelta: Float, batch: SpriteBatch, x: Int, y: Int) {
batch.color = back batch.color = back
Toolkit.fillArea(batch, x, y, width, height) Toolkit.fillArea(batch, x, y, width, height)
drawCalls.forEach { drawCalls.forEach {

View File

@@ -165,7 +165,7 @@ class AssembledSpriteAnimation(
} ?: throw NullPointerException("Animation with name '$animNameRoot' is not found") } ?: throw NullPointerException("Animation with name '$animNameRoot' is not found")
} }
override fun render(batch: SpriteBatch, posX: Float, posY: Float, scale: Float) { override fun render(frameDelta: Float, batch: SpriteBatch, posX: Float, posY: Float, scale: Float) {
if (parentActor.isVisible) { if (parentActor.isVisible) {
batch.color = colourFilter batch.color = colourFilter
renderThisAnimation(batch, posX, posY, scale, "${currentAnimation}_${1+currentFrame}") renderThisAnimation(batch, posX, posY, scale, "${currentAnimation}_${1+currentFrame}")

View File

@@ -16,7 +16,7 @@ import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack
abstract class SpriteAnimation(@Transient val parentActor: ActorWithBody) : Disposable { abstract class SpriteAnimation(@Transient val parentActor: ActorWithBody) : Disposable {
protected abstract val currentDelay: Second protected abstract val currentDelay: Second
abstract fun update(delta: Float) abstract fun update(delta: Float)
abstract fun render(batch: SpriteBatch, posX: Float, posY: Float, scale: Float = 1f) abstract fun render(frameDelta: Float, batch: SpriteBatch, posX: Float, posY: Float, scale: Float = 1f)
var flipHorizontal = false var flipHorizontal = false
var flipVertical = false var flipVertical = false
@@ -143,7 +143,7 @@ class SheetSpriteAnimation(parentActor: ActorWithBody) : SpriteAnimation(parentA
* * * *
* @param scale * @param scale
*/ */
override fun render(batch: SpriteBatch, posX: Float, posY: Float, scale: Float) { override fun render(frameDelta: Float, batch: SpriteBatch, posX: Float, posY: Float, scale: Float) {
assert(cellWidth > 0 || cellHeight > 0) { assert(cellWidth > 0 || cellHeight > 0) {
"Sprite width or height is set to zero! ($cellWidth, $cellHeight); master: $parentActor" "Sprite width or height is set to zero! ($cellWidth, $cellHeight); master: $parentActor"
} }

View File

@@ -646,7 +646,7 @@ public class App implements ApplicationListener {
firePostInit(); firePostInit();
currentScreen.render(UPDATE_RATE); currentScreen.render(UPDATE_RATE);
postProcessorOutFBO = TerrarumPostProcessor.INSTANCE.draw(camera.combined, renderFBO); postProcessorOutFBO = TerrarumPostProcessor.INSTANCE.draw(Gdx.graphics.getDeltaTime(), camera.combined, renderFBO);
} }

View File

@@ -37,14 +37,14 @@ object ConsistentUpdateRate : GameUpdateGovernor {
var i = 0L var i = 0L
while (akku >= tickInterval) { while (akku >= tickInterval) {
App.measureDebugTime("Ingame.Update") { updateFunction(tickInterval) } App.measureDebugTime("Ingame.Update") { updateFunction(tickInterval) } // update-delta
akku -= tickInterval akku -= tickInterval
i += 1 i += 1
} }
App.setDebugTime("Ingame.UpdateCounter", i) App.setDebugTime("Ingame.UpdateCounter", i)
/** RENDER CODE GOES HERE */ /** RENDER CODE GOES HERE */
App.measureDebugTime("Ingame.Render") { renderFunction(tickInterval) } App.measureDebugTime("Ingame.Render") { renderFunction(deltaTime) } // frame-delta, should be identical to Gdx.graphics.deltaTime
} }
override fun reset() { override fun reset() {

View File

@@ -92,10 +92,10 @@ class ModOptionsHost(val remoCon: UIRemoCon) : UICanvas() {
deferred(); deferred = {} deferred(); deferred = {}
} }
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) { override fun renderUI(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera) {
// the actual control panel // the actual control panel
ControlPanelCommon.render("basegame.modcontrolpanel.$currentlySelectedModule", width, batch) ControlPanelCommon.render("basegame.modcontrolpanel.$currentlySelectedModule", width, batch)
uiItems.forEach { it.render(batch, camera) } uiItems.forEach { it.render(frameDelta, batch, camera) }
} }
override fun dispose() { override fun dispose() {

View File

@@ -86,7 +86,7 @@ object TerrarumPostProcessor : Disposable {
private var deltatBenchStr = "ΔF: Gathering data" private var deltatBenchStr = "ΔF: Gathering data"
fun draw(projMat: Matrix4, fbo: FrameBuffer): FrameBuffer { fun draw(frameDelta: Float, projMat: Matrix4, fbo: FrameBuffer): FrameBuffer {
// init // init
if (!init) { if (!init) {
@@ -157,7 +157,7 @@ object TerrarumPostProcessor : Disposable {
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(frameDelta, batch, camera) }
} }
else { else {
if (!debugUI.isClosed && !debugUI.isClosing) debugUI.setAsClose() if (!debugUI.isClosed && !debugUI.isClosing) debugUI.setAsClose()

View File

@@ -39,7 +39,7 @@ class UIFakeGradOverlay : UICanvas() {
} }
override fun updateUI(delta: Float) {} override fun updateUI(delta: Float) {}
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) { override fun renderUI(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera) {
batch.end() batch.end()
val dither = App.getConfigBoolean("fx_dither") val dither = App.getConfigBoolean("fx_dither")
@@ -91,7 +91,7 @@ class UIFakeBlurOverlay(val blurRadius: Float, val nodarken: Boolean) : UICanvas
private val batchDrawCol = Color(-1) private val batchDrawCol = Color(-1)
override fun updateUI(delta: Float) {} override fun updateUI(delta: Float) {}
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) { override fun renderUI(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera) {
batchDrawCol.a = openness batchDrawCol.a = openness
batch.color = batchDrawCol batch.color = batchDrawCol
if (App.getConfigBoolean("fx_backgroundblur")) { if (App.getConfigBoolean("fx_backgroundblur")) {

View File

@@ -275,13 +275,13 @@ class UIItemInventoryCatBar(
} }
} }
override fun render(batch: SpriteBatch, camera: OrthographicCamera) { override fun render(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera) {
super.render(batch, camera) super.render(frameDelta, batch, camera)
// button // button
// colour determined by UI items themselves // colour determined by UI items themselves
mainButtons.forEach { it.render(batch, camera) } mainButtons.forEach { it.render(frameDelta, batch, camera) }
if (showSideButtons) sideButtons.forEach { it.render(batch, camera) } if (showSideButtons) sideButtons.forEach { it.render(frameDelta, batch, camera) }
blendNormalStraightAlpha(batch) blendNormalStraightAlpha(batch)

View File

@@ -54,7 +54,7 @@ class UIItemInventoryElemSimple(
private var highlightToMainCol = false private var highlightToMainCol = false
private var highlightToSubCol = false private var highlightToSubCol = false
override fun render(batch: SpriteBatch, camera: OrthographicCamera) { override fun render(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera) {
blendNormalStraightAlpha(batch) blendNormalStraightAlpha(batch)
highlightToMainCol = customHighlightRuleMain?.invoke(this) ?: (equippedSlot != null && highlightEquippedItem) || forceHighlighted highlightToMainCol = customHighlightRuleMain?.invoke(this) ?: (equippedSlot != null && highlightEquippedItem) || forceHighlighted

View File

@@ -79,7 +79,7 @@ class UIItemInventoryElemWide(
var textHighlightMouseUpCol = Toolkit.Theme.COL_MOUSE_UP var textHighlightMouseUpCol = Toolkit.Theme.COL_MOUSE_UP
var textHighlightNormalCol = Color.WHITE var textHighlightNormalCol = Color.WHITE
override fun render(batch: SpriteBatch, camera: OrthographicCamera) { override fun render(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera) {
blendNormalStraightAlpha(batch) blendNormalStraightAlpha(batch)
highlightToMainCol = customHighlightRuleMain?.invoke(this) ?: (equippedSlot != null && highlightEquippedItem) || forceHighlighted highlightToMainCol = customHighlightRuleMain?.invoke(this) ?: (equippedSlot != null && highlightEquippedItem) || forceHighlighted

View File

@@ -1782,17 +1782,17 @@ open class ActorWithBody : Actor {
) )
} }
open fun drawGlow(batch: SpriteBatch) { open fun drawGlow(frameDelta: Float, batch: SpriteBatch) {
if (isVisible && spriteGlow != null) { if (isVisible && spriteGlow != null) {
blendNormalStraightAlpha(batch) blendNormalStraightAlpha(batch)
drawSpriteInGoodPosition(spriteGlow!!, batch) drawSpriteInGoodPosition(frameDelta, spriteGlow!!, batch)
} }
} }
open fun drawBody(batch: SpriteBatch) { open fun drawBody(frameDelta: Float, batch: SpriteBatch) {
if (isVisible && sprite != null) { if (isVisible && sprite != null) {
BlendMode.resolve(drawMode, batch) BlendMode.resolve(drawMode, batch)
drawSpriteInGoodPosition(sprite!!, batch) drawSpriteInGoodPosition(frameDelta, sprite!!, batch)
} }
// debug display of hIntTilewiseHitbox // debug display of hIntTilewiseHitbox
@@ -1813,7 +1813,7 @@ open class ActorWithBody : Actor {
} }
} }
protected fun drawSpriteInGoodPosition(sprite: SpriteAnimation, batch: SpriteBatch) { protected fun drawSpriteInGoodPosition(frameDelta: Float, sprite: SpriteAnimation, batch: SpriteBatch) {
if (world == null) return if (world == null) return
val offsetX = 0f val offsetX = 0f
@@ -1823,7 +1823,7 @@ open class ActorWithBody : Actor {
val posY = hitbox.startY.plus(PHYS_EPSILON_DIST).toFloat() val posY = hitbox.startY.plus(PHYS_EPSILON_DIST).toFloat()
drawBodyInGoodPosition(posX, posY) { x, y -> drawBodyInGoodPosition(posX, posY) { x, y ->
sprite.render(batch, x + offsetX, y + offsetY, scale.toFloat()) sprite.render(frameDelta, batch, x + offsetX, y + offsetY, scale.toFloat())
} }
} }

View File

@@ -50,7 +50,7 @@ class BlockMarkerActor : ActorWithBody(Actor.RenderOrder.OVERLAY, physProp = Phy
} }
override fun drawBody(batch: SpriteBatch) { override fun drawBody(frameDelta: Float, batch: SpriteBatch) {
if (isVisible) { if (isVisible) {
if (markerMode == MarkerMode.FIXTURE_GHOST) { if (markerMode == MarkerMode.FIXTURE_GHOST) {
if (INGAME.actorNowPlaying != null) { if (INGAME.actorNowPlaying != null) {
@@ -60,7 +60,7 @@ class BlockMarkerActor : ActorWithBody(Actor.RenderOrder.OVERLAY, physProp = Phy
if (ghost != null) { if (ghost != null) {
// batch.color = ghostColour // batch.color = ghostColour
batch.shader.setUniformf("ghostColour", ghostColour.r, ghostColour.g, ghostColour.b, ghostColour.a) batch.shader.setUniformf("ghostColour", ghostColour.r, ghostColour.g, ghostColour.b, ghostColour.a)
drawSpriteInGoodPosition(ghost!!, batch) drawSpriteInGoodPosition(frameDelta, ghost!!, batch)
} }
// 0L // 0L
// } // }
@@ -70,7 +70,7 @@ class BlockMarkerActor : ActorWithBody(Actor.RenderOrder.OVERLAY, physProp = Phy
if (ghost != null) { if (ghost != null) {
// batch.color = ghostColour // batch.color = ghostColour
batch.shader.setUniformf("ghostColour", ghostColour.r, ghostColour.g, ghostColour.b, ghostColour.a) batch.shader.setUniformf("ghostColour", ghostColour.r, ghostColour.g, ghostColour.b, ghostColour.a)
drawSpriteInGoodPosition(ghost!!, batch) drawSpriteInGoodPosition(frameDelta, ghost!!, batch)
} }
} }
} }
@@ -86,7 +86,7 @@ class BlockMarkerActor : ActorWithBody(Actor.RenderOrder.OVERLAY, physProp = Phy
batch.color = Color.WHITE batch.color = Color.WHITE
} }
override fun drawGlow(batch: SpriteBatch) { override fun drawGlow(frameDelta: Float, batch: SpriteBatch) {
batch.color = Color.WHITE batch.color = Color.WHITE
} }

View File

@@ -72,7 +72,7 @@ class WireActor : ActorWithBody, NoSerialise {
override fun update(delta: Float) { override fun update(delta: Float) {
} }
override fun drawBody(batch: SpriteBatch) { override fun drawBody(frameDelta: Float, batch: SpriteBatch) {
if (isVisible && sprite != null) { if (isVisible && sprite != null) {
if (WireCodex[wireID].accepts == "digital_3bits") { if (WireCodex[wireID].accepts == "digital_3bits") {
// "digital_3bits" must come right after three wires it bundles // "digital_3bits" must come right after three wires it bundles
@@ -89,7 +89,7 @@ class WireActor : ActorWithBody, NoSerialise {
} }
BlendMode.resolve(drawMode, batch) BlendMode.resolve(drawMode, batch)
drawSpriteInGoodPosition(sprite!!, batch) drawSpriteInGoodPosition(frameDelta, sprite!!, batch)
} }
} }
} }

View File

@@ -74,7 +74,7 @@ open class ParticleBase(renderOrder: Actor.RenderOrder, var despawnUponCollision
} }
} }
open fun drawBody(batch: SpriteBatch) { open fun drawBody(frameDelta: Float, batch: SpriteBatch) {
if (!flagDespawn) { if (!flagDespawn) {
batch.color = drawColour batch.color = drawColour
drawBodyInGoodPosition(hitbox.startX.toFloat(), hitbox.startY.toFloat()) { x, y -> drawBodyInGoodPosition(hitbox.startX.toFloat(), hitbox.startY.toFloat()) { x, y ->
@@ -83,7 +83,7 @@ open class ParticleBase(renderOrder: Actor.RenderOrder, var despawnUponCollision
} }
} }
open fun drawGlow(batch: SpriteBatch) { open fun drawGlow(frameDelta: Float, batch: SpriteBatch) {
if (!flagDespawn && glow != null) { if (!flagDespawn && glow != null) {
batch.color = drawColour batch.color = drawColour
drawBodyInGoodPosition(hitbox.startX.toFloat(), hitbox.startY.toFloat()) { x, y -> drawBodyInGoodPosition(hitbox.startX.toFloat(), hitbox.startY.toFloat()) { x, y ->

View File

@@ -87,7 +87,7 @@ class ParticleVanishingText(val text: String, x: Double, y: Double, noCollision:
drawColour.a = (lifetimeMax - lifetimeCounter) / lifetimeMax drawColour.a = (lifetimeMax - lifetimeCounter) / lifetimeMax
} }
override fun drawBody(batch: SpriteBatch) { override fun drawBody(frameDelta: Float, batch: SpriteBatch) {
if (!flagDespawn) { if (!flagDespawn) {
val oldColour = batch.color.cpy() val oldColour = batch.color.cpy()
batch.color = drawColour batch.color = drawColour
@@ -135,7 +135,7 @@ open class ParticleVanishingSprite(val sprite: TextureRegionPack, val delay: Flo
frameAdvanceCounter += delta frameAdvanceCounter += delta
} }
override fun drawBody(batch: SpriteBatch) { override fun drawBody(frameDelta: Float, batch: SpriteBatch) {
if (!flagDespawn) { if (!flagDespawn) {
val oldColour = batch.color.cpy() val oldColour = batch.color.cpy()
batch.color = drawColour batch.color = drawColour

View File

@@ -118,12 +118,12 @@ class BuildingMaker(batch: FlippingSpriteBatch) : IngameInstance(batch) {
this.actorValue[AVKey.LUMG] = 1.0 this.actorValue[AVKey.LUMG] = 1.0
} }
override fun drawBody(batch: SpriteBatch) { override fun drawBody(frameDelta: Float, batch: SpriteBatch) {
batch.color = toolCursorColour[currentPenMode] batch.color = toolCursorColour[currentPenMode]
batch.draw(blockMarkings.get(currentPenMode, 0), hitbox.startX.toFloat(), hitbox.startY.toFloat()) batch.draw(blockMarkings.get(currentPenMode, 0), hitbox.startX.toFloat(), hitbox.startY.toFloat())
} }
override fun drawGlow(batch: SpriteBatch) { } override fun drawGlow(frameDelta: Float, batch: SpriteBatch) { }
override fun dispose() { override fun dispose() {
} }
@@ -152,7 +152,7 @@ class BuildingMaker(batch: FlippingSpriteBatch) : IngameInstance(batch) {
override var referenceID: ActorID = blockPosToRefID(x, y) // custom refID override var referenceID: ActorID = blockPosToRefID(x, y) // custom refID
override val hitbox = Hitbox(x * 16.0, y * 16.0, 16.0, 16.0) override val hitbox = Hitbox(x * 16.0, y * 16.0, 16.0, 16.0)
override fun drawBody(batch: SpriteBatch) { override fun drawBody(frameDelta: Float, batch: SpriteBatch) {
batch.color = blockMarkerColour batch.color = blockMarkerColour
drawSpriteInGoodPosition(blockMarkings.get(2,0), batch) drawSpriteInGoodPosition(blockMarkings.get(2,0), batch)
} }
@@ -188,7 +188,7 @@ class BuildingMaker(batch: FlippingSpriteBatch) : IngameInstance(batch) {
} }
} }
override fun drawGlow(batch: SpriteBatch) { } override fun drawGlow(frameDelta: Float, batch: SpriteBatch) { }
override fun update(delta: Float) { } override fun update(delta: Float) { }
@@ -458,7 +458,7 @@ class BuildingMaker(batch: FlippingSpriteBatch) : IngameInstance(batch) {
private val renderGame = { delta: Float -> private val renderGame = { delta: Float ->
_testMarkerDrawCalls = 0L _testMarkerDrawCalls = 0L
IngameRenderer.invoke(false, IngameRenderer.invoke(delta, false,
screenZoom, screenZoom,
listOf(), listOf(),
listOf(), listOf(),
@@ -696,10 +696,10 @@ class MovableWorldCamera(val parent: BuildingMaker) : ActorHumanoid(0, physProp
this.hitbox.hitboxStart.setCoerceIn(coerceInStart, coerceInEnd) this.hitbox.hitboxStart.setCoerceIn(coerceInStart, coerceInEnd)
} }
override fun drawBody(batch: SpriteBatch) { override fun drawBody(frameDelta: Float, batch: SpriteBatch) {
} }
override fun drawGlow(batch: SpriteBatch) { override fun drawGlow(frameDelta: Float, batch: SpriteBatch) {
} }
override fun onActorValueChange(key: String, value: Any?) { override fun onActorValueChange(key: String, value: Any?) {

View File

@@ -202,16 +202,17 @@ object IngameRenderer : Disposable {
private var oldCamX = 0 private var oldCamX = 0
operator fun invoke( operator fun invoke(
gamePaused: Boolean, frameDelta: Float,
zoom: Float = 1f, gamePaused: Boolean,
actorsRenderBehind : List<ActorWithBody>, zoom: Float = 1f,
actorsRenderMiddle : List<ActorWithBody>, actorsRenderBehind : List<ActorWithBody>,
actorsRenderMidTop : List<ActorWithBody>, actorsRenderMiddle : List<ActorWithBody>,
actorsRenderFront : List<ActorWithBody>, actorsRenderMidTop : List<ActorWithBody>,
actorsRenderOverlay: List<ActorWithBody>, actorsRenderFront : List<ActorWithBody>,
particlesContainer : CircularArray<ParticleBase>, actorsRenderOverlay: List<ActorWithBody>,
player: ActorWithBody? = null, particlesContainer : CircularArray<ParticleBase>,
uiContainer: UIContainer? = null, player: ActorWithBody? = null,
uiContainer: UIContainer? = null,
) { ) {
renderingActorsCount = (actorsRenderBehind.size) + renderingActorsCount = (actorsRenderBehind.size) +
(actorsRenderMiddle.size) + (actorsRenderMiddle.size) +
@@ -239,9 +240,9 @@ object IngameRenderer : Disposable {
prepLightmapRGBA() prepLightmapRGBA()
BlocksDrawer.renderData() BlocksDrawer.renderData()
drawToRGB(actorsRenderBehind, actorsRenderMiddle, actorsRenderMidTop, actorsRenderFront, actorsRenderOverlay, particlesContainer) drawToRGB(frameDelta, actorsRenderBehind, actorsRenderMiddle, actorsRenderMidTop, actorsRenderFront, actorsRenderOverlay, particlesContainer)
drawToA(actorsRenderBehind, actorsRenderMiddle, actorsRenderMidTop, actorsRenderFront, actorsRenderOverlay, particlesContainer) drawToA(frameDelta, actorsRenderBehind, actorsRenderMiddle, actorsRenderMidTop, actorsRenderFront, actorsRenderOverlay, particlesContainer)
drawOverlayActors(actorsRenderOverlay) drawOverlayActors(frameDelta, actorsRenderOverlay)
} }
batch.color = Color.WHITE batch.color = Color.WHITE
@@ -263,7 +264,7 @@ object IngameRenderer : Disposable {
// draw sky // draw sky
measureDebugTime("WeatherMixer.render") { measureDebugTime("WeatherMixer.render") {
WeatherMixer.render(camera, batch, world) WeatherMixer.render(frameDelta, camera, batch, world)
} }
@@ -403,7 +404,7 @@ object IngameRenderer : Disposable {
if (!KeyToggler.isOn(Input.Keys.F4)) { if (!KeyToggler.isOn(Input.Keys.F4)) {
uiContainer?.forEach { uiContainer?.forEach {
it?.render(batch, camera) it?.render(frameDelta, batch, camera)
} }
} }
} }
@@ -449,12 +450,13 @@ object IngameRenderer : Disposable {
} }
private fun drawToRGB( private fun drawToRGB(
actorsRenderBehind: List<ActorWithBody>?, frameDelta: Float,
actorsRenderMiddle: List<ActorWithBody>?, actorsRenderBehind: List<ActorWithBody>?,
actorsRenderMidTop: List<ActorWithBody>?, actorsRenderMiddle: List<ActorWithBody>?,
actorsRenderFront : List<ActorWithBody>?, actorsRenderMidTop: List<ActorWithBody>?,
actorsOverlay : List<ActorWithBody>?, actorsRenderFront : List<ActorWithBody>?,
particlesContainer: CircularArray<ParticleBase>? actorsOverlay : List<ActorWithBody>?,
particlesContainer: CircularArray<ParticleBase>?
) { ) {
fboRGB.inAction(null, null) { clearBuffer() } fboRGB.inAction(null, null) { clearBuffer() }
fboRGB_lightMixed.inAction(null, null) { clearBuffer() } fboRGB_lightMixed.inAction(null, null) { clearBuffer() }
@@ -468,8 +470,8 @@ object IngameRenderer : Disposable {
batch.shader = shaderForActors batch.shader = shaderForActors
batch.color = Color.WHITE batch.color = Color.WHITE
moveCameraToWorldCoord() moveCameraToWorldCoord()
actorsRenderBehind?.forEach { it.drawBody(batch) } actorsRenderBehind?.forEach { it.drawBody(frameDelta, batch) }
particlesContainer?.forEach { it.drawBody(batch) } particlesContainer?.forEach { it.drawBody(frameDelta, batch) }
} }
setCameraPosition(0f, 0f) setCameraPosition(0f, 0f)
@@ -483,10 +485,10 @@ object IngameRenderer : Disposable {
// draw actors // // draw actors //
///////////////// /////////////////
moveCameraToWorldCoord() moveCameraToWorldCoord()
actorsRenderMiddle?.forEach { it.drawBody(batch) } actorsRenderMiddle?.forEach { it.drawBody(frameDelta, batch) }
actorsRenderMidTop?.forEach { it.drawBody(batch) } actorsRenderMidTop?.forEach { it.drawBody(frameDelta, batch) }
player?.drawBody(batch) player?.drawBody(frameDelta, batch)
actorsRenderFront?.forEach { it.drawBody(batch) } actorsRenderFront?.forEach { it.drawBody(frameDelta, batch) }
// --> Change of blend mode <-- introduced by children of ActorWithBody // // --> Change of blend mode <-- introduced by children of ActorWithBody //
} }
@@ -558,12 +560,13 @@ object IngameRenderer : Disposable {
} }
private fun drawToA( private fun drawToA(
actorsRenderBehind: List<ActorWithBody>?, frameDelta: Float,
actorsRenderMiddle: List<ActorWithBody>?, actorsRenderBehind: List<ActorWithBody>?,
actorsRenderMidTop: List<ActorWithBody>?, actorsRenderMiddle: List<ActorWithBody>?,
actorsRenderFront : List<ActorWithBody>?, actorsRenderMidTop: List<ActorWithBody>?,
actorsOverlay : List<ActorWithBody>?, actorsRenderFront : List<ActorWithBody>?,
particlesContainer: CircularArray<ParticleBase>? actorsOverlay : List<ActorWithBody>?,
particlesContainer: CircularArray<ParticleBase>?
) { ) {
fboA.inAction(null, null) { fboA.inAction(null, null) {
clearBuffer() clearBuffer()
@@ -582,8 +585,8 @@ object IngameRenderer : Disposable {
batch.color = Color.WHITE batch.color = Color.WHITE
moveCameraToWorldCoord() moveCameraToWorldCoord()
actorsRenderBehind?.forEach { it.drawGlow(batch) } actorsRenderBehind?.forEach { it.drawGlow(frameDelta, batch) }
particlesContainer?.forEach { it.drawGlow(batch) } particlesContainer?.forEach { it.drawGlow(frameDelta, batch) }
} }
setCameraPosition(0f, 0f) setCameraPosition(0f, 0f)
@@ -594,10 +597,10 @@ object IngameRenderer : Disposable {
// draw actors // // draw actors //
///////////////// /////////////////
moveCameraToWorldCoord() moveCameraToWorldCoord()
actorsRenderMiddle?.forEach { it.drawGlow(batch) } actorsRenderMiddle?.forEach { it.drawGlow(frameDelta, batch) }
actorsRenderMidTop?.forEach { it.drawGlow(batch) } actorsRenderMidTop?.forEach { it.drawGlow(frameDelta, batch) }
player?.drawGlow(batch) player?.drawGlow(frameDelta, batch)
actorsRenderFront?.forEach { it.drawGlow(batch) } actorsRenderFront?.forEach { it.drawGlow(frameDelta, batch) }
// --> Change of blend mode <-- introduced by children of ActorWithBody // // --> Change of blend mode <-- introduced by children of ActorWithBody //
} }
} }
@@ -647,7 +650,7 @@ object IngameRenderer : Disposable {
blendNormalStraightAlpha(batch) blendNormalStraightAlpha(batch)
} }
private fun drawOverlayActors(actors: List<ActorWithBody>?) { private fun drawOverlayActors(frameDelta: Float, actors: List<ActorWithBody>?) {
fboRGB_lightMixed.inActionF(camera, batch) { fboRGB_lightMixed.inActionF(camera, batch) {
setCameraPosition(0f, 0f) setCameraPosition(0f, 0f)
@@ -659,7 +662,7 @@ object IngameRenderer : Disposable {
moveCameraToWorldCoord() moveCameraToWorldCoord()
actors?.forEach { actors?.forEach {
it.drawBody(batch) it.drawBody(frameDelta, batch)
} }
} }

View File

@@ -50,6 +50,7 @@ import net.torvald.terrarum.realestate.LandUtil
import net.torvald.terrarum.savegame.VDUtil import net.torvald.terrarum.savegame.VDUtil
import net.torvald.terrarum.savegame.VirtualDisk import net.torvald.terrarum.savegame.VirtualDisk
import net.torvald.terrarum.serialise.Common import net.torvald.terrarum.serialise.Common
import net.torvald.terrarum.ui.BasicDebugInfoWindow.Companion.toIntAndFrac
import net.torvald.terrarum.ui.Toolkit import net.torvald.terrarum.ui.Toolkit
import net.torvald.terrarum.ui.Toolkit.hdrawWidth import net.torvald.terrarum.ui.Toolkit.hdrawWidth
import net.torvald.terrarum.ui.UIAutosaveNotifier import net.torvald.terrarum.ui.UIAutosaveNotifier
@@ -971,10 +972,20 @@ open class TerrarumIngame(batch: FlippingSpriteBatch) : IngameInstance(batch) {
paused = true paused = true
} }
if (KeyToggler.isOn(Input.Keys.F10)) {
batch.inUse {
batch.color = Color.WHITE
App.fontSmallNumbers.draw(batch, "$ccY\u00DCupd $ccG${delta.toIntAndFrac(1)}", 2f, App.scr.height - 16f)
_dbgDeltaUpd = delta
}
}
} }
private var _dbgDeltaUpd = 0f
private val renderGame = { delta: Float ->
private val renderGame = { frameDelta: Float ->
Gdx.graphics.setTitle(getCanonicalTitle()) Gdx.graphics.setTitle(getCanonicalTitle())
WorldCamera.update(world, actorNowPlaying) WorldCamera.update(world, actorNowPlaying)
@@ -994,16 +1005,17 @@ open class TerrarumIngame(batch: FlippingSpriteBatch) : IngameInstance(batch) {
if (uiFixture?.isClosed == true) { uiFixture = null } if (uiFixture?.isClosed == true) { uiFixture = null }
IngameRenderer.invoke( IngameRenderer.invoke(
paused, frameDelta,
screenZoom, paused,
visibleActorsRenderBehind, screenZoom,
visibleActorsRenderMiddle, visibleActorsRenderBehind,
visibleActorsRenderMidTop, visibleActorsRenderMiddle,
visibleActorsRenderFront, visibleActorsRenderMidTop,
visibleActorsRenderOverlay, visibleActorsRenderFront,
particlesContainer, visibleActorsRenderOverlay,
actorNowPlaying, particlesContainer,
uiContainer// + uiFixture actorNowPlaying,
uiContainer// + uiFixture
) )
// quick and dirty way to show // quick and dirty way to show
@@ -1035,6 +1047,16 @@ open class TerrarumIngame(batch: FlippingSpriteBatch) : IngameInstance(batch) {
} }
} }
} }
if (KeyToggler.isOn(Input.Keys.F10)) {
batch.inUse {
batch.color = Color.WHITE
App.fontSmallNumbers.draw(batch, "$ccY\u00DCupd $ccG${_dbgDeltaUpd.toIntAndFrac(1)}", 2f, App.scr.height - 16f)
App.fontSmallNumbers.draw(batch, "$ccY\u00DCren $ccG${frameDelta.toIntAndFrac(1)}", 2f + 7*12, App.scr.height - 16f)
App.fontSmallNumbers.draw(batch, "$ccY\u00DCgdx $ccG${Gdx.graphics.deltaTime.toIntAndFrac(1)}", 2f + 7*24, App.scr.height - 16f)
}
}
} }
private var worldTransitionOngoing = false private var worldTransitionOngoing = false

View File

@@ -358,15 +358,16 @@ class TitleScreen(batch: FlippingSpriteBatch) : IngameInstance(batch) {
if (!demoWorld.layerTerrain.ptr.destroyed) { // FIXME q&d hack to circumvent the dangling pointer issue #26 if (!demoWorld.layerTerrain.ptr.destroyed) { // FIXME q&d hack to circumvent the dangling pointer issue #26
IngameRenderer.invoke( IngameRenderer.invoke(
false, delta,
1f, false,
listOf(), 1f,
listOf(), listOf(),
listOf(), listOf(),
listOf(), listOf(),
listOf(), listOf(),
particles, listOf(),
uiContainer = uiContainer particles,
uiContainer = uiContainer
) )
if (KeyToggler.isOn(Input.Keys.F10)) { if (KeyToggler.isOn(Input.Keys.F10)) {
@@ -598,8 +599,8 @@ class TitleScreen(batch: FlippingSpriteBatch) : IngameInstance(batch) {
) )
} }
override fun drawBody(batch: SpriteBatch) { } override fun drawBody(frameDelta: Float, batch: SpriteBatch) { }
override fun drawGlow(batch: SpriteBatch) { } override fun drawGlow(frameDelta: Float, batch: SpriteBatch) { }
override fun update(delta: Float) { override fun update(delta: Float) {
ai.update(this, delta) ai.update(this, delta)

View File

@@ -84,7 +84,7 @@ class UIBuildingMakerGetFilename : UICanvas() {
} }
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) { override fun renderUI(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera) {
blendNormalStraightAlpha(batch) blendNormalStraightAlpha(batch)
// draw border // draw border
@@ -111,7 +111,7 @@ class UIBuildingMakerGetFilename : UICanvas() {
App.fontGame.draw(batch, str, 0 + LINE_HEIGHT / 2, 0 + LINE_HEIGHT / 2 + LINE_HEIGHT * index) App.fontGame.draw(batch, str, 0 + LINE_HEIGHT / 2, 0 + LINE_HEIGHT / 2 + LINE_HEIGHT * index)
} }
uiItems.forEach { it.render(batch, camera) } uiItems.forEach { it.render(frameDelta, batch, camera) }
} }
private var dragOriginX = 0 // relative mousepos private var dragOriginX = 0 // relative mousepos

View File

@@ -96,7 +96,7 @@ open class DroppedItem : ActorWithBody {
} }
override fun drawBody(batch: SpriteBatch) { override fun drawBody(frameDelta: Float, batch: SpriteBatch) {
// deserialiser won't call setter of the fields // deserialiser won't call setter of the fields
if (visualItemID == "") { if (visualItemID == "") {
visualItemID = BlockCodex.getOrNull(itemID)?.world ?: itemID visualItemID = BlockCodex.getOrNull(itemID)?.world ?: itemID

View File

@@ -72,8 +72,8 @@ internal class FixtureTikiTorch : FixtureBase {
spawnTimer += delta spawnTimer += delta
} }
override fun drawBody(batch: SpriteBatch) { override fun drawBody(frameDelta: Float, batch: SpriteBatch) {
super.drawBody(batch) super.drawBody(frameDelta, batch)
} }
companion object { companion object {

View File

@@ -53,9 +53,9 @@ class FixtureWorldPortal : Electric {
@Transient internal var teleportRequest: TeleportRequest? = null @Transient internal var teleportRequest: TeleportRequest? = null
override fun drawBody(batch: SpriteBatch) { override fun drawBody(frameDelta: Float, batch: SpriteBatch) {
(sprite as SheetSpriteAnimation).currentFrame = (Math.random() * 3).toInt() (sprite as SheetSpriteAnimation).currentFrame = (Math.random() * 3).toInt()
super.drawBody(batch) super.drawBody(frameDelta, batch)
} }
override fun onRisingEdge(readFrom: BlockBoxIndex) { override fun onRisingEdge(readFrom: BlockBoxIndex) {

View File

@@ -24,7 +24,7 @@ class PhysTestBall : ActorWithBody(RenderOrder.MIDDLE, PhysProperties.PHYSICS_OB
color = RoguelikeRandomiser.composeColourFrom(RoguelikeRandomiser.POTION_PRIMARY_COLSET) color = RoguelikeRandomiser.composeColourFrom(RoguelikeRandomiser.POTION_PRIMARY_COLSET)
} }
override fun drawBody(batch: SpriteBatch) { override fun drawBody(frameDelta: Float, batch: SpriteBatch) {
/*Terrarum.inShapeRenderer { /*Terrarum.inShapeRenderer {
it.color = color it.color = color
it.circle( it.circle(

View File

@@ -41,10 +41,10 @@ class PhysTestLuarLander : ActorWithBody(RenderOrder.MIDTOP, PhysProperties.PHYS
return true return true
} }
override fun drawGlow(batch: SpriteBatch) { override fun drawGlow(frameDelta: Float, batch: SpriteBatch) {
} }
override fun drawBody(batch: SpriteBatch) { override fun drawBody(frameDelta: Float, batch: SpriteBatch) {
batch.color = Color.WHITE batch.color = Color.WHITE
batch.draw(texture, hitbox.startX.toFloat(), hitbox.endY.toFloat(), hitbox.width.toFloat(), -hitbox.height.toFloat()) batch.draw(texture, hitbox.startX.toFloat(), hitbox.endY.toFloat(), hitbox.width.toFloat(), -hitbox.height.toFloat())
} }

View File

@@ -93,7 +93,7 @@ open class ProjectileSimple : ActorWithBody, Projectile {
/** /**
* WARNING! ends and begins Batch * WARNING! ends and begins Batch
*/ */
override fun drawBody(batch: SpriteBatch) { override fun drawBody(frameDelta: Float, batch: SpriteBatch) {
val colourTail = displayColour.cpy() // clone a colour val colourTail = displayColour.cpy() // clone a colour
colourTail.a = 0.16f colourTail.a = 0.16f
@@ -113,7 +113,7 @@ open class ProjectileSimple : ActorWithBody, Projectile {
batch.begin()*/ batch.begin()*/
} }
override fun drawGlow(batch: SpriteBatch) = drawBody(batch) override fun drawGlow(frameDelta: Float, batch: SpriteBatch) = drawBody(frameDelta, batch)
companion object { companion object {
val OFFSET_DAMAGE = 0 val OFFSET_DAMAGE = 0

View File

@@ -26,7 +26,7 @@ package net.torvald.terrarum.modulebasegame.ui
override fun updateUI(delta: Float) { override fun updateUI(delta: Float) {
} }
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) { override fun renderUI(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera) {
blendNormal(batch) blendNormal(batch)
val textWidth = messagesList.map { AppLoader.fontGame.getWidth(it) }.sorted()[1] val textWidth = messagesList.map { AppLoader.fontGame.getWidth(it) }.sorted()[1]

View File

@@ -66,7 +66,7 @@ class Notification : UICanvas() {
} }
} }
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) { override fun renderUI(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera) {
blendNormalStraightAlpha(batch) blendNormalStraightAlpha(batch)
fontCol.a = handler.opacity * OPACITY fontCol.a = handler.opacity * OPACITY

View File

@@ -20,7 +20,7 @@ object NullUI : UICanvas() {
override fun updateUI(delta: Float) { override fun updateUI(delta: Float) {
} }
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) { override fun renderUI(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera) {
} }
override fun doOpening(delta: Float) { override fun doOpening(delta: Float) {

View File

@@ -87,7 +87,7 @@ class UIBasicInfo() : UICanvas() {
private val lcdLitCol: Color = lcdLitColELoff private val lcdLitCol: Color = lcdLitColELoff
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) { override fun renderUI(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera) {
batch.color = drawCol batch.color = drawCol
batch.draw(atlas.get(0, 0), 0f, 0f) batch.draw(atlas.get(0, 0), 0f, 0f)

View File

@@ -166,7 +166,7 @@ class UIBuildingMakerBlockChooser(val parent: BuildingMaker): UICanvas() {
} }
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) { override fun renderUI(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera) {
blendNormalStraightAlpha(batch) blendNormalStraightAlpha(batch)
// border // border
@@ -182,14 +182,14 @@ class UIBuildingMakerBlockChooser(val parent: BuildingMaker): UICanvas() {
Toolkit.fillArea(batch, 0, 0, MENUBAR_SIZE, height) Toolkit.fillArea(batch, 0, 0, MENUBAR_SIZE, height)
// the actual buttons // the actual buttons
tabs.render(batch, camera) tabs.render(frameDelta, batch, camera)
closeButton.render(batch, camera) closeButton.render(frameDelta, batch, camera)
currentPalette.visible.forEach { currentPalette.visible.forEach {
it.render(batch, camera) it.render(frameDelta, batch, camera)
} }
uiItems.forEach { it.render(batch, camera) } uiItems.forEach { it.render(frameDelta, batch, camera) }
} }
private var dragOriginX = 0 // relative mousepos private var dragOriginX = 0 // relative mousepos

View File

@@ -150,7 +150,7 @@ class UIBuildingMakerPenMenu(val parent: BuildingMaker): UICanvas() {
parent.tappedOnUI = true parent.tappedOnUI = true
} }
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) { override fun renderUI(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera) {
// draw back // draw back
batch.color = backCol batch.color = backCol
Toolkit.fillCircle(batch,0, 0, SIZE, SIZE) Toolkit.fillCircle(batch,0, 0, SIZE, SIZE)
@@ -194,7 +194,7 @@ class UIBuildingMakerPenMenu(val parent: BuildingMaker): UICanvas() {
// draw icons // draw icons
toolButtons.forEach { toolButtons.forEach {
it.render(batch, camera) it.render(frameDelta, batch, camera)
} }
} }

View File

@@ -38,8 +38,8 @@ class UIBuildingMakerToolbox : UICanvas() {
} }
} }
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) { override fun renderUI(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera) {
tools.forEach { it.render(batch, camera) } tools.forEach { it.render(frameDelta, batch, camera) }
} }
override fun doOpening(delta: Float) { } override fun doOpening(delta: Float) { }

View File

@@ -32,7 +32,7 @@ class UICheatDetected : UICanvas() {
private val backgroundCol = Color(0x00000080) private val backgroundCol = Color(0x00000080)
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) { override fun renderUI(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera) {
Terrarum.ingame?.consoleHandler?.setAsClose() Terrarum.ingame?.consoleHandler?.setAsClose()
Terrarum.ingame?.consoleHandler?.isVisible = false Terrarum.ingame?.consoleHandler?.isVisible = false

View File

@@ -443,9 +443,9 @@ class UICrafting(val full: UIInventoryFull) : UICanvas(), HasInventory {
if (openingClickLatched && !Terrarum.mouseDown) openingClickLatched = false if (openingClickLatched && !Terrarum.mouseDown) openingClickLatched = false
} }
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) { override fun renderUI(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera) {
// NO super.render due to an infinite recursion // NO super.render due to an infinite recursion
this.uiItems.forEach { it.render(batch, camera) } this.uiItems.forEach { it.render(frameDelta, batch, camera) }
batch.color = Color.WHITE batch.color = Color.WHITE

View File

@@ -49,9 +49,9 @@ class UIGraphicsControlPanel(remoCon: UIRemoCon?) : UICanvas() {
uiItems.forEach { it.update(delta) } uiItems.forEach { it.update(delta) }
} }
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) { override fun renderUI(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera) {
ControlPanelCommon.render("basegame.graphicscontrolpanel", width, batch) ControlPanelCommon.render("basegame.graphicscontrolpanel", width, batch)
uiItems.forEach { it.render(batch, camera) } uiItems.forEach { it.render(frameDelta, batch, camera) }
if (App.getConfigBoolean("fx_streamerslayout")) { if (App.getConfigBoolean("fx_streamerslayout")) {
val xstart = App.scr.width - App.scr.chatWidth val xstart = App.scr.width - App.scr.chatWidth

View File

@@ -173,7 +173,7 @@ class UIIMEConfig(remoCon: UIRemoCon?) : UICanvas() {
uiItems.forEach { it.update(delta) } uiItems.forEach { it.update(delta) }
} }
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) { override fun renderUI(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera) {
batch.color = Color.WHITE batch.color = Color.WHITE
val txt1 = Lang["MENU_LABEL_KEYBOARD_LAYOUT"]; val tw1 = App.fontGame.getWidth(txt1) val txt1 = Lang["MENU_LABEL_KEYBOARD_LAYOUT"]; val tw1 = App.fontGame.getWidth(txt1)
@@ -198,7 +198,7 @@ class UIIMEConfig(remoCon: UIRemoCon?) : UICanvas() {
batch.color = Color.WHITE batch.color = Color.WHITE
uiItems.forEach { it.render(batch, camera) } uiItems.forEach { it.render(frameDelta, batch, camera) }
shiftin = Gdx.input.isKeyPressed(Input.Keys.SHIFT_LEFT) || Gdx.input.isKeyPressed(Input.Keys.SHIFT_RIGHT) shiftin = Gdx.input.isKeyPressed(Input.Keys.SHIFT_LEFT) || Gdx.input.isKeyPressed(Input.Keys.SHIFT_RIGHT)
altgrin = Gdx.input.isKeyPressed(Input.Keys.ALT_RIGHT) || (Gdx.input.isKeyPressed(Input.Keys.ALT_LEFT) && Gdx.input.isKeyPressed(Input.Keys.CONTROL_LEFT)) altgrin = Gdx.input.isKeyPressed(Input.Keys.ALT_RIGHT) || (Gdx.input.isKeyPressed(Input.Keys.ALT_LEFT) && Gdx.input.isKeyPressed(Input.Keys.CONTROL_LEFT))
@@ -271,8 +271,8 @@ private class UIItemInputKeycap(
c in 0x1DC0..0x1DFF || c in 0x20D0..0x20FF || c in 0xFE20..0xFE2F || c in 0x1DC0..0x1DFF || c in 0x20D0..0x20FF || c in 0xFE20..0xFE2F ||
c == 0xE31 || c in 0xE33..0xE3A || c in 0xE47..0xE4E c == 0xE31 || c in 0xE33..0xE3A || c in 0xE47..0xE4E
override fun render(batch: SpriteBatch, camera: OrthographicCamera) { override fun render(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera) {
super.render(batch, camera) super.render(frameDelta, batch, camera)
// key background // key background
batch.color = keycapFill batch.color = keycapFill

View File

@@ -113,7 +113,7 @@ class UIImportAvatar(val remoCon: UIRemoCon) : Advanceable() {
} }
private lateinit var wotKeys: List<String> private lateinit var wotKeys: List<String>
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) { override fun renderUI(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera) {
batch.color = Color.WHITE batch.color = Color.WHITE
val textboxWidth = wotKeys.maxOf { App.fontGame.getWidth(it) } val textboxWidth = wotKeys.maxOf { App.fontGame.getWidth(it) }
val textX = (Toolkit.drawWidth - textboxWidth) / 2 val textX = (Toolkit.drawWidth - textboxWidth) / 2
@@ -126,7 +126,7 @@ class UIImportAvatar(val remoCon: UIRemoCon) : Advanceable() {
App.fontGame.draw(batch, App.importDir, (Toolkit.drawWidth - pathW) / 2, textY) App.fontGame.draw(batch, App.importDir, (Toolkit.drawWidth - pathW) / 2, textY)
uiItems.forEach { it.render(batch, camera) } uiItems.forEach { it.render(frameDelta, batch, camera) }
if (importReturnCode != 0) { if (importReturnCode != 0) {
@@ -262,7 +262,7 @@ class UIItemCodeBox(parent: UIImportAvatar, initialX: Int, initialY: Int, val co
} }
} }
override fun render(batch: SpriteBatch, camera: OrthographicCamera) { override fun render(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera) {
// draw box backgrounds // draw box backgrounds
batch.color = UIInventoryFull.CELL_COL batch.color = UIInventoryFull.CELL_COL
Toolkit.fillArea(batch, posX, posY, width, height) Toolkit.fillArea(batch, posX, posY, width, height)

View File

@@ -213,7 +213,7 @@ package net.torvald.terrarum.modulebasegame.ui
private val weightBarWidth = 60f private val weightBarWidth = 60f
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) { override fun renderUI(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera) {
// background // background
blendNormal() blendNormal()
batch.color = backgroundColour batch.color = backgroundColour
@@ -225,14 +225,14 @@ package net.torvald.terrarum.modulebasegame.ui
batch.color = Color(0xcccccc_ff.toInt()) batch.color = Color(0xcccccc_ff.toInt())
Toolkit.fillArea(batch, 0f, 0f, catButtons.width.toFloat(), height.toFloat()) Toolkit.fillArea(batch, 0f, 0f, catButtons.width.toFloat(), height.toFloat())
catButtons.render(batch, camera) catButtons.render(frameDelta, batch, camera)
// left/right page mover // left/right page mover
scrollLeftButton.render(batch, camera) scrollLeftButton.render(frameDelta, batch, camera)
scrollRightButton.render(batch, camera) scrollRightButton.render(frameDelta, batch, camera)
items.forEach { items.forEach {
it.render(batch, camera) it.render(frameDelta, batch, camera)
} }
// texts // texts

View File

@@ -110,11 +110,11 @@ internal class UIInventoryCells(
} }
} }
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) { override fun renderUI(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera) {
//itemList.posX = itemList.initialX + inventoryScrOffX.roundToInt() //itemList.posX = itemList.initialX + inventoryScrOffX.roundToInt()
itemList.render(batch, camera) itemList.render(frameDelta, batch, camera)
//equipped.posX = equipped.initialX + inventoryScrOffX.roundToInt() //equipped.posX = equipped.initialX + inventoryScrOffX.roundToInt()
equipped.render(batch, camera) equipped.render(frameDelta, batch, camera)
// control hints // control hints

View File

@@ -188,39 +188,39 @@ class UIInventoryEscMenu(val full: UIInventoryFull) : UICanvas() {
// `screens` order // `screens` order
private val screenRenders = arrayOf( private val screenRenders = arrayOf(
{ batch: SpriteBatch, camera: OrthographicCamera -> { frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera ->
// control hints // control hints
App.fontGame.draw(batch, full.gameMenuControlHelp, controlHintX, full.yEnd - 20) App.fontGame.draw(batch, full.gameMenuControlHelp, controlHintX, full.yEnd - 20)
// text buttons // text buttons
gameMenuButtons.render(batch, camera) gameMenuButtons.render(frameDelta, batch, camera)
}, },
{ batch: SpriteBatch, camera: OrthographicCamera -> { frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera ->
// control hints // control hints
App.fontGame.draw(batch, full.gameMenuControlHelp, controlHintX, full.yEnd - 20) App.fontGame.draw(batch, full.gameMenuControlHelp, controlHintX, full.yEnd - 20)
keyboardSetupUI.render(batch, camera) keyboardSetupUI.render(frameDelta, batch, camera)
}, },
{ batch: SpriteBatch, camera: OrthographicCamera -> { frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera ->
// control hints // control hints
App.fontGame.draw(batch, full.gameMenuControlHelp, controlHintX, full.yEnd - 20) App.fontGame.draw(batch, full.gameMenuControlHelp, controlHintX, full.yEnd - 20)
areYouSureMainMenuButtons.render(batch, camera) areYouSureMainMenuButtons.render(frameDelta, batch, camera)
}, },
{ batch: SpriteBatch, camera: OrthographicCamera -> { frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera ->
savingUI.render(batch, camera) savingUI.render(frameDelta, batch, camera)
}, },
{ batch: SpriteBatch, camera: OrthographicCamera -> { frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera ->
// control hints // control hints
App.fontGame.draw(batch, full.gameMenuControlHelp, controlHintX, full.yEnd - 20) App.fontGame.draw(batch, full.gameMenuControlHelp, controlHintX, full.yEnd - 20)
keyConfigUI.render(batch, camera) keyConfigUI.render(frameDelta, batch, camera)
}, },
{ batch: SpriteBatch, camera: OrthographicCamera -> { frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera ->
// control hints // control hints
App.fontGame.draw(batch, full.gameMenuControlHelp, controlHintX, full.yEnd - 20) App.fontGame.draw(batch, full.gameMenuControlHelp, controlHintX, full.yEnd - 20)
languageUI.render(batch, camera) languageUI.render(frameDelta, batch, camera)
}, },
{ batch: SpriteBatch, camera: OrthographicCamera -> { frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera ->
// control hints // control hints
App.fontGame.draw(batch, full.gameMenuControlHelp, controlHintX, full.yEnd - 20) App.fontGame.draw(batch, full.gameMenuControlHelp, controlHintX, full.yEnd - 20)
shareUI.render(batch, camera) shareUI.render(frameDelta, batch, camera)
}, },
) )
@@ -300,10 +300,10 @@ class UIInventoryEscMenu(val full: UIInventoryFull) : UICanvas() {
yeet.update(delta) yeet.update(delta)
} }
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) { override fun renderUI(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera) {
blendNormalStraightAlpha(batch) blendNormalStraightAlpha(batch)
batch.color = Color.WHITE batch.color = Color.WHITE
screenRenders[screen](batch, camera) screenRenders[screen](frameDelta, batch, camera)
} }
override fun touchDown(screenX: Int, screenY: Int, pointer: Int, button: Int): Boolean { override fun touchDown(screenX: Int, screenY: Int, pointer: Int, button: Int): Boolean {

View File

@@ -320,13 +320,13 @@ class UIInventoryFull(
internal var yEnd = -YPOS_CORRECTION + (App.scr.height + internalHeight).div(2).toFloat() internal var yEnd = -YPOS_CORRECTION + (App.scr.height + internalHeight).div(2).toFloat()
private set private set
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) { override fun renderUI(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera) {
drawBackground(batch, 1f) drawBackground(batch, 1f)
// UI items // UI items
catBar.render(batch, camera) catBar.render(frameDelta, batch, camera)
transitionPanel.render(batch, camera) transitionPanel.render(frameDelta, batch, camera)
// if (transitionPanel.currentPosition != 1f) INGAME.setTooltipMessage(null) // if (transitionPanel.currentPosition != 1f) INGAME.setTooltipMessage(null)
} }

View File

@@ -65,7 +65,7 @@ class UIInventoryMinimap(val full: UIInventoryFull) : UICanvas() {
minimapRerenderTimer += Gdx.graphics.deltaTime minimapRerenderTimer += Gdx.graphics.deltaTime
} }
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) { override fun renderUI(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera) {
blendNormalStraightAlpha(batch) blendNormalStraightAlpha(batch)
val cellOffY = INVENTORY_CELLS_OFFSET_Y() val cellOffY = INVENTORY_CELLS_OFFSET_Y()
val worldWidth = INGAME.world.width val worldWidth = INGAME.world.width

View File

@@ -35,7 +35,7 @@ abstract class UIItemInventoryCellBase(
var colourTheme: InventoryCellColourTheme = UIItemInventoryCellCommonRes.defaultInventoryCellTheme var colourTheme: InventoryCellColourTheme = UIItemInventoryCellCommonRes.defaultInventoryCellTheme
) : UIItem(parentUI, initialX, initialY) { ) : UIItem(parentUI, initialX, initialY) {
abstract override fun update(delta: Float) abstract override fun update(delta: Float)
abstract override fun render(batch: SpriteBatch, camera: OrthographicCamera) abstract override fun render(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera)
/** Custom highlight rule to highlight tihs button to primary accent colour (blue by default). /** Custom highlight rule to highlight tihs button to primary accent colour (blue by default).
* Set to `null` to use default rule: * Set to `null` to use default rule:

View File

@@ -68,7 +68,7 @@ class UIItemInventoryEquippedView(
itemGrid.forEach { it.update(delta) } itemGrid.forEach { it.update(delta) }
} }
override fun render(batch: SpriteBatch, camera: OrthographicCamera) { override fun render(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera) {
blendNormalStraightAlpha(batch) blendNormalStraightAlpha(batch)
val posXDelta = posX - oldPosX val posXDelta = posX - oldPosX
@@ -109,7 +109,7 @@ class UIItemInventoryEquippedView(
// slot image on each cells // slot image on each cells
itemGrid.forEachIndexed { index, cell -> itemGrid.forEachIndexed { index, cell ->
cell.render(batch, camera) cell.render(frameDelta, batch, camera)
if (cell.item == null) { if (cell.item == null) {
batch.color = equipPosIconCol batch.color = equipPosIconCol
batch.draw(equipPosIcon.get(cellToIcon[index], 1), 15f + cell.posX, 15f + cell.posY) batch.draw(equipPosIcon.get(cellToIcon[index], 1), 15f + cell.posX, 15f + cell.posY)

View File

@@ -306,21 +306,21 @@ open class UIItemInventoryItemGrid(
// private fun getIconPosY(index: Int) = // private fun getIconPosY(index: Int) =
// posY + 8 + 26 * index // posY + 8 + 26 * index
override fun render(batch: SpriteBatch, camera: OrthographicCamera) { override fun render(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera) {
val posXDelta = posX - oldPosX val posXDelta = posX - oldPosX
itemGrid.forEach { it.posX += posXDelta } itemGrid.forEach { it.posX += posXDelta }
itemList.forEach { it.posX += posXDelta } itemList.forEach { it.posX += posXDelta }
// define each button's highlighted status from the list of forceHighlighted, then render the button // define each button's highlighted status from the list of forceHighlighted, then render the button
items.forEach { items.forEach {
if (useHighlightingManager) it.forceHighlighted = forceHighlightList.contains(it.item?.dynamicID) if (useHighlightingManager) it.forceHighlighted = forceHighlightList.contains(it.item?.dynamicID)
it.render(batch, camera) it.render(frameDelta, batch, camera)
} }
if (!hideSidebar) { if (!hideSidebar) {
navRemoCon.render(batch, camera) navRemoCon.render(frameDelta, batch, camera)
} }
super.render(batch, camera) super.render(frameDelta, batch, camera)
oldPosX = posX oldPosX = posX
} }

View File

@@ -111,7 +111,7 @@ class UIItemListNavBarVertical(
var itemPage = 0 var itemPage = 0
override fun render(batch: SpriteBatch, camera: OrthographicCamera) { override fun render(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera) {
val posXDelta = posX - oldPosX val posXDelta = posX - oldPosX
gridModeButtons.forEach { it.posX += posXDelta } gridModeButtons.forEach { it.posX += posXDelta }
@@ -131,9 +131,9 @@ class UIItemListNavBarVertical(
batch.color = colourTheme.cellHighlightNormalCol batch.color = colourTheme.cellHighlightNormalCol
Toolkit.drawBoxBorder(batch, iconPosX - 4, getIconPosY(0) - 8, width, height) Toolkit.drawBoxBorder(batch, iconPosX - 4, getIconPosY(0) - 8, width, height)
if (hasGridModeButtons) gridModeButtons.forEach { it.render(batch, camera) } if (hasGridModeButtons) gridModeButtons.forEach { it.render(frameDelta, batch, camera) }
scrollUpButton.render(batch, camera) scrollUpButton.render(frameDelta, batch, camera)
scrollDownButton.render(batch, camera) scrollDownButton.render(frameDelta, batch, camera)
// draw scroll dots // draw scroll dots
for (i in 0 until itemPageCount) { for (i in 0 until itemPageCount) {
@@ -151,7 +151,7 @@ class UIItemListNavBarVertical(
extraDrawOpOnBottom(this, batch) extraDrawOpOnBottom(this, batch)
super.render(batch, camera) super.render(frameDelta, batch, camera)
oldPosX = posX oldPosX = posX
} }

View File

@@ -33,7 +33,7 @@ class UIItemSaving(parentUI: UICanvas, initialX: Int, initialY: Int) : UIItem(pa
init { init {
} }
override fun render(batch: SpriteBatch, camera: OrthographicCamera) { override fun render(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera) {
// these things will not scroll along with the parent GUI! // these things will not scroll along with the parent GUI!
val t = if ((INGAME as TerrarumIngame).uiAutosaveNotifier.isVisible) Lang["MENU_IO_WAITING_AUTOSAVE_TO_FINISH"] else Lang["MENU_IO_SAVING"] val t = if ((INGAME as TerrarumIngame).uiAutosaveNotifier.isVisible) Lang["MENU_IO_WAITING_AUTOSAVE_TO_FINISH"] else Lang["MENU_IO_SAVING"]
val tlen = App.fontGame.getWidth(t) val tlen = App.fontGame.getWidth(t)

View File

@@ -206,13 +206,13 @@ class UIKeyboardControlPanel(remoCon: UIRemoCon?) : UICanvas() {
controlPalette.update(delta) controlPalette.update(delta)
} }
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) { override fun renderUI(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera) {
// batch.color = borderNormal // batch.color = borderNormal
// Toolkit.drawBoxBorder(batch, drawX, drawY, width, height) // Toolkit.drawBoxBorder(batch, drawX, drawY, width, height)
// batch.color = fillCol // batch.color = fillCol
// Toolkit.fillArea(batch, drawX, drawY, width, height) // Toolkit.fillArea(batch, drawX, drawY, width, height)
uiItems.forEach { it.render(batch, camera) } uiItems.forEach { it.render(frameDelta, batch, camera) }
presetSelector.render(batch, camera) presetSelector.render(frameDelta, batch, camera)
// title // title
// todo show "Keyboard"/"Gamepad" accordingly // todo show "Keyboard"/"Gamepad" accordingly
@@ -228,7 +228,7 @@ class UIKeyboardControlPanel(remoCon: UIRemoCon?) : UICanvas() {
// action palette // action palette
batch.color = Color.WHITE batch.color = Color.WHITE
if (keycapClicked >= 0 && controlSelected < 0) { if (keycapClicked >= 0 && controlSelected < 0) {
controlPalette.render(batch, camera) controlPalette.render(frameDelta, batch, camera)
} }
} }
@@ -342,8 +342,8 @@ private class UIItemKeycap(
super.update(delta) super.update(delta)
} }
override fun render(batch: SpriteBatch, camera: OrthographicCamera) { override fun render(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera) {
super.render(batch, camera) super.render(frameDelta, batch, camera)
batch.color = if (key == null) batch.color = if (key == null)
borderKeyForbidden borderKeyForbidden
@@ -455,21 +455,21 @@ class UIItemControlPaletteBaloon(val parent: UIKeyboardControlPanel, initialX: I
) )
} }
override fun render(batch: SpriteBatch, camera: OrthographicCamera) { override fun render(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera) {
super.render(batch, camera) super.render(frameDelta, batch, camera)
Toolkit.drawBaloon(batch, posX.toFloat(), posY.toFloat(), width.toFloat(), height.toFloat()) Toolkit.drawBaloon(batch, posX.toFloat(), posY.toFloat(), width.toFloat(), height.toFloat())
iconButtons.forEach { iconButtons.forEach {
batch.color = buttonBackground batch.color = buttonBackground
Toolkit.fillArea(batch, it.posX-4, it.posY-4, 28, 28) Toolkit.fillArea(batch, it.posX-4, it.posY-4, 28, 28)
it.render(batch, camera) it.render(frameDelta, batch, camera)
batch.color = Color(batch.color.r, batch.color.g, batch.color.b, batch.color.a * (if (it.mouseUp) 0.9f else 0.6f)) batch.color = Color(batch.color.r, batch.color.g, batch.color.b, batch.color.a * (if (it.mouseUp) 0.9f else 0.6f))
Toolkit.drawBoxBorder(batch, it.posX-4, it.posY-4, 28, 28) Toolkit.drawBoxBorder(batch, it.posX-4, it.posY-4, 28, 28)
} }
closeButton1.render(batch, camera) closeButton1.render(frameDelta, batch, camera)
closeButton2.render(batch, camera) closeButton2.render(frameDelta, batch, camera)
// texts. Sorted in the same way as UIItemControlPaletteBaloon.iconButtons // texts. Sorted in the same way as UIItemControlPaletteBaloon.iconButtons
batch.color = Color.WHITE batch.color = Color.WHITE

View File

@@ -122,7 +122,7 @@ import java.util.zip.GZIPInputStream
private var loadFiredFrameCounter = 0 private var loadFiredFrameCounter = 0
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) { override fun renderUI(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera) {
if (mode == MODE_INIT) { if (mode == MODE_INIT) {
// "The Autosave is more recent than the manual save" // "The Autosave is more recent than the manual save"
Toolkit.drawTextCentered(batch, App.fontGame, Lang["GAME_MORE_RECENT_AUTOSAVE1"], Toolkit.drawWidth, 0, altSelDrawY) Toolkit.drawTextCentered(batch, App.fontGame, Lang["GAME_MORE_RECENT_AUTOSAVE1"], Toolkit.drawWidth, 0, altSelDrawY)
@@ -131,10 +131,10 @@ import java.util.zip.GZIPInputStream
Toolkit.drawTextCentered(batch, App.fontGame, Lang["MENU_IO_MANUAL_SAVE"], altSelHdrawW, (Toolkit.drawWidth - altSelDrawW)/2, altSelDrawY + 80) Toolkit.drawTextCentered(batch, App.fontGame, Lang["MENU_IO_MANUAL_SAVE"], altSelHdrawW, (Toolkit.drawWidth - altSelDrawW)/2, altSelDrawY + 80)
Toolkit.drawTextCentered(batch, App.fontGame, Lang["MENU_IO_AUTOSAVE"], altSelHdrawW, Toolkit.drawWidth/2, altSelDrawY + 80) Toolkit.drawTextCentered(batch, App.fontGame, Lang["MENU_IO_AUTOSAVE"], altSelHdrawW, Toolkit.drawWidth/2, altSelDrawY + 80)
if (::loadAutoThumbButton.isInitialized) loadAutoThumbButton.render(batch, camera) if (::loadAutoThumbButton.isInitialized) loadAutoThumbButton.render(frameDelta, batch, camera)
if (::loadManualThumbButton.isInitialized) loadManualThumbButton.render(batch, camera) if (::loadManualThumbButton.isInitialized) loadManualThumbButton.render(frameDelta, batch, camera)
mainBackButton.render(batch, camera) mainBackButton.render(frameDelta, batch, camera)
} }
else if (mode == MODE_LOAD) { else if (mode == MODE_LOAD) {
loadFiredFrameCounter += 1 loadFiredFrameCounter += 1

View File

@@ -307,7 +307,7 @@ class UILoadDemoSavefiles(val remoCon: UIRemoCon) : Advanceable() {
} }
} }
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) { override fun renderUI(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera) {
if (mode == 2) { if (mode == 2) {
loadFired += 1 loadFired += 1
@@ -348,7 +348,7 @@ class UILoadDemoSavefiles(val remoCon: UIRemoCon) : Advanceable() {
it.posX += uiXdiffChatOverlay it.posX += uiXdiffChatOverlay
if (index in listScroll - 2 until listScroll + savesVisible + 2) if (index in listScroll - 2 until listScroll + savesVisible + 2)
it.render(batch, camera) it.render(frameDelta, batch, camera)
if (App.getConfigBoolean("fx_streamerslayout")) if (App.getConfigBoolean("fx_streamerslayout"))
it.posX -= uiXdiffChatOverlay it.posX -= uiXdiffChatOverlay
@@ -607,7 +607,7 @@ class UIItemPlayerCells(
private val avatarViewWidth = 120 private val avatarViewWidth = 120
fun render(batch: SpriteBatch, camera: OrthographicCamera, offX: Int, offY: Int) { fun render(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera, offX: Int, offY: Int) {
// try to generate a texture // try to generate a texture
if (!hasTexture) { acquirePlayerAvatar(); hasTexture = true } if (!hasTexture) { acquirePlayerAvatar(); hasTexture = true }
@@ -677,8 +677,8 @@ class UIItemPlayerCells(
} }
} }
override fun render(batch: SpriteBatch, camera: OrthographicCamera) { override fun render(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera) {
render(batch, camera, 0, 0) render(frameDelta, batch, camera, 0, 0)
} }
private fun acquirePlayerAvatar() { private fun acquirePlayerAvatar() {
@@ -846,7 +846,7 @@ class UIItemWorldCells(
highlightCol = if (mouseUp) Toolkit.Theme.COL_MOUSE_UP else Toolkit.Theme.COL_LIST_DEFAULT highlightCol = if (mouseUp) Toolkit.Theme.COL_MOUSE_UP else Toolkit.Theme.COL_LIST_DEFAULT
} }
override fun render(batch: SpriteBatch, camera: OrthographicCamera) { override fun render(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera) {
// try to generate a texture // try to generate a texture
if (skimmer.initialised && !hasTexture) { if (skimmer.initialised && !hasTexture) {
// load thumbnail or use stock if the file is not there // load thumbnail or use stock if the file is not there
@@ -904,7 +904,7 @@ class UIItemWorldCells(
if (saveDamaged) batch.color = colourBad if (saveDamaged) batch.color = colourBad
App.fontGame.draw(batch, saveName, x + 3f, y + -1f) App.fontGame.draw(batch, saveName, x + 3f, y + -1f)
super.render(batch, camera) super.render(frameDelta, batch, camera)
batch.color = Color.WHITE batch.color = Color.WHITE
} }

View File

@@ -171,7 +171,7 @@ class UILoadList(val full: UILoadSavegame) : UICanvas() {
} }
} }
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) { override fun renderUI(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera) {
batch.end() batch.end()
val cells = playerCells val cells = playerCells
@@ -190,7 +190,7 @@ class UILoadList(val full: UILoadSavegame) : UICanvas() {
it.posX += uiXdiffChatOverlay it.posX += uiXdiffChatOverlay
if (index in listScroll - 2 until listScroll + savesVisible + 2) if (index in listScroll - 2 until listScroll + savesVisible + 2)
it.render(batch, camera) it.render(frameDelta, batch, camera)
if (App.getConfigBoolean("fx_streamerslayout")) if (App.getConfigBoolean("fx_streamerslayout"))
it.posX -= uiXdiffChatOverlay it.posX -= uiXdiffChatOverlay

View File

@@ -344,15 +344,15 @@ class UILoadManage(val full: UILoadSavegame) : UICanvas() {
private val icons = CommonResourcePool.getAsTextureRegionPack("inventory_category") private val icons = CommonResourcePool.getAsTextureRegionPack("inventory_category")
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) { override fun renderUI(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera) {
if (mode != MODE_SHOW_LOAD_ORDER) { if (mode != MODE_SHOW_LOAD_ORDER) {
val buttonYdelta = (full.titleTopGradEnd) - full.playerButtonSelected!!.posY val buttonYdelta = (full.titleTopGradEnd) - full.playerButtonSelected!!.posY
full.playerButtonSelected!!.render(batch, camera, 0, buttonYdelta) full.playerButtonSelected!!.render(frameDelta, batch, camera, 0, buttonYdelta)
} }
when (mode) { when (mode) {
MODE_INIT -> { MODE_INIT -> {
mainButtons.forEach { it.render(batch, camera) } mainButtons.forEach { it.render(frameDelta, batch, camera) }
// draw thumbnails of the most recent game // draw thumbnails of the most recent game
// val tex = screencap ?: CommonResourcePool.getAsTextureRegion("terrarum-defaultsavegamethumb") // val tex = screencap ?: CommonResourcePool.getAsTextureRegion("terrarum-defaultsavegamethumb")
@@ -378,11 +378,11 @@ class UILoadManage(val full: UILoadSavegame) : UICanvas() {
Toolkit.drawTextCentered(batch, App.fontGame, Lang["MENU_LABEL_SAVE_WILL_BE_DELETED"], Toolkit.drawWidth, 0, full.titleTopGradEnd + full.cellInterval + SAVE_CELL_HEIGHT + 36) Toolkit.drawTextCentered(batch, App.fontGame, Lang["MENU_LABEL_SAVE_WILL_BE_DELETED"], Toolkit.drawWidth, 0, full.titleTopGradEnd + full.cellInterval + SAVE_CELL_HEIGHT + 36)
Toolkit.drawTextCentered(batch, App.fontGame, Lang["MENU_LABEL_ARE_YOU_SURE"], Toolkit.drawWidth, 0, full.titleTopGradEnd + full.cellInterval + SAVE_CELL_HEIGHT + 36 + 24) Toolkit.drawTextCentered(batch, App.fontGame, Lang["MENU_LABEL_ARE_YOU_SURE"], Toolkit.drawWidth, 0, full.titleTopGradEnd + full.cellInterval + SAVE_CELL_HEIGHT + 36 + 24)
delButtons.forEach { it.render(batch, camera) } delButtons.forEach { it.render(frameDelta, batch, camera) }
} }
MODE_RENAME -> { MODE_RENAME -> {
renameInput.render(batch, camera) renameInput.render(frameDelta, batch, camera)
renameButtons.forEach { it.render(batch, camera) } renameButtons.forEach { it.render(frameDelta, batch, camera) }
} }
MODE_LOAD -> { MODE_LOAD -> {
loadFiredFrameCounter += 1 loadFiredFrameCounter += 1
@@ -417,7 +417,7 @@ class UILoadManage(val full: UILoadSavegame) : UICanvas() {
App.fontGame.draw(batch, s, wx64, modulesBoxBaseY + 32 + App.fontGame.lineHeight.toInt() * index) App.fontGame.draw(batch, s, wx64, modulesBoxBaseY + 32 + App.fontGame.lineHeight.toInt() * index)
} }
modulesBackButton.render(batch, camera) modulesBackButton.render(frameDelta, batch, camera)
} }
MODE_PREV_SAVES -> { MODE_PREV_SAVES -> {
val modulesBoxBaseY2 = full.titleTopGradEnd + SAVE_CELL_HEIGHT + listGap + 4 val modulesBoxBaseY2 = full.titleTopGradEnd + SAVE_CELL_HEIGHT + listGap + 4
@@ -449,7 +449,7 @@ class UILoadManage(val full: UILoadSavegame) : UICanvas() {
} }
} }
modulesBackButton.render(batch, camera) modulesBackButton.render(frameDelta, batch, camera)
} }
} }
} }

View File

@@ -22,7 +22,7 @@ class UILoadNewCharacter(val full: UILoadSavegame) : UICanvas() {
TODO("Not yet implemented") TODO("Not yet implemented")
} }
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) { override fun renderUI(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera) {
TODO("Not yet implemented") TODO("Not yet implemented")
} }

View File

@@ -147,8 +147,8 @@ class UILoadSavegame(val remoCon: UIRemoCon) : Advanceable() {
transitionPanel.update(delta) transitionPanel.update(delta)
} }
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) { override fun renderUI(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera) {
transitionPanel.render(batch, camera) transitionPanel.render(frameDelta, batch, camera)
} }
override fun inputStrobed(e: TerrarumKeyboardEvent) { override fun inputStrobed(e: TerrarumKeyboardEvent) {

View File

@@ -126,7 +126,7 @@ class UINewCharacter(val remoCon: UIRemoCon) : UICanvas() {
} }
} }
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) { override fun renderUI(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera) {
batch.color = Color.WHITE batch.color = Color.WHITE
// ui title // ui title
// val titlestr = Lang["CONTEXT_WORLD_NEW"] // val titlestr = Lang["CONTEXT_WORLD_NEW"]
@@ -136,7 +136,7 @@ class UINewCharacter(val remoCon: UIRemoCon) : UICanvas() {
// name/seed input labels // name/seed input labels
App.fontGame.draw(batch, Lang["MENU_NAME"], drawX, drawY + row1) App.fontGame.draw(batch, Lang["MENU_NAME"], drawX, drawY + row1)
uiItems.forEach { it.render(batch, camera) } uiItems.forEach { it.render(frameDelta, batch, camera) }
} }
override fun dispose() { override fun dispose() {

View File

@@ -272,7 +272,7 @@ class UINewWorld(val remoCon: UIRemoCon) : UICanvas() {
uiItems.forEach { it.update(delta) } uiItems.forEach { it.update(delta) }
} }
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) { override fun renderUI(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera) {
batch.color = Color.WHITE batch.color = Color.WHITE
// ui title // ui title
// val titlestr = Lang["CONTEXT_WORLD_NEW"] // val titlestr = Lang["CONTEXT_WORLD_NEW"]
@@ -322,7 +322,7 @@ class UINewWorld(val remoCon: UIRemoCon) : UICanvas() {
} }
} }
uiItems.forEach { it.render(batch, camera) } uiItems.forEach { it.render(frameDelta, batch, camera) }
} }
override fun dispose() { override fun dispose() {

View File

@@ -69,7 +69,7 @@ class UIPaletteSelector(val parent: BuildingMaker) : UICanvas() {
} }
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) { override fun renderUI(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera) {
// draw title bar // draw title bar
batch.color = UINSMenu.DEFAULT_TITLEBACKCOL batch.color = UINSMenu.DEFAULT_TITLEBACKCOL
blendNormalStraightAlpha(batch) blendNormalStraightAlpha(batch)

View File

@@ -41,9 +41,9 @@ class UIPerformanceControlPanel(remoCon: UIRemoCon?) : UICanvas() {
uiItems.forEach { it.update(delta) } uiItems.forEach { it.update(delta) }
} }
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) { override fun renderUI(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera) {
ControlPanelCommon.render("basegame.performancecontrolpanel", width, batch) ControlPanelCommon.render("basegame.performancecontrolpanel", width, batch)
uiItems.forEach { it.render(batch, camera) } uiItems.forEach { it.render(frameDelta, batch, camera) }
} }
override fun dispose() { override fun dispose() {

View File

@@ -18,7 +18,7 @@ class UIProxyLoadLatestSave(val remoCon: UIRemoCon) : UICanvas() {
override fun updateUI(delta: Float) { override fun updateUI(delta: Float) {
} }
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) { override fun renderUI(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera) {
} }
override fun doOpening(delta: Float) { override fun doOpening(delta: Float) {

View File

@@ -22,7 +22,7 @@ class UIProxyNewBuildingMaker(val remoCon: UIRemoCon) : UICanvas() {
override fun updateUI(delta: Float) { override fun updateUI(delta: Float) {
} }
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) { override fun renderUI(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera) {
} }
override fun doOpening(delta: Float) { override fun doOpening(delta: Float) {

View File

@@ -25,7 +25,7 @@ class UIProxyNewRandomGame(val remoCon: UIRemoCon) : UICanvas() {
override fun updateUI(delta: Float) { override fun updateUI(delta: Float) {
} }
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) { override fun renderUI(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera) {
} }
override fun doOpening(delta: Float) { override fun doOpening(delta: Float) {

View File

@@ -87,7 +87,7 @@ class UIQuickslotBar : UICanvas() {
private val itemCntTextCol = Color(0x404040ff) private val itemCntTextCol = Color(0x404040ff)
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) { override fun renderUI(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera) {
(Terrarum.ingame!! as TerrarumIngame).actorNowPlaying?.let { actor -> (Terrarum.ingame!! as TerrarumIngame).actorNowPlaying?.let { actor ->
for (i in 0 until SLOT_COUNT) { for (i in 0 until SLOT_COUNT) {

View File

@@ -69,7 +69,7 @@ class UIQuickslotPie : UICanvas() {
private val drawColor = Color(1f, 1f, 1f, 1f) private val drawColor = Color(1f, 1f, 1f, 1f)
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) { override fun renderUI(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera) {
// draw radial thingies // draw radial thingies
for (i in 0 until slotCount) { for (i in 0 until slotCount) {
val qs = (Terrarum.ingame!! as TerrarumIngame).actorNowPlaying?.inventory?.getQuickslotItem(i) val qs = (Terrarum.ingame!! as TerrarumIngame).actorNowPlaying?.inventory?.getQuickslotItem(i)

View File

@@ -220,9 +220,9 @@ open class UIRemoCon(val parent: TitleScreen, val treeRoot: QNDTreeNode<String>)
openUI = external openUI = external
} }
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) { override fun renderUI(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera) {
remoConTray.render(batch, camera) remoConTray.render(frameDelta, batch, camera)
openUI?.render(batch, camera) openUI?.render(frameDelta, batch, camera)
} }
override fun doOpening(delta: Float) { override fun doOpening(delta: Float) {
@@ -314,8 +314,8 @@ open class UIRemoCon(val parent: TitleScreen, val treeRoot: QNDTreeNode<String>)
menubar.update(delta) menubar.update(delta)
} }
fun render(batch: SpriteBatch, camera: OrthographicCamera) { fun render(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera) {
menubar.render(batch, camera) menubar.render(frameDelta, batch, camera)
} }
// nullifies currently selected item // nullifies currently selected item

View File

@@ -45,7 +45,7 @@ class UIScreenZoom : UICanvas(
override fun updateUI(delta: Float) { override fun updateUI(delta: Float) {
} }
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) { override fun renderUI(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera) {
batch.color = Color.WHITE batch.color = Color.WHITE
val offX = (App.scr.tvSafeGraphicsWidth * 1.25f).roundToInt().toFloat() val offX = (App.scr.tvSafeGraphicsWidth * 1.25f).roundToInt().toFloat()

View File

@@ -42,7 +42,7 @@ class UIShare : UICanvas() {
private lateinit var wotKeys: List<String> private lateinit var wotKeys: List<String>
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) { override fun renderUI(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera) {
batch.color = Color.WHITE batch.color = Color.WHITE
val textY = drawY + (height/2) - App.fontGame.lineHeight.toInt() * 4 - 2 val textY = drawY + (height/2) - App.fontGame.lineHeight.toInt() * 4 - 2
@@ -68,7 +68,7 @@ class UIShare : UICanvas() {
} }
uiItems.forEach { it.render(batch, camera) } uiItems.forEach { it.render(frameDelta, batch, camera) }
} }

View File

@@ -41,9 +41,9 @@ class UISoundControlPanel(remoCon: UIRemoCon?) : UICanvas() {
uiItems.forEach { it.update(delta) } uiItems.forEach { it.update(delta) }
} }
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) { override fun renderUI(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera) {
ControlPanelCommon.render("basegame.soundcontrolpanel", width, batch) ControlPanelCommon.render("basegame.soundcontrolpanel", width, batch)
uiItems.forEach { it.render(batch, camera) } uiItems.forEach { it.render(frameDelta, batch, camera) }
} }
override fun dispose() { override fun dispose() {

View File

@@ -180,16 +180,16 @@ internal class UIStorageChest : UICanvas(
else else
"${App.gamepadLabelStart} ${Lang["GAME_ACTION_CLOSE"]} " "${App.gamepadLabelStart} ${Lang["GAME_ACTION_CLOSE"]} "
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) { override fun renderUI(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera) {
// background fill // background fill
UIInventoryFull.drawBackground(batch, 1f) UIInventoryFull.drawBackground(batch, 1f)
// UI items // UI items
batch.color = Color.WHITE batch.color = Color.WHITE
catBar.render(batch, camera) catBar.render(frameDelta, batch, camera)
itemListChest.render(batch, camera) itemListChest.render(frameDelta, batch, camera)
itemListPlayer.render(batch, camera) itemListPlayer.render(frameDelta, batch, camera)
blendNormalStraightAlpha(batch) blendNormalStraightAlpha(batch)

View File

@@ -110,11 +110,11 @@ class UITitleLanguage(remoCon: UIRemoCon?) : UICanvas() {
} }
} }
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) { override fun renderUI(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera) {
batch.color = Color.WHITE batch.color = Color.WHITE
textArea1.render(batch, camera) textArea1.render(frameDelta, batch, camera)
textArea2.render(batch, camera) textArea2.render(frameDelta, batch, camera)
} }
override fun show() { override fun show() {

View File

@@ -138,7 +138,7 @@ class UITitleModules(val remoCon: UIRemoCon) : UICanvas() {
moduleCells.clear() moduleCells.clear()
} }
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) { override fun renderUI(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera) {
batch.end() batch.end()
lateinit var savePixmap: Pixmap lateinit var savePixmap: Pixmap
@@ -151,7 +151,7 @@ class UITitleModules(val remoCon: UIRemoCon) : UICanvas() {
for (index in 0 until moduleCells.size) { for (index in 0 until moduleCells.size) {
val it = moduleCells[index] val it = moduleCells[index]
if (index in listScroll - 2 until listScroll + savesVisible + 2) { if (index in listScroll - 2 until listScroll + savesVisible + 2) {
it.render(batch, camera) it.render(frameDelta, batch, camera)
} }
} }
} }

View File

@@ -124,8 +124,8 @@ package net.torvald.terrarum.modulebasegame.ui
//println("UITitleRemoConRoot bro u even updatez") //println("UITitleRemoConRoot bro u even updatez")
} }
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) { override fun renderUI(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera) {
menubar.render(batch, camera) menubar.render(frameDelta, batch, camera)
} }
override fun doOpening(delta: Float) { override fun doOpening(delta: Float) {

View File

@@ -49,10 +49,10 @@ open class UITitleWallOfText(private val text: List<String>) : UICanvas() {
scrollbar?.update(delta) scrollbar?.update(delta)
} }
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) { override fun renderUI(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera) {
batch.color = Color.WHITE batch.color = Color.WHITE
textArea.render(batch, camera) textArea.render(frameDelta, batch, camera)
scrollbar?.render(batch, camera) scrollbar?.render(frameDelta, batch, camera)
//AppLoader.printdbg(this, "Rendering texts of length ${text.size}") //AppLoader.printdbg(this, "Rendering texts of length ${text.size}")
} }
@@ -120,7 +120,7 @@ class UISystemInfo(val remoCon: UIRemoCon) : UICanvas() {
uptime = App.getTIME_T() - App.startupTime uptime = App.getTIME_T() - App.startupTime
} }
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) { override fun renderUI(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera) {
var i = 0 var i = 0
v.forEach { (k, v0) -> v.forEach { (k, v0) ->

View File

@@ -48,7 +48,7 @@ class UITooltip : UICanvas() {
get() = 36 * 2 + font.lineHeight.toInt() get() = 36 * 2 + font.lineHeight.toInt()
set(value) { throw Error("You are not supposed to set the height of the tooltip manually.") } set(value) { throw Error("You are not supposed to set the height of the tooltip manually.") }
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) { override fun renderUI(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera) {
val mouseXoff = 28f val mouseXoff = 28f
val mouseYoff = 0f val mouseYoff = 0f
val txtW = msgWidth + 2f * textMarginX val txtW = msgWidth + 2f * textMarginX

View File

@@ -63,7 +63,7 @@ class UIVitalMetre(
/** /**
* g must be same as World Graphics! * g must be same as World Graphics!
*/ */
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) { override fun renderUI(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera) {
// TODO now that we just can't draw arcs, we need to re-think about this // TODO now that we just can't draw arcs, we need to re-think about this
/*if (vitalGetterVal() != null && vitalGetterMax() != null && player != null) { /*if (vitalGetterVal() != null && vitalGetterMax() != null && player != null) {

View File

@@ -79,7 +79,7 @@ class UIWallCalendar : UICanvas(
} }
} }
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) { override fun renderUI(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera) {
UIInventoryFull.drawBackground(batch, 1f) UIInventoryFull.drawBackground(batch, 1f)
val thisYear = INGAME.world.worldTime.years val thisYear = INGAME.world.worldTime.years

View File

@@ -49,7 +49,7 @@ class UIWatchLargeAnalogue() : UICanvas() {
private val TWO_PI = 2.0 * Math.PI private val TWO_PI = 2.0 * Math.PI
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) { override fun renderUI(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera) {
TerrarumIngame.setCameraPosition(batch, App.shapeRender, camera, posX.toFloat(), posY.toFloat()) TerrarumIngame.setCameraPosition(batch, App.shapeRender, camera, posX.toFloat(), posY.toFloat())
val day = INGAME.world.worldTime.calendarDay - 1 val day = INGAME.world.worldTime.calendarDay - 1

View File

@@ -69,7 +69,7 @@ class UIWatchLargeDigital() : UICanvas() {
} }
} }
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) { override fun renderUI(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera) {
// disabling light button // disabling light button
batch.color = Color.WHITE batch.color = Color.WHITE
batch.draw(watchface, -1f, -1f) batch.draw(watchface, -1f, -1f)

View File

@@ -119,11 +119,11 @@ class UIWorldPortal : UICanvas(
transitionPanel.update(delta) transitionPanel.update(delta)
} }
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) { override fun renderUI(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera) {
drawBackground(batch, 1f) drawBackground(batch, 1f)
// UI items // UI items
transitionPanel.render(batch, camera) transitionPanel.render(frameDelta, batch, camera)
} }
internal fun addWorldToPlayersDict(uuid: UUID) { internal fun addWorldToPlayersDict(uuid: UUID) {
@@ -280,11 +280,11 @@ class UIItemWorldPortalTopBar(
} }
} }
override fun render(batch: SpriteBatch, camera: OrthographicCamera) { override fun render(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera) {
super.render(batch, camera) super.render(frameDelta, batch, camera)
// button // button
/*buttons.forEach { it.render(batch, camera) } /*buttons.forEach { it.render(frameDelta, batch, camera) }
// label // label
batch.color = Color.WHITE batch.color = Color.WHITE

View File

@@ -172,16 +172,16 @@ class UIWorldPortalCargo(val full: UIWorldPortal) : UICanvas(), HasInventory {
else else
"${App.gamepadLabelStart} ${Lang["GAME_ACTION_CLOSE"]} " "${App.gamepadLabelStart} ${Lang["GAME_ACTION_CLOSE"]} "
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) { override fun renderUI(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera) {
// background fill // background fill
UIInventoryFull.drawBackground(batch, 1f) UIInventoryFull.drawBackground(batch, 1f)
// UI items // UI items
batch.color = Color.WHITE batch.color = Color.WHITE
catBar.render(batch, camera) catBar.render(frameDelta, batch, camera)
itemListChest.render(batch, camera) itemListChest.render(frameDelta, batch, camera)
itemListPlayer.render(batch, camera) itemListPlayer.render(frameDelta, batch, camera)
blendNormalStraightAlpha(batch) blendNormalStraightAlpha(batch)

View File

@@ -45,14 +45,14 @@ class UIWorldPortalDelete(private val full: UIWorldPortal) : UICanvas() {
} }
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) { override fun renderUI(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera) {
full.selectedButton?.let { full.selectedButton?.let {
val buttonYdelta = (App.scr.tvSafeGraphicsHeight + 172 + 36) - it.posY val buttonYdelta = (App.scr.tvSafeGraphicsHeight + 172 + 36) - it.posY
val buttonXdelta = (Toolkit.drawWidth - it.width) / 2 - it.posX val buttonXdelta = (Toolkit.drawWidth - it.width) / 2 - it.posX
it.render(batch, camera, buttonXdelta, buttonYdelta) it.render(frameDelta, batch, camera, buttonXdelta, buttonYdelta)
} }
uiItems.forEach { it.render(batch, camera) } uiItems.forEach { it.render(frameDelta, batch, camera) }
batch.color = Color.WHITE batch.color = Color.WHITE
// ui title // ui title

View File

@@ -389,7 +389,7 @@ class UIWorldPortalListing(val full: UIWorldPortal) : UICanvas() {
private var selectedWorldThumb: TextureRegion? = null private var selectedWorldThumb: TextureRegion? = null
val icons = CommonResourcePool.getAsTextureRegionPack("terrarum-basegame-worldportalicons") val icons = CommonResourcePool.getAsTextureRegionPack("terrarum-basegame-worldportalicons")
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) { override fun renderUI(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera) {
val memoryGaugeXpos = hx - memoryGaugeWidth - gridGap/2 val memoryGaugeXpos = hx - memoryGaugeWidth - gridGap/2
val memoryGaugeYpos = y + listHeight - buttonHeight val memoryGaugeYpos = y + listHeight - buttonHeight
val textXpos = memoryGaugeXpos + 3 val textXpos = memoryGaugeXpos + 3
@@ -454,8 +454,8 @@ class UIWorldPortalListing(val full: UIWorldPortal) : UICanvas() {
} }
uiItems.forEach { it.render(batch, camera) } uiItems.forEach { it.render(frameDelta, batch, camera) }
if (::worldCells.isInitialized) worldCells.forEach { it.render(batch, camera) } if (::worldCells.isInitialized) worldCells.forEach { it.render(frameDelta, batch, camera) }
// control hints // control hints
batch.color = Color.WHITE batch.color = Color.WHITE
@@ -565,8 +565,8 @@ class UIItemWorldCellsSimple(
super.update(delta) super.update(delta)
} }
fun render(batch: SpriteBatch, camera: OrthographicCamera, offX: Int, offY: Int) { fun render(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera, offX: Int, offY: Int) {
super.render(batch, camera) super.render(frameDelta, batch, camera)
val posX = posX + offX val posX = posX + offX
val posY = posY + offY val posY = posY + offY
@@ -597,8 +597,8 @@ class UIItemWorldCellsSimple(
} }
override fun render(batch: SpriteBatch, camera: OrthographicCamera) { override fun render(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera) {
render(batch, camera, 0, 0) render(frameDelta, batch, camera, 0, 0)
} }
override fun scrolled(amountX: Float, amountY: Float): Boolean { override fun scrolled(amountX: Float, amountY: Float): Boolean {

View File

@@ -64,7 +64,7 @@ class UIWorldPortalRename(private val full: UIWorldPortal) : UICanvas() {
private var oldPosX = full.posX private var oldPosX = full.posX
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) { override fun renderUI(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera) {
val posXDelta = posX - oldPosX val posXDelta = posX - oldPosX
// ugh why won't you just scroll along?? // ugh why won't you just scroll along??
@@ -78,14 +78,14 @@ class UIWorldPortalRename(private val full: UIWorldPortal) : UICanvas() {
full.selectedButton?.let { full.selectedButton?.let {
val buttonYdelta = (App.scr.tvSafeGraphicsHeight + 172 + 36) - it.posY val buttonYdelta = (App.scr.tvSafeGraphicsHeight + 172 + 36) - it.posY
val buttonXdelta = (Toolkit.drawWidth - it.width) / 2 - it.posX val buttonXdelta = (Toolkit.drawWidth - it.width) / 2 - it.posX
it.render(batch, camera, buttonXdelta, buttonYdelta) it.render(frameDelta, batch, camera, buttonXdelta, buttonYdelta)
} }
// control hints // control hints
batch.color = Color.WHITE batch.color = Color.WHITE
App.fontGame.draw(batch, full.portalListingControlHelp, (Toolkit.drawWidth - width)/2 + 2, (full.yEnd - 20).toInt()) App.fontGame.draw(batch, full.portalListingControlHelp, (Toolkit.drawWidth - width)/2 + 2, (full.yEnd - 20).toInt())
uiItems.forEach { it.render(batch, camera) } uiItems.forEach { it.render(frameDelta, batch, camera) }
oldPosX = posX oldPosX = posX
} }

View File

@@ -159,7 +159,7 @@ class UIWorldPortalSearch(val full: UIWorldPortal) : UICanvas() {
val icons = CommonResourcePool.getAsTextureRegionPack("terrarum-basegame-worldportalicons") val icons = CommonResourcePool.getAsTextureRegionPack("terrarum-basegame-worldportalicons")
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) { override fun renderUI(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera) {
val memoryGaugeXpos = hx - memoryGaugeWidth/2 val memoryGaugeXpos = hx - memoryGaugeWidth/2
val memoryGaugeYpos = drawY + sizeSelY + buttonHeight + 10 val memoryGaugeYpos = drawY + sizeSelY + buttonHeight + 10
val textXpos = memoryGaugeXpos + 3 val textXpos = memoryGaugeXpos + 3
@@ -233,7 +233,7 @@ class UIWorldPortalSearch(val full: UIWorldPortal) : UICanvas() {
batch.color = Color.WHITE batch.color = Color.WHITE
App.fontGame.draw(batch, full.portalListingControlHelp, 2 + (Toolkit.drawWidth - 560)/2 + 2, (full.yEnd - 20).toInt()) App.fontGame.draw(batch, full.portalListingControlHelp, 2 + (Toolkit.drawWidth - 560)/2 + 2, (full.yEnd - 20).toInt())
uiItems.forEach { it.render(batch, camera) } uiItems.forEach { it.render(frameDelta, batch, camera) }
oldPosX = posX oldPosX = posX
} }

View File

@@ -60,7 +60,7 @@ class UIWorldPortalShare(private val full: UIWorldPortal) : UICanvas() {
private lateinit var wotKeys: List<String> private lateinit var wotKeys: List<String>
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) { override fun renderUI(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera) {
batch.color = Color.WHITE batch.color = Color.WHITE
val textY = drawY + (height/2) - App.fontGame.lineHeight.toInt() * 4 - 2 val textY = drawY + (height/2) - App.fontGame.lineHeight.toInt() * 4 - 2
@@ -93,7 +93,7 @@ class UIWorldPortalShare(private val full: UIWorldPortal) : UICanvas() {
// control hints // control hints
App.fontGame.draw(batch, full.portalListingControlHelp, (Toolkit.drawWidth - width)/2 + 2, (full.yEnd - 20).toInt()) App.fontGame.draw(batch, full.portalListingControlHelp, (Toolkit.drawWidth - width)/2 + 2, (full.yEnd - 20).toInt())
uiItems.forEach { it.render(batch, camera) } uiItems.forEach { it.render(frameDelta, batch, camera) }
} }

View File

@@ -112,7 +112,7 @@ class UIWorldPortalUseInvitation(val full: UIWorldPortal) : UICanvas() {
uiItems.forEach { it.update(delta) } uiItems.forEach { it.update(delta) }
} }
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) { override fun renderUI(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera) {
// error messages // error messages
if (importReturnCode != 0) { if (importReturnCode != 0) {
batch.color = Toolkit.Theme.COL_RED batch.color = Toolkit.Theme.COL_RED
@@ -128,7 +128,7 @@ class UIWorldPortalUseInvitation(val full: UIWorldPortal) : UICanvas() {
// control hints // control hints
App.fontGame.draw(batch, full.portalListingControlHelp, 2 + (Toolkit.drawWidth - 560)/2 + 2, (full.yEnd - 20).toInt()) App.fontGame.draw(batch, full.portalListingControlHelp, 2 + (Toolkit.drawWidth - 560)/2 + 2, (full.yEnd - 20).toInt())
uiItems.forEach { it.render(batch, camera) } uiItems.forEach { it.render(frameDelta, batch, camera) }
} }
override fun dispose() { override fun dispose() {

View File

@@ -87,7 +87,7 @@ class UIElemTest : ApplicationAdapter() {
gdxClearAndEnableBlend(0.1f, 0.1f, 0.1f, 1f) gdxClearAndEnableBlend(0.1f, 0.1f, 0.1f, 1f)
ui.update(Gdx.graphics.deltaTime) ui.update(Gdx.graphics.deltaTime)
ui.render(batch, camera) ui.render(Gdx.graphics.deltaTime, batch, camera)
Gdx.graphics.setTitle("Terrarum UIElemTest $EMDASH F: ${Gdx.graphics.framesPerSecond}") Gdx.graphics.setTitle("Terrarum UIElemTest $EMDASH F: ${Gdx.graphics.framesPerSecond}")
} }
@@ -122,13 +122,13 @@ class DummyTogglePane : UICanvas() {
uiItems.forEach { it.update(delta) } uiItems.forEach { it.update(delta) }
} }
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) { override fun renderUI(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera) {
batch.inUse { batch.inUse {
batch.color = Color.CORAL batch.color = Color.CORAL
Toolkit.fillArea(batch, 0f, 0f, 800f, 600f) Toolkit.fillArea(batch, 0f, 0f, 800f, 600f)
batch.color = Color.WHITE batch.color = Color.WHITE
uiItems.forEach { it.render(batch, camera) } uiItems.forEach { it.render(frameDelta, batch, camera) }
} }
} }

View File

@@ -128,7 +128,7 @@ class BasicDebugInfoWindow : UICanvas() {
private val tileCursX = 0; private val tileCursY = 4 private val tileCursX = 0; private val tileCursY = 4
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) { override fun renderUI(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera) {
TerrarumIngame.setCameraPosition(batch, App.shapeRender, camera, 0f, 0f) TerrarumIngame.setCameraPosition(batch, App.shapeRender, camera, 0f, 0f)
// toggle show-something // toggle show-something

View File

@@ -104,7 +104,7 @@ class ConsoleWindow : UICanvas() {
textinput.isEnabled = (isOpened && !isClosing) textinput.isEnabled = (isOpened && !isClosing)
} }
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) { override fun renderUI(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera) {
// background // background
batch.color = UIColour batch.color = UIColour
Toolkit.fillArea(batch, drawOffX, drawOffY, width.toFloat(), height.toFloat()) Toolkit.fillArea(batch, drawOffX, drawOffY, width.toFloat(), height.toFloat())
@@ -132,7 +132,7 @@ class ConsoleWindow : UICanvas() {
App.fontGame.draw(batch, message, 1f + drawOffX, (LINE_HEIGHT * (MESSAGES_DISPLAY_COUNT - i)).toFloat() + drawOffY + inputToMsgboxGap) App.fontGame.draw(batch, message, 1f + drawOffX, (LINE_HEIGHT * (MESSAGES_DISPLAY_COUNT - i)).toFloat() + drawOffY + inputToMsgboxGap)
} }
uiItems.forEach { it.render(batch, camera) } uiItems.forEach { it.render(frameDelta, batch, camera) }
} }
override fun inputStrobed(e: TerrarumKeyboardEvent) { override fun inputStrobed(e: TerrarumKeyboardEvent) {

View File

@@ -56,7 +56,7 @@ class UIAutosaveNotifier : UICanvas() {
} }
} }
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) { override fun renderUI(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera) {
val spin = spinner.get(spinnerFrame % 8, spinnerFrame / 8) val spin = spinner.get(spinnerFrame % 8, spinnerFrame / 8)
val offX = App.scr.width - WIDTH - (App.scr.tvSafeGraphicsWidth * 1.25f).roundToInt().toFloat() val offX = App.scr.width - WIDTH - (App.scr.tvSafeGraphicsWidth * 1.25f).roundToInt().toFloat()
val offY = App.scr.height - HEIGHT - App.scr.tvSafeGraphicsHeight - 9f // +9 to align to quickslot and watch UI val offY = App.scr.height - HEIGHT - App.scr.tvSafeGraphicsHeight - 9f // +9 to align to quickslot and watch UI

View File

@@ -120,8 +120,8 @@ abstract class UICanvas(
handler.update(this, delta) handler.update(this, delta)
} }
/** Called by the screen */ /** Called by the screen */
fun render(batch: SpriteBatch, camera: OrthographicCamera, parentOpacity: Float = 1f) { fun render(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera, parentOpacity: Float = 1f) {
handler.render(this, batch, camera, parentOpacity) handler.render(this, frameDelta, batch, camera, parentOpacity)
} }
@@ -156,7 +156,7 @@ abstract class UICanvas(
* The transparency of the handler is independent of the draw, you must set the drawing color yourself * The transparency of the handler is independent of the draw, you must set the drawing color yourself
* (use handler.opacity or handler.opacityColour) * (use handler.opacity or handler.opacityColour)
*/ */
abstract fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) abstract fun renderUI(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera)
/** /**
* Do not modify ui.handler.openCloseCounter here. * Do not modify ui.handler.openCloseCounter here.

View File

@@ -281,7 +281,7 @@ void main() {
subUIs.forEach { it.update(delta) } subUIs.forEach { it.update(delta) }
} }
fun render(ui: UICanvas, batch: SpriteBatch, camera: OrthographicCamera, parentOpacity: Float) { fun render(ui: UICanvas, frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera, parentOpacity: Float) {
if (isVisible) { if (isVisible) {
// camera SHOULD BE CENTERED to HALFX and HALFY (see StateInGame) // // camera SHOULD BE CENTERED to HALFX and HALFY (see StateInGame) //
@@ -301,7 +301,7 @@ void main() {
batch.shader = shader batch.shader = shader
shader.setUniformf("opacity", opacity * parentOpacity) shader.setUniformf("opacity", opacity * parentOpacity)
ui.renderUI(batch, camera) ui.renderUI(frameDelta, batch, camera)
//ingameGraphics.flush() //ingameGraphics.flush()
batch.shader = null batch.shader = null
@@ -313,7 +313,7 @@ void main() {
subUIs.forEach { subUIs.forEach {
it.render(batch, camera) it.render(frameDelta, batch, camera)
batch.color = Color.WHITE batch.color = Color.WHITE
} }

View File

@@ -177,13 +177,13 @@ abstract class UIItem(var parentUI: UICanvas, val initialX: Int, val initialY: I
/** /**
* In this time, you do write like: ```draw(posX + 4, posY + 32)```, unlike UICanvas, because posX/posY comes from the parent UI. * In this time, you do write like: ```draw(posX + 4, posY + 32)```, unlike UICanvas, because posX/posY comes from the parent UI.
*/ */
open fun render(batch: SpriteBatch, camera: OrthographicCamera) { open fun render(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera) {
if (parentUI.isVisible) { if (parentUI.isVisible) {
// if (isActive) { // if (isActive) {
mouseOverCall?.render(batch, camera) mouseOverCall?.render(frameDelta, batch, camera)
if (mouseUp) { if (mouseUp) {
mouseOverCall?.renderUI(batch, camera) mouseOverCall?.renderUI(frameDelta, batch, camera)
} }
// } // }
} }

View File

@@ -40,7 +40,7 @@ class UIItemConfigKeycap(
super.update(delta) super.update(delta)
} }
override fun render(batch: SpriteBatch, camera: OrthographicCamera) { override fun render(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera) {
// draw keycap // draw keycap
batch.draw(capTex.get(0, 0), posX.toFloat(), posY.toFloat()) batch.draw(capTex.get(0, 0), posX.toFloat(), posY.toFloat())
batch.draw(capTex.get(1, 0), (posX + capTex.tileW).toFloat(), posY.toFloat(), batch.draw(capTex.get(1, 0), (posX + capTex.tileW).toFloat(), posY.toFloat(),
@@ -54,7 +54,7 @@ class UIItemConfigKeycap(
// draw icon // draw icon
super.render(batch, camera) super.render(frameDelta, batch, camera)
} }
override fun dispose() { override fun dispose() {

View File

@@ -95,11 +95,11 @@ class UIItemHorzSlider(
private val renderOrderMouseUp = arrayOf(0,2,3,1).map { renderJobs[it] } private val renderOrderMouseUp = arrayOf(0,2,3,1).map { renderJobs[it] }
override fun render(batch: SpriteBatch, camera: OrthographicCamera) { override fun render(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera) {
blendNormalStraightAlpha(batch) blendNormalStraightAlpha(batch)
renderOrderMouseUp.forEach { it(batch) } renderOrderMouseUp.forEach { it(batch) }
super.render(batch, camera) super.render(frameDelta, batch, camera)
} }
override fun dispose() { override fun dispose() {

View File

@@ -54,7 +54,7 @@ open class UIItemImageButton(
var highlighted = false var highlighted = false
var extraDrawOp: (UIItem, SpriteBatch) -> Unit = { _,_ -> } var extraDrawOp: (UIItem, SpriteBatch) -> Unit = { _,_ -> }
fun render(batch: SpriteBatch, camera: OrthographicCamera, offX: Int, offY: Int) { fun render(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera, offX: Int, offY: Int) {
val posX = this.posX + offX val posX = this.posX + offX
val posY = this.posY + offY val posY = this.posY + offY
@@ -93,8 +93,8 @@ open class UIItemImageButton(
extraDrawOp(this, batch) extraDrawOp(this, batch)
} }
override fun render(batch: SpriteBatch, camera: OrthographicCamera) { override fun render(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera) {
render(batch, camera, 0, 0) render(frameDelta, batch, camera, 0, 0)
} }
override fun dispose() { override fun dispose() {

View File

@@ -24,7 +24,7 @@ class UIItemImageGallery(
override fun update(delta: Float) { override fun update(delta: Float) {
} }
override fun render(batch: SpriteBatch, camera: OrthographicCamera) { override fun render(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera) {
fun column(i: Int) = i % column fun column(i: Int) = i % column
fun row(i: Int) = i / column fun row(i: Int) = i / column

Some files were not shown because too many files have changed in this diff Show More