mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-27 13:55:54 -04:00
Minimap size may be a matter of taste (or screen size) (#2468)
This commit is contained in:
parent
c449e68ba7
commit
f99b3f574a
@ -34,6 +34,8 @@ class GameSettings {
|
|||||||
var orderTradeOffersByAmount = true
|
var orderTradeOffersByAmount = true
|
||||||
var windowState = WindowState()
|
var windowState = WindowState()
|
||||||
var isFreshlyCreated = false
|
var isFreshlyCreated = false
|
||||||
|
var minimapSize = 20
|
||||||
|
var minimapSquare = false
|
||||||
|
|
||||||
init {
|
init {
|
||||||
// 26 = Android Oreo. Versions below may display permanent icon in notification bar.
|
// 26 = Android Oreo. Versions below may display permanent icon in notification bar.
|
||||||
|
@ -17,6 +17,7 @@ import com.unciv.ui.utils.onClick
|
|||||||
import com.unciv.ui.utils.surroundWithCircle
|
import com.unciv.ui.utils.surroundWithCircle
|
||||||
import kotlin.math.max
|
import kotlin.math.max
|
||||||
import kotlin.math.min
|
import kotlin.math.min
|
||||||
|
import kotlin.math.sqrt
|
||||||
|
|
||||||
class Minimap(val mapHolder: WorldMapHolder) : ScrollPane(null){
|
class Minimap(val mapHolder: WorldMapHolder) : ScrollPane(null){
|
||||||
val allTiles = Group()
|
val allTiles = Group()
|
||||||
@ -109,7 +110,15 @@ class MinimapHolder(mapHolder: WorldMapHolder): Table(){
|
|||||||
|
|
||||||
fun getWrappedMinimap(): Table {
|
fun getWrappedMinimap(): Table {
|
||||||
val internalMinimapWrapper = 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.background=ImageGetter.getBackground(Color.GRAY)
|
||||||
internalMinimapWrapper.pack()
|
internalMinimapWrapper.pack()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user