diff --git a/core/src/com/unciv/ui/tilegroups/CityButton.kt b/core/src/com/unciv/ui/tilegroups/CityButton.kt index 3c86bad4f8..6afa7563a9 100644 --- a/core/src/com/unciv/ui/tilegroups/CityButton.kt +++ b/core/src/com/unciv/ui/tilegroups/CityButton.kt @@ -216,14 +216,18 @@ class CityButton(val city: CityInfo, private val tileGroup: WorldTileGroup): Tab iconTable.add(connectionImage).size(20f).padLeft(5f) } - iconTable.add(getPopulationGroup(uncivGame.viewEntireMapForDebug + val populationGroup = getPopulationGroup(uncivGame.viewEntireMapForDebug || belongsToViewingCiv() - || worldScreen.viewingCiv.isSpectator())).padLeft(5f) + || worldScreen.viewingCiv.isSpectator()) + iconTable.add(populationGroup).padLeft(5f) + populationGroup.toBack() val cityButtonText = city.name val label = cityButtonText.toLabel(secondaryColor) iconTable.add(label).padRight(20f).padLeft(20f) // sufficient horizontal padding .fillY() // provide full-height clicking area + label.toBack() // this is so the label is rendered right before the population group, + // so we save the font texture and avoid another texture switch if (uncivGame.viewEntireMapForDebug || belongsToViewingCiv() || worldScreen.viewingCiv.isSpectator()) iconTable.add(getConstructionGroup(city.cityConstructions)) @@ -309,6 +313,9 @@ class CityButton(val city: CityInfo, private val tileGroup: WorldTileGroup): Tab turnLabel.pack() group.addActor(turnLabel) + turnLabel.toBack() // this is so both labels are rendered next to each other - + // this is important because when switching to a label, we switch out the texture we're using to use the font texture, + // so this has a direct impact on framerate! turnLabel.x = growthBar.x + growthBar.width + 1 } diff --git a/core/src/com/unciv/ui/tilegroups/TileGroup.kt b/core/src/com/unciv/ui/tilegroups/TileGroup.kt index e1a67763bd..784371f0b5 100644 --- a/core/src/com/unciv/ui/tilegroups/TileGroup.kt +++ b/core/src/com/unciv/ui/tilegroups/TileGroup.kt @@ -60,7 +60,9 @@ open class TileGroup(var tileInfo: TileInfo, var tileSetStrings:TileSetStrings) protected var pixelCivilianUnitImageLocation = "" protected var pixelCivilianUnitGroup = Group().apply { isTransform = false; setSize(groupSize, groupSize) } - class MiscLayerGroupClass:Group() + class MiscLayerGroupClass:Group(){ + override fun draw(batch: Batch?, parentAlpha: Float) { super.draw(batch, parentAlpha) } + } val miscLayerGroup = MiscLayerGroupClass().apply { isTransform = false; setSize(groupSize, groupSize) } var resourceImage: Actor? = null @@ -70,7 +72,9 @@ open class TileGroup(var tileInfo: TileInfo, var tileSetStrings:TileSetStrings) val icons = TileGroupIcons(this) - class UnitLayerGroupClass:Group() + class UnitLayerGroupClass:Group(){ + override fun draw(batch: Batch?, parentAlpha: Float) { super.draw(batch, parentAlpha) } + } val unitLayerGroup = UnitLayerGroupClass().apply { isTransform = false; setSize(groupSize, groupSize);touchable = Touchable.disabled } val cityButtonLayerGroup = Group().apply { isTransform = true; setSize(groupSize, groupSize);