mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-20 04:38:18 +07:00
More framerate improvement tricks - this was more than enough to offset the harm of the building and unit images, and went the other way!
The framerate started out before the image games as ~17-18 on the tested game, dropped to ~14-15 with the image changes, and is now at ~20-21~
This commit is contained in:
@ -25,7 +25,6 @@ class CityButton(val city: CityInfo, private val tileGroup: WorldTileGroup): Tab
|
||||
val uncivGame = worldScreen.game
|
||||
|
||||
init {
|
||||
isTransform = true // If this is not set then the city button won't scale!
|
||||
touchable = Touchable.disabled
|
||||
}
|
||||
|
||||
|
@ -77,7 +77,7 @@ open class TileGroup(var tileInfo: TileInfo, var tileSetStrings:TileSetStrings)
|
||||
}
|
||||
val unitLayerGroup = UnitLayerGroupClass().apply { isTransform = false; setSize(groupSize, groupSize);touchable = Touchable.disabled }
|
||||
|
||||
val cityButtonLayerGroup = Group().apply { isTransform = true; setSize(groupSize, groupSize);
|
||||
val cityButtonLayerGroup = Group().apply { setSize(groupSize, groupSize);
|
||||
touchable = Touchable.childrenOnly; setOrigin(Align.center) }
|
||||
|
||||
val circleCrosshairFogLayerGroup = Group().apply { isTransform = false; setSize(groupSize, groupSize) }
|
||||
|
@ -460,16 +460,20 @@ class WorldMapHolder(internal val worldScreen: WorldScreen, internal val tileMap
|
||||
worldScreen.shouldUpdate=true
|
||||
}
|
||||
|
||||
override fun zoom(zoomScale:Float){
|
||||
override fun zoom(zoomScale:Float) {
|
||||
super.zoom(zoomScale)
|
||||
val scale = 1/scaleX // don't use zoomScale itself, in case it was out of bounds and not applied
|
||||
if(scale < 1 && scale > 0.5f)
|
||||
for(tileGroup in tileGroups.values)
|
||||
val scale = 1 / scaleX // don't use zoomScale itself, in case it was out of bounds and not applied
|
||||
if (scale >= 1)
|
||||
for (tileGroup in tileGroups.values)
|
||||
tileGroup.cityButtonLayerGroup.isTransform = false // to save on rendering time to improve framerate
|
||||
if (scale < 1 && scale > 0.5f)
|
||||
for (tileGroup in tileGroups.values) {
|
||||
tileGroup.cityButtonLayerGroup.isTransform = true
|
||||
tileGroup.cityButtonLayerGroup.setScale(scale)
|
||||
}
|
||||
}
|
||||
|
||||
// For debugging purposes
|
||||
override fun draw(batch: Batch?, parentAlpha: Float) {
|
||||
super.draw(batch, parentAlpha)
|
||||
}
|
||||
override fun draw(batch: Batch?, parentAlpha: Float) { super.draw(batch, parentAlpha) }
|
||||
override fun act(delta: Float) { super.act(delta) }
|
||||
}
|
Reference in New Issue
Block a user