Auto detecting resolution was a terrible idea and I regret it entirely

This commit is contained in:
Yair Morgenstern
2019-12-11 19:43:08 +02:00
parent 8f434c4638
commit 973c8fb7f8
3 changed files with 9 additions and 16 deletions

View File

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

View File

@ -24,21 +24,14 @@ open class CameraStageBaseScreen : Screen {
init {
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]
if(game.settings.resolution=="Auto") { // Aut-detecting resolution was a BAD IDEA since it needs to be based on DPI AND resolution.
game.settings.resolution = "900x600"
game.settings.save()
}
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("Auto","750x500","900x600", "1050x700", "1200x800", "1500x1000")
resolutionArray.addAll("750x500","900x600", "1050x700", "1200x800", "1500x1000")
resolutionSelectBox.items = resolutionArray
resolutionSelectBox.selected = UncivGame.Current.settings.resolution
innerTable.add(resolutionSelectBox).pad(10f).row()