fix: jittery cam on titlescreen

This commit is contained in:
minjaesong
2024-09-05 15:25:39 +09:00
parent eb3822553b
commit c17d742d68
4 changed files with 12 additions and 7 deletions

View File

@@ -1176,7 +1176,11 @@ internal object BlocksDrawer {
private val occlusionIntensity = 0.25f // too low value and dark-coloured walls won't darken enough
private val doTilemapUpdate: Boolean
get() = (!world.layerTerrain.ptrDestroyed && App.GLOBAL_RENDER_TIMER % 3 == 0L)
get() {
// TODO adaptive rate control via cam delta
val rate = 4
return (!world.layerTerrain.ptrDestroyed && App.GLOBAL_RENDER_TIMER % rate == 0L)
}
private var camTransX = 0
private var camTransY = 0

View File

@@ -79,6 +79,9 @@ object WorldCamera {
inline val camVector: com.badlogic.gdx.math.Vector2
get() = com.badlogic.gdx.math.Vector2(gdxCamX, gdxCamY)
/**
* Must be called on RENDER, not UPDATE, before the IngameRenderer invocation.
*/
fun update(world: GameWorld, player: ActorWithBody?) {
if (player == null) return