Max screen size takes Windows taskbar into account - see #8091

This commit is contained in:
Yair Morgenstern
2022-12-05 18:39:01 +02:00
parent bb1e8dc10d
commit c3fd948efe
2 changed files with 7 additions and 5 deletions

View File

@ -17,10 +17,11 @@ import com.unciv.models.metadata.WindowState
import com.unciv.ui.utils.Fonts
import com.unciv.utils.Log
import com.unciv.utils.debug
import java.awt.Toolkit
import java.awt.GraphicsEnvironment
import java.util.*
import kotlin.concurrent.timer
internal object DesktopLauncher {
private var discordTimer: Timer? = null
@ -52,10 +53,11 @@ internal object DesktopLauncher {
if (settings.isFreshlyCreated) {
settings.resolution = "1200x800" // By default Desktops should have a higher resolution
// LibGDX not yet configured, use regular java class
val screensize = Toolkit.getDefaultToolkit().screenSize
val graphicsEnvironment = GraphicsEnvironment.getLocalGraphicsEnvironment()
val maximumWindowBounds = graphicsEnvironment.maximumWindowBounds
settings.windowState = WindowState(
width = screensize.width,
height = screensize.height
width = maximumWindowBounds.width,
height = maximumWindowBounds.height
)
FileHandle(SETTINGS_FILE_NAME).writeString(json().toJson(settings), false) // so when we later open the game we get fullscreen
}