Minimap size may be a matter of taste (or screen size) (#2468)

This commit is contained in:
SomeTroglodyte 2020-04-19 21:52:55 +02:00 committed by GitHub
parent c449e68ba7
commit f99b3f574a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 1 deletions

View File

@ -34,6 +34,8 @@ class GameSettings {
var orderTradeOffersByAmount = true
var windowState = WindowState()
var isFreshlyCreated = false
var minimapSize = 20
var minimapSquare = false
init {
// 26 = Android Oreo. Versions below may display permanent icon in notification bar.

View File

@ -17,6 +17,7 @@ import com.unciv.ui.utils.onClick
import com.unciv.ui.utils.surroundWithCircle
import kotlin.math.max
import kotlin.math.min
import kotlin.math.sqrt
class Minimap(val mapHolder: WorldMapHolder) : ScrollPane(null){
val allTiles = Group()
@ -109,7 +110,15 @@ class MinimapHolder(mapHolder: WorldMapHolder): Table(){
fun getWrappedMinimap(): Table {
val internalMinimapWrapper = Table()
internalMinimapWrapper.add(minimap).size(worldScreen.stage.width/5,worldScreen.stage.height/5)
val sizePercent = worldScreen.game.settings.minimapSize
val sizeWinX = worldScreen.stage.width * sizePercent / 100
val sizeWinY = worldScreen.stage.height * sizePercent / 100
val isSquare = worldScreen.game.settings.minimapSquare
val sizeX = if (isSquare) sqrt(sizeWinX * sizeWinY) else sizeWinX
val sizeY = if (isSquare) sizeX else sizeWinY
internalMinimapWrapper.add(minimap).size(sizeX,sizeY)
internalMinimapWrapper.background=ImageGetter.getBackground(Color.GRAY)
internalMinimapWrapper.pack()