mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-10 18:44:05 +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)
|
mouseOnUI = (overwriteMouseOnUI || uiPenMenu.isVisible /*|| uiPalette.isVisible*/ || uiGetPoiName.isVisible)
|
||||||
|
|
||||||
|
|
||||||
WorldCamera.update(world, actorNowPlaying)
|
|
||||||
|
|
||||||
|
|
||||||
// make pen work HERE
|
// make pen work HERE
|
||||||
// when LEFT mouse is down
|
// when LEFT mouse is down
|
||||||
if (!tappedOnUI && Terrarum.mouseDown && !mouseOnUI) {
|
if (!tappedOnUI && Terrarum.mouseDown && !mouseOnUI) {
|
||||||
@@ -457,6 +454,8 @@ class BuildingMaker(batch: FlippingSpriteBatch) : IngameInstance(batch) {
|
|||||||
private val renderGame = { delta: Float ->
|
private val renderGame = { delta: Float ->
|
||||||
_testMarkerDrawCalls = 0L
|
_testMarkerDrawCalls = 0L
|
||||||
|
|
||||||
|
WorldCamera.update(world, actorNowPlaying)
|
||||||
|
|
||||||
IngameRenderer.invoke(delta, false,
|
IngameRenderer.invoke(delta, false,
|
||||||
screenZoom,
|
screenZoom,
|
||||||
listOf(),
|
listOf(),
|
||||||
|
|||||||
@@ -328,9 +328,6 @@ class TitleScreen(batch: FlippingSpriteBatch) : IngameInstance(batch) {
|
|||||||
WeatherMixer.update(delta, cameraPlayer, demoWorld)
|
WeatherMixer.update(delta, cameraPlayer, demoWorld)
|
||||||
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(demoWorld, cameraPlayer)
|
|
||||||
|
|
||||||
// update UIs //
|
// update UIs //
|
||||||
uiContainer.forEach { it?.update(delta) }
|
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
|
if (!demoWorld.layerTerrain.ptr.destroyed) { // FIXME q&d hack to circumvent the dangling pointer issue #26
|
||||||
|
WorldCamera.update(demoWorld, cameraPlayer)
|
||||||
|
|
||||||
IngameRenderer.invoke(
|
IngameRenderer.invoke(
|
||||||
delta,
|
delta,
|
||||||
false,
|
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 occlusionIntensity = 0.25f // too low value and dark-coloured walls won't darken enough
|
||||||
|
|
||||||
private val doTilemapUpdate: Boolean
|
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 camTransX = 0
|
||||||
private var camTransY = 0
|
private var camTransY = 0
|
||||||
|
|||||||
@@ -79,6 +79,9 @@ object WorldCamera {
|
|||||||
inline val camVector: com.badlogic.gdx.math.Vector2
|
inline val camVector: com.badlogic.gdx.math.Vector2
|
||||||
get() = com.badlogic.gdx.math.Vector2(gdxCamX, gdxCamY)
|
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?) {
|
fun update(world: GameWorld, player: ActorWithBody?) {
|
||||||
if (player == null) return
|
if (player == null) return
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user