Revert "We now auto-detect resolution from the screen! Been a long time coming!"

This reverts commit 7d458207b5.
This commit is contained in:
Yair Morgenstern
2019-12-08 17:36:02 +02:00
parent 9ea1c31455
commit 66e940dd2b
3 changed files with 25 additions and 1 deletions

View File

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

View File

@ -22,7 +22,8 @@ open class CameraStageBaseScreen : Screen {
var hasPopupOpen = false
init {
stage = Stage(ExtendViewport(Gdx.graphics.width.toFloat(), Gdx.graphics.height.toFloat()), batch)// FitViewport(1000,600)
val resolutions: List<Float> = game.settings.resolution.split("x").map { it.toInt().toFloat() }
stage = Stage(ExtendViewport(resolutions[0], resolutions[1]), batch)// FitViewport(1000,600)
}

View File

@ -112,6 +112,8 @@ class WorldScreenOptionsTable(val worldScreen:WorldScreen) : PopupTable(worldScr
addLanguageSelectBox(innerTable)
addResolutionSelectBox(innerTable)
addAutosaveTurnsSelectBox(innerTable)
addTileSetSelectBox(innerTable)
@ -194,6 +196,26 @@ class WorldScreenOptionsTable(val worldScreen:WorldScreen) : PopupTable(worldScr
}
}
private fun addResolutionSelectBox(innerTable: PopupTable) {
innerTable.add("Resolution".toLabel())
val resolutionSelectBox = SelectBox<String>(skin)
val resolutionArray = Array<String>()
resolutionArray.addAll("750x500","900x600", "1050x700", "1200x800", "1500x1000")
resolutionSelectBox.items = resolutionArray
resolutionSelectBox.selected = UncivGame.Current.settings.resolution
innerTable.add(resolutionSelectBox).pad(10f).row()
resolutionSelectBox.addListener(object : ChangeListener() {
override fun changed(event: ChangeEvent?, actor: Actor?) {
UncivGame.Current.settings.resolution = resolutionSelectBox.selected
UncivGame.Current.settings.save()
UncivGame.Current.worldScreen = WorldScreen(worldScreen.viewingCiv)
UncivGame.Current.setWorldScreen()
WorldScreenOptionsTable(UncivGame.Current.worldScreen)
}
})
}
private fun addTileSetSelectBox(innerTable: PopupTable) {
innerTable.add("Tileset".toLabel())