mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-07 12:21:52 +09:00
fix: jittery cam on titlescreen
This commit is contained in:
@@ -359,9 +359,6 @@ class BuildingMaker(batch: FlippingSpriteBatch) : IngameInstance(batch) {
|
||||
mouseOnUI = (overwriteMouseOnUI || uiPenMenu.isVisible /*|| uiPalette.isVisible*/ || uiGetPoiName.isVisible)
|
||||
|
||||
|
||||
WorldCamera.update(world, actorNowPlaying)
|
||||
|
||||
|
||||
// make pen work HERE
|
||||
// when LEFT mouse is down
|
||||
if (!tappedOnUI && Terrarum.mouseDown && !mouseOnUI) {
|
||||
@@ -457,6 +454,8 @@ class BuildingMaker(batch: FlippingSpriteBatch) : IngameInstance(batch) {
|
||||
private val renderGame = { delta: Float ->
|
||||
_testMarkerDrawCalls = 0L
|
||||
|
||||
WorldCamera.update(world, actorNowPlaying)
|
||||
|
||||
IngameRenderer.invoke(delta, false,
|
||||
screenZoom,
|
||||
listOf(),
|
||||
|
||||
@@ -328,9 +328,6 @@ class TitleScreen(batch: FlippingSpriteBatch) : IngameInstance(batch) {
|
||||
WeatherMixer.update(delta, cameraPlayer, demoWorld)
|
||||
cameraPlayer.update(delta)
|
||||
|
||||
// worldcamera update AFTER cameraplayer in this case; the other way is just an exception for actual ingame SFX
|
||||
WorldCamera.update(demoWorld, cameraPlayer)
|
||||
|
||||
// update UIs //
|
||||
uiContainer.forEach { it?.update(delta) }
|
||||
|
||||
@@ -369,6 +366,8 @@ class TitleScreen(batch: FlippingSpriteBatch) : IngameInstance(batch) {
|
||||
|
||||
|
||||
if (!demoWorld.layerTerrain.ptr.destroyed) { // FIXME q&d hack to circumvent the dangling pointer issue #26
|
||||
WorldCamera.update(demoWorld, cameraPlayer)
|
||||
|
||||
IngameRenderer.invoke(
|
||||
delta,
|
||||
false,
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user