mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-14 20:44:05 +09:00
vals instead of funs
This commit is contained in:
@@ -315,15 +315,16 @@ class BuildingMaker(batch: FlippingSpriteBatch) : IngameInstance(batch) {
|
|||||||
|
|
||||||
|
|
||||||
// ASYNCHRONOUS UPDATE AND RENDER //
|
// ASYNCHRONOUS UPDATE AND RENDER //
|
||||||
gameUpdateGovernor.update(Gdx.graphics.deltaTime, App.UPDATE_RATE, { dt -> updateGame(dt) }, { renderGame() })
|
gameUpdateGovernor.update(Gdx.graphics.deltaTime, App.UPDATE_RATE, updateGame, renderGame
|
||||||
|
)
|
||||||
App.setDebugTime("Ingame.Render - (Light + Tiling)",
|
App.setDebugTime("Ingame.Render - (Light + Tiling)",
|
||||||
((App.debugTimers["Ingame.Render"] as? Long) ?: 0) -
|
((App.debugTimers["Ingame.Render"]) ?: 0) -
|
||||||
(
|
(
|
||||||
((App.debugTimers["Renderer.Lanterns"] as? Long) ?: 0) +
|
((App.debugTimers["Renderer.Lanterns"]) ?: 0) +
|
||||||
((App.debugTimers["Renderer.LightPrecalc"] as? Long) ?: 0) +
|
((App.debugTimers["Renderer.LightPrecalc"]) ?: 0) +
|
||||||
((App.debugTimers["Renderer.LightRuns"] as? Long) ?: 0) +
|
((App.debugTimers["Renderer.LightRuns"]) ?: 0) +
|
||||||
((App.debugTimers["Renderer.LightToScreen"] as? Long) ?: 0) +
|
((App.debugTimers["Renderer.LightToScreen"]) ?: 0) +
|
||||||
((App.debugTimers["Renderer.Tiling"] as? Long) ?: 0)
|
((App.debugTimers["Renderer.Tiling"]) ?: 0)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -333,7 +334,7 @@ class BuildingMaker(batch: FlippingSpriteBatch) : IngameInstance(batch) {
|
|||||||
internal var tappedOnUI = false // when true, even if the UI is closed, pen won't work unless your pen is lifted
|
internal var tappedOnUI = false // when true, even if the UI is closed, pen won't work unless your pen is lifted
|
||||||
// must be set to TRUE by UIs
|
// must be set to TRUE by UIs
|
||||||
|
|
||||||
private fun updateGame(delta: Float) {
|
private val updateGame = { delta: Float ->
|
||||||
|
|
||||||
WeatherMixer.update(delta, actorNowPlaying, gameWorld)
|
WeatherMixer.update(delta, actorNowPlaying, gameWorld)
|
||||||
blockPointingCursor.update(delta)
|
blockPointingCursor.update(delta)
|
||||||
@@ -377,7 +378,7 @@ class BuildingMaker(batch: FlippingSpriteBatch) : IngameInstance(batch) {
|
|||||||
|
|
||||||
private val particles = CircularArray<ParticleBase>(16, true)
|
private val particles = CircularArray<ParticleBase>(16, true)
|
||||||
|
|
||||||
private fun renderGame() {
|
private val renderGame = { delta: Float ->
|
||||||
_testMarkerDrawCalls = 0L
|
_testMarkerDrawCalls = 0L
|
||||||
|
|
||||||
IngameRenderer.invoke(false,
|
IngameRenderer.invoke(false,
|
||||||
|
|||||||
@@ -719,7 +719,7 @@ open class TerrarumIngame(batch: FlippingSpriteBatch) : IngameInstance(batch) {
|
|||||||
val dt = Gdx.graphics.deltaTime
|
val dt = Gdx.graphics.deltaTime
|
||||||
autosaveTimer += dt
|
autosaveTimer += dt
|
||||||
|
|
||||||
gameUpdateGovernor.update(dt, App.UPDATE_RATE, { dt -> updateGame(dt) }, { renderGame() })
|
gameUpdateGovernor.update(dt, App.UPDATE_RATE, updateGame, renderGame)
|
||||||
|
|
||||||
|
|
||||||
val autosaveInterval = App.getConfigInt("autosaveinterval").coerceAtLeast(60000) / 1000f
|
val autosaveInterval = App.getConfigInt("autosaveinterval").coerceAtLeast(60000) / 1000f
|
||||||
@@ -739,7 +739,7 @@ open class TerrarumIngame(batch: FlippingSpriteBatch) : IngameInstance(batch) {
|
|||||||
/**
|
/**
|
||||||
* Ingame (world) related updates; UI update must go to renderGame()
|
* Ingame (world) related updates; UI update must go to renderGame()
|
||||||
*/
|
*/
|
||||||
protected fun updateGame(delta: Float) {
|
private val updateGame = { delta: Float ->
|
||||||
val world = this.world
|
val world = this.world
|
||||||
worldWidth = world.width.toDouble() * TILE_SIZE
|
worldWidth = world.width.toDouble() * TILE_SIZE
|
||||||
|
|
||||||
@@ -862,7 +862,7 @@ open class TerrarumIngame(batch: FlippingSpriteBatch) : IngameInstance(batch) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private fun renderGame() {
|
private val renderGame = { delta: Float ->
|
||||||
Gdx.graphics.setTitle(getCanonicalTitle())
|
Gdx.graphics.setTitle(getCanonicalTitle())
|
||||||
|
|
||||||
WorldCamera.update(world, actorNowPlaying)
|
WorldCamera.update(world, actorNowPlaying)
|
||||||
|
|||||||
@@ -250,10 +250,10 @@ class TitleScreen(batch: FlippingSpriteBatch) : IngameInstance(batch) {
|
|||||||
|
|
||||||
override fun render(updateRate: Float) {
|
override fun render(updateRate: Float) {
|
||||||
// async update and render
|
// async update and render
|
||||||
gameUpdateGovernor.update(Gdx.graphics.deltaTime, App.UPDATE_RATE, { dt -> updateScreen(dt) }, { renderScreen() })
|
gameUpdateGovernor.update(Gdx.graphics.deltaTime, App.UPDATE_RATE, updateScreen, renderScreen)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun updateScreen(delta: Float) {
|
private val updateScreen = { delta: Float ->
|
||||||
demoWorld.globalLight = WeatherMixer.globalLightNow
|
demoWorld.globalLight = WeatherMixer.globalLightNow
|
||||||
demoWorld.updateWorldTime(delta)
|
demoWorld.updateWorldTime(delta)
|
||||||
WeatherMixer.update(delta, cameraPlayer, demoWorld)
|
WeatherMixer.update(delta, cameraPlayer, demoWorld)
|
||||||
@@ -269,7 +269,7 @@ class TitleScreen(batch: FlippingSpriteBatch) : IngameInstance(batch) {
|
|||||||
|
|
||||||
private val particles = CircularArray<ParticleBase>(16, true)
|
private val particles = CircularArray<ParticleBase>(16, true)
|
||||||
|
|
||||||
fun renderScreen() {
|
private val renderScreen = { delta: Float ->
|
||||||
Gdx.graphics.setTitle(TerrarumIngame.getCanonicalTitle())
|
Gdx.graphics.setTitle(TerrarumIngame.getCanonicalTitle())
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user