mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-19 15:04:05 +09:00
module UI now has margin; game update will drop consecutive updates if its try count is exhausted (reduced lag after window move/resize)
This commit is contained in:
@@ -394,9 +394,15 @@ class Ingame(val batch: SpriteBatch) : Screen {
|
||||
///////////////
|
||||
private class ThreadIngameUpdate(val ingame: Ingame): Runnable {
|
||||
override fun run() {
|
||||
var updateTries = 0
|
||||
while (ingame.updateDeltaCounter >= ingame.updateRate) {
|
||||
ingame.updateGame(Terrarum.deltaTime)
|
||||
ingame.updateDeltaCounter -= ingame.updateRate
|
||||
updateTries++
|
||||
|
||||
if (updateTries >= Terrarum.UPDATE_CATCHUP_MAX_TRIES) {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -451,9 +457,15 @@ class Ingame(val batch: SpriteBatch) : Screen {
|
||||
// else, NOP;
|
||||
}
|
||||
else {
|
||||
var updateTries = 0
|
||||
while (updateDeltaCounter >= updateRate) {
|
||||
updateGame(delta)
|
||||
updateDeltaCounter -= updateRate
|
||||
updateTries++
|
||||
|
||||
if (updateTries >= Terrarum.UPDATE_CATCHUP_MAX_TRIES) {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user