mirror of
https://github.com/yairm210/Unciv.git
synced 2025-08-04 09:09:21 +07:00
We now auto-detect resolution from the screen! Been a long time coming!
This commit is contained in:
@ -8,7 +8,6 @@ class GameSettings {
|
|||||||
var checkForDueUnits: Boolean = true
|
var checkForDueUnits: Boolean = true
|
||||||
var singleTapMove: Boolean = false
|
var singleTapMove: Boolean = false
|
||||||
var language: String = "English"
|
var language: String = "English"
|
||||||
var resolution: String = "1050x700"
|
|
||||||
var tutorialsShown = ArrayList<String>()
|
var tutorialsShown = ArrayList<String>()
|
||||||
var hasCrashedRecently = false
|
var hasCrashedRecently = false
|
||||||
var soundEffectsVolume = 0.5f
|
var soundEffectsVolume = 0.5f
|
||||||
|
@ -22,8 +22,7 @@ open class CameraStageBaseScreen : Screen {
|
|||||||
var hasPopupOpen = false
|
var hasPopupOpen = false
|
||||||
|
|
||||||
init {
|
init {
|
||||||
val resolutions: List<Float> = game.settings.resolution.split("x").map { it.toInt().toFloat() }
|
stage = Stage(ExtendViewport(Gdx.graphics.width.toFloat(), Gdx.graphics.height.toFloat()), batch)// FitViewport(1000,600)
|
||||||
stage = Stage(ExtendViewport(resolutions[0], resolutions[1]), batch)// FitViewport(1000,600)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -112,8 +112,6 @@ class WorldScreenOptionsTable(val worldScreen:WorldScreen) : PopupTable(worldScr
|
|||||||
|
|
||||||
addLanguageSelectBox(innerTable)
|
addLanguageSelectBox(innerTable)
|
||||||
|
|
||||||
addResolutionSelectBox(innerTable)
|
|
||||||
|
|
||||||
addAutosaveTurnsSelectBox(innerTable)
|
addAutosaveTurnsSelectBox(innerTable)
|
||||||
|
|
||||||
addTileSetSelectBox(innerTable)
|
addTileSetSelectBox(innerTable)
|
||||||
@ -196,26 +194,6 @@ 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) {
|
private fun addTileSetSelectBox(innerTable: PopupTable) {
|
||||||
innerTable.add("Tileset".toLabel())
|
innerTable.add("Tileset".toLabel())
|
||||||
|
Reference in New Issue
Block a user