mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-06 16:28:40 +07:00
Fix the app window changing may lead to that the app can't open in macOS (#4042)
This commit is contained in:
@ -62,7 +62,6 @@ class UncivGame(parameters: UncivGameParameters) : Game() {
|
||||
|
||||
var music: Music? = null
|
||||
val musicLocation = "music/thatched-villagers.mp3"
|
||||
private var isSizeRestored = false
|
||||
var isInitialized = false
|
||||
|
||||
|
||||
@ -118,7 +117,6 @@ class UncivGame(parameters: UncivGameParameters) : Game() {
|
||||
|
||||
|
||||
thread(name="Music") { startMusic() }
|
||||
restoreSize()
|
||||
|
||||
if (settings.isFreshlyCreated) {
|
||||
setScreen(LanguagePickerScreen())
|
||||
@ -129,14 +127,6 @@ class UncivGame(parameters: UncivGameParameters) : Game() {
|
||||
crashController = CrashController.Impl(crashReportSender)
|
||||
}
|
||||
|
||||
fun restoreSize() {
|
||||
if (!isSizeRestored && Gdx.app.type == Application.ApplicationType.Desktop && settings.windowState.height>39 && settings.windowState.width>39) {
|
||||
isSizeRestored = true
|
||||
Gdx.graphics.setWindowedMode(settings.windowState.width, settings.windowState.height)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fun loadGame(gameInfo: GameInfo) {
|
||||
this.gameInfo = gameInfo
|
||||
ImageGetter.setNewRuleset(gameInfo.ruleSet)
|
||||
|
@ -6,10 +6,14 @@ import club.minnced.discord.rpc.DiscordRichPresence
|
||||
import com.badlogic.gdx.Files
|
||||
import com.badlogic.gdx.backends.lwjgl.LwjglApplication
|
||||
import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration
|
||||
import com.badlogic.gdx.files.FileHandle
|
||||
import com.badlogic.gdx.graphics.Texture
|
||||
import com.badlogic.gdx.tools.texturepacker.TexturePacker
|
||||
import com.unciv.JsonParser
|
||||
import com.unciv.UncivGame
|
||||
import com.unciv.UncivGameParameters
|
||||
import com.unciv.logic.GameSaver
|
||||
import com.unciv.models.metadata.GameSettings
|
||||
import com.unciv.models.translations.tr
|
||||
import com.unciv.ui.utils.Fonts
|
||||
import io.ktor.application.*
|
||||
@ -39,6 +43,11 @@ internal object DesktopLauncher {
|
||||
config.addIcon("ExtraImages/Icon.png", Files.FileType.Internal)
|
||||
config.title = "Unciv"
|
||||
config.useHDPI = true
|
||||
if (FileHandle(GameSaver.settingsFileName).exists()) {
|
||||
val settings = JsonParser().getFromJson(GameSettings::class.java, FileHandle(GameSaver.settingsFileName))
|
||||
config.width = settings.windowState.width
|
||||
config.height = settings.windowState.height
|
||||
}
|
||||
|
||||
val versionFromJar = DesktopLauncher.javaClass.`package`.specificationVersion ?: "Desktop"
|
||||
|
||||
|
Reference in New Issue
Block a user