The base resolution is auto but it can be manually set. That oughtta keep everyone happy.

This commit is contained in:
Yair Morgenstern 2019-12-08 18:22:25 +02:00
parent 66e940dd2b
commit df27cb3bdd
3 changed files with 22 additions and 4 deletions

View File

@ -8,7 +8,7 @@ class GameSettings {
var checkForDueUnits: Boolean = true
var singleTapMove: Boolean = false
var language: String = "English"
var resolution: String = "1050x700"
var resolution: String = "Auto"
var tutorialsShown = ArrayList<String>()
var hasCrashedRecently = false
var soundEffectsVolume = 0.5f

View File

@ -22,8 +22,26 @@ open class CameraStageBaseScreen : Screen {
var hasPopupOpen = false
init {
val resolutions: List<Float> = game.settings.resolution.split("x").map { it.toInt().toFloat() }
stage = Stage(ExtendViewport(resolutions[0], resolutions[1]), batch)// FitViewport(1000,600)
val width:Float
val height:Float
if(game.settings.resolution=="Auto"){
// lower than 750x500 just doesn't manage to fit all the components into the screen
if(Gdx.graphics.width >= 750 && Gdx.graphics.height.toFloat() >= 500){
width=Gdx.graphics.width.toFloat()
height=Gdx.graphics.height.toFloat()
}
else{
width=750f
height=500f
}
}
else {
val resolutions: List<Float> = game.settings.resolution.split("x").map { it.toInt().toFloat() }
width = resolutions[0]
height = resolutions[1]
}
stage = Stage(ExtendViewport(width, height), batch)
}

View File

@ -201,7 +201,7 @@ class WorldScreenOptionsTable(val worldScreen:WorldScreen) : PopupTable(worldScr
val resolutionSelectBox = SelectBox<String>(skin)
val resolutionArray = Array<String>()
resolutionArray.addAll("750x500","900x600", "1050x700", "1200x800", "1500x1000")
resolutionArray.addAll("Auto","750x500","900x600", "1050x700", "1200x800", "1500x1000")
resolutionSelectBox.items = resolutionArray
resolutionSelectBox.selected = UncivGame.Current.settings.resolution
innerTable.add(resolutionSelectBox).pad(10f).row()