mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-15 21:14:04 +09:00
day-night cycle on the titlescreen
This commit is contained in:
@@ -171,7 +171,7 @@ class TitleScreen(batch: FlippingSpriteBatch) : IngameInstance(batch) {
|
|||||||
}
|
}
|
||||||
catch (e: IOException) {
|
catch (e: IOException) {
|
||||||
demoWorld = GameWorld(LandUtil.CHUNK_W, LandUtil.CHUNK_H, 0L, 0L)
|
demoWorld = GameWorld(LandUtil.CHUNK_W, LandUtil.CHUNK_H, 0L, 0L)
|
||||||
demoWorld.worldTime.timeDelta = 60
|
demoWorld.worldTime.timeDelta = 330
|
||||||
printdbg(this, "Demo world not found, using empty world")
|
printdbg(this, "Demo world not found, using empty world")
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -286,15 +286,14 @@ class TitleScreen(batch: FlippingSpriteBatch) : IngameInstance(batch) {
|
|||||||
gameUpdateGovernor.update(Gdx.graphics.deltaTime, App.UPDATE_RATE, updateScreen, renderScreen)
|
gameUpdateGovernor.update(Gdx.graphics.deltaTime, App.UPDATE_RATE, updateScreen, renderScreen)
|
||||||
}
|
}
|
||||||
|
|
||||||
private val updateScreen = { delta: Float ->
|
private var timeflowCounter = 32880 // 9h08m
|
||||||
// TODO: desynched weather and time-of-day change
|
|
||||||
|
private val updateScreen = { delta: Float ->
|
||||||
|
|
||||||
val forcedTime = 32880 // 9h08m
|
|
||||||
demoWorld.globalLight = WeatherMixer.globalLightNow
|
demoWorld.globalLight = WeatherMixer.globalLightNow
|
||||||
// demoWorld.globalLight = WeatherMixer.getGlobalLightOfTimeOfNoon()
|
|
||||||
demoWorld.updateWorldTime(delta)
|
demoWorld.updateWorldTime(delta)
|
||||||
WeatherMixer.update(delta, cameraPlayer, demoWorld)
|
WeatherMixer.update(delta, cameraPlayer, demoWorld)
|
||||||
WeatherMixer.forceTimeAt = forcedTime
|
WeatherMixer.forceTimeAt = timeflowCounter
|
||||||
cameraPlayer.update(delta)
|
cameraPlayer.update(delta)
|
||||||
|
|
||||||
// worldcamera update AFTER cameraplayer in this case; the other way is just an exception for actual ingame SFX
|
// worldcamera update AFTER cameraplayer in this case; the other way is just an exception for actual ingame SFX
|
||||||
@@ -302,6 +301,11 @@ class TitleScreen(batch: FlippingSpriteBatch) : IngameInstance(batch) {
|
|||||||
|
|
||||||
// update UIs //
|
// update UIs //
|
||||||
uiContainer.forEach { it?.update(delta) }
|
uiContainer.forEach { it?.update(delta) }
|
||||||
|
|
||||||
|
|
||||||
|
// desynched weather and time-of-day change
|
||||||
|
timeflowCounter += 30 // must be divisible by demoWorld.worldTime.timeDelta
|
||||||
|
if (timeflowCounter >= WorldTime.DAY_LENGTH) timeflowCounter -= WorldTime.DAY_LENGTH
|
||||||
}
|
}
|
||||||
|
|
||||||
private val particles = CircularArray<ParticleBase>(16, true)
|
private val particles = CircularArray<ParticleBase>(16, true)
|
||||||
|
|||||||
@@ -300,10 +300,9 @@ class BasicDebugInfoWindow : UICanvas() {
|
|||||||
if (ingame is TerrarumIngame) {
|
if (ingame is TerrarumIngame) {
|
||||||
App.fontSmallNumbers.draw(batch, "${ccM}Particles $ccG${(ingame as TerrarumIngame).particlesActive}$ccY/$ccG${(ingame as TerrarumIngame).PARTICLES_MAX}",
|
App.fontSmallNumbers.draw(batch, "${ccM}Particles $ccG${(ingame as TerrarumIngame).particlesActive}$ccY/$ccG${(ingame as TerrarumIngame).PARTICLES_MAX}",
|
||||||
TinyAlphNum.W * 2f, App.scr.height - TinyAlphNum.H * 4f)
|
TinyAlphNum.W * 2f, App.scr.height - TinyAlphNum.H * 4f)
|
||||||
App.fontSmallNumbers.draw(batch, "${ccM}Clouds $ccG${WeatherMixer.cloudsSpawned}$ccY/$ccG${WeatherMixer.cloudSpawnMax}",
|
|
||||||
TinyAlphNum.W * 2f + (18 * 8), App.scr.height - TinyAlphNum.H * 4f)
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
App.fontSmallNumbers.draw(batch, "${ccM}Clouds $ccG${WeatherMixer.cloudsSpawned}$ccY/$ccG${WeatherMixer.cloudSpawnMax}",
|
||||||
|
TinyAlphNum.W * 2f + (18 * 8), App.scr.height - TinyAlphNum.H * 4f)
|
||||||
}
|
}
|
||||||
|
|
||||||
App.fontSmallNumbers.draw(batch, "${ccY}Actors rendering $ccG${IngameRenderer.renderingActorsCount}",
|
App.fontSmallNumbers.draw(batch, "${ccY}Actors rendering $ccG${IngameRenderer.renderingActorsCount}",
|
||||||
|
|||||||
Reference in New Issue
Block a user