mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-29 15:01:09 -04:00
Added initial setup of WorldScreen in worldscreen creation, so it doesn't take too long in the render, hopefully
This commit is contained in:
parent
d4ead7bbf2
commit
7d17265032
@ -93,6 +93,13 @@ class WorldScreen : CameraStageBaseScreen() {
|
|||||||
else -> Vector2.Zero
|
else -> Vector2.Zero
|
||||||
}
|
}
|
||||||
tileMapHolder.setCenterPosition(tileToCenterOn,true)
|
tileMapHolder.setCenterPosition(tileToCenterOn,true)
|
||||||
|
|
||||||
|
|
||||||
|
// On the one hand, all updates to e.g. TileGroups need to happen on the main rendering thread.
|
||||||
|
// On the other hand, the initial setup requires setting up a lot of items on the map,
|
||||||
|
// and we would sometimes get an "Input dispatching timed out" ANR when doing so.
|
||||||
|
// Putting it in a postRunnnable is our way of attempting to avoid this.
|
||||||
|
Gdx.app.postRunnable { render(0f) }
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is private so that we will set the shouldUpdate to true instead.
|
// This is private so that we will set the shouldUpdate to true instead.
|
||||||
@ -313,8 +320,11 @@ class WorldScreen : CameraStageBaseScreen() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var shouldUpdate=true
|
var shouldUpdate=true
|
||||||
|
|
||||||
|
|
||||||
override fun render(delta: Float) {
|
override fun render(delta: Float) {
|
||||||
if (shouldUpdate) { // This is so that updates happen in the MAIN THREAD, where there is a GL Context,
|
if (shouldUpdate) { // This is so that updates happen in the MAIN THREAD, where there is a GL Context,
|
||||||
|
|
||||||
if (currentPlayerCiv != gameInfo.getCurrentPlayerCivilization()) {
|
if (currentPlayerCiv != gameInfo.getCurrentPlayerCivilization()) {
|
||||||
UnCivGame.Current.screen = PlayerReadyScreen(gameInfo.getCurrentPlayerCivilization())
|
UnCivGame.Current.screen = PlayerReadyScreen(gameInfo.getCurrentPlayerCivilization())
|
||||||
return
|
return
|
||||||
@ -325,6 +335,7 @@ class WorldScreen : CameraStageBaseScreen() {
|
|||||||
showTutorialsOnNextTurn()
|
showTutorialsOnNextTurn()
|
||||||
shouldUpdate = false
|
shouldUpdate = false
|
||||||
}
|
}
|
||||||
|
|
||||||
super.render(delta)
|
super.render(delta)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user