diff options
| author | ilotterytea <iltsu@alright.party> | 2024-10-19 20:15:39 +0500 |
|---|---|---|
| committer | ilotterytea <iltsu@alright.party> | 2024-10-19 20:15:39 +0500 |
| commit | d9d19bf1fd95da5256179d22305dcffad6701e9c (patch) | |
| tree | 68dd9ba749e91d4e617bafbc4ca0030282d6cf07 /core | |
| parent | 2665d7b549419b18a3db5622ec42bd9268d89f90 (diff) | |
fix: windowed mode
Diffstat (limited to 'core')
| -rw-r--r-- | core/src/kz/ilotterytea/maxon/MaxonGame.java | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/core/src/kz/ilotterytea/maxon/MaxonGame.java b/core/src/kz/ilotterytea/maxon/MaxonGame.java index c9ff8af..f457270 100644 --- a/core/src/kz/ilotterytea/maxon/MaxonGame.java +++ b/core/src/kz/ilotterytea/maxon/MaxonGame.java @@ -43,12 +43,31 @@ public class MaxonGame extends Game { prefs = Gdx.app.getPreferences(MaxonConstants.GAME_APP_PACKAGE); locale = new I18N(Gdx.files.internal("i18n/" + prefs.getString("lang", "en_us") + ".json")); - prefs.putInteger("width", Gdx.graphics.getWidth()); - prefs.putInteger("height", Gdx.graphics.getHeight()); - prefs.flush(); - Gdx.graphics.setVSync(prefs.getBoolean("vsync", true)); - if (prefs.getBoolean("fullscreen", false)) { Gdx.graphics.setFullscreenMode(Gdx.graphics.getDisplayMode()); } + + if (prefs.getBoolean("fullscreen", false)) { + Gdx.graphics.setFullscreenMode(Gdx.graphics.getDisplayMode()); + } else if ( + prefs.contains("width") || + prefs.contains("height") + ) { + int width = prefs.getInteger("width", 800); + + if (width < 800) { + width = 800; + prefs.putInteger("width", width); + } + + int height = prefs.getInteger("height", 600); + + if (height < 600) { + height = 600; + prefs.putInteger("height", height); + } + + prefs.flush(); + Gdx.graphics.setWindowedMode(width, height); + } assetManager = new AssetManager(); petManager = new PetManager(assetManager); |
