summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/src/kz/ilotterytea/maxon/constants/SettingsConstants.java6
-rw-r--r--core/src/kz/ilotterytea/maxon/screens/MenuScreen.java74
-rw-r--r--core/src/kz/ilotterytea/maxon/ui/game/QuickActionsTable.kt3
3 files changed, 52 insertions, 31 deletions
diff --git a/core/src/kz/ilotterytea/maxon/constants/SettingsConstants.java b/core/src/kz/ilotterytea/maxon/constants/SettingsConstants.java
new file mode 100644
index 0000000..3eb2c98
--- /dev/null
+++ b/core/src/kz/ilotterytea/maxon/constants/SettingsConstants.java
@@ -0,0 +1,6 @@
+package kz.ilotterytea.maxon.constants;
+
+public class SettingsConstants {
+ public static Float UI_MAX_SCALE = 1.5f;
+ public static Float UI_DEFAULT_SCALE = 1f;
+}
diff --git a/core/src/kz/ilotterytea/maxon/screens/MenuScreen.java b/core/src/kz/ilotterytea/maxon/screens/MenuScreen.java
index 2e1fe1f..054ca4e 100644
--- a/core/src/kz/ilotterytea/maxon/screens/MenuScreen.java
+++ b/core/src/kz/ilotterytea/maxon/screens/MenuScreen.java
@@ -23,6 +23,7 @@ import com.badlogic.gdx.utils.viewport.ScreenViewport;
import kz.ilotterytea.javaextra.tuples.Triple;
import kz.ilotterytea.maxon.MaxonConstants;
import kz.ilotterytea.maxon.MaxonGame;
+import kz.ilotterytea.maxon.constants.SettingsConstants;
import kz.ilotterytea.maxon.localization.LineId;
import kz.ilotterytea.maxon.localization.LocalizationManager;
import kz.ilotterytea.maxon.player.Savegame;
@@ -76,7 +77,7 @@ public class MenuScreen implements Screen {
soundVolume = game.prefs.getInteger("sfx", 10) / 10f;
// - - - - - - U I - - - - - -
- float iconSize = OsUtils.isMobile ? 256f : 64f;
+ float iconSize = (OsUtils.isMobile ? 256f : 64f) * game.prefs.getFloat("guiScale", SettingsConstants.UI_DEFAULT_SCALE);
Table menuTable = new Table();
menuTable.setFillParent(true);
@@ -270,49 +271,62 @@ public class MenuScreen implements Screen {
}
});
- if (!OsUtils.isMobile) {
- rightGameControlTable.add(localeButton).size(iconSize).padRight(16f);
- rightGameControlTable.add(musicButton).size(iconSize).padRight(16f);
-
- // Resolution button
- String resolutionButtonStyleName;
+ // Resolution button
+ String resolutionButtonStyleName;
- if (game.prefs.getBoolean("fullscreen")) {
- resolutionButtonStyleName = "windowed";
- } else {
- resolutionButtonStyleName = "fullscreen";
- }
-
- ShakingImageButton resolutionButton = new ShakingImageButton(widgetSkin, resolutionButtonStyleName);
- resolutionButton.setOrigin(iconSize / 2f, iconSize / 2f);
- resolutionButton.addListener(new ClickListener() {
- @Override
- public void clicked(InputEvent event, float x, float y) {
- super.clicked(event, x, y);
+ if (game.prefs.getBoolean("fullscreen")) {
+ resolutionButtonStyleName = "windowed";
+ } else {
+ resolutionButtonStyleName = "fullscreen";
+ }
- String style;
+ ShakingImageButton resolutionButton = new ShakingImageButton(widgetSkin, resolutionButtonStyleName);
+ resolutionButton.setOrigin(iconSize / 2f, iconSize / 2f);
+ resolutionButton.addListener(new ClickListener() {
+ @Override
+ public void clicked(InputEvent event, float x, float y) {
+ super.clicked(event, x, y);
+ if (OsUtils.isMobile) {
+ float scale = game.prefs.getFloat("guiScale", SettingsConstants.UI_DEFAULT_SCALE);
- if (game.prefs.getBoolean("fullscreen")) {
- style = "fullscreen";
- Gdx.graphics.setWindowedMode(game.prefs.getInteger("width", 800), game.prefs.getInteger("height", 600));
- } else {
- style = "windowed";
- Gdx.graphics.setFullscreenMode(Gdx.graphics.getDisplayMode());
+ if (scale + 0.5f > SettingsConstants.UI_MAX_SCALE || scale <= 0) {
+ scale = 0;
}
- game.prefs.putBoolean("fullscreen", !game.prefs.getBoolean("fullscreen"));
+ game.prefs.putFloat("guiScale", scale + 0.5f);
game.prefs.flush();
+ game.setScreen(new SplashScreen());
+ return;
+ }
- resolutionButton.setDrawable(widgetSkin, style);
- clickSound.play(soundVolume);
+ String style;
+
+ if (game.prefs.getBoolean("fullscreen")) {
+ style = "fullscreen";
+ Gdx.graphics.setWindowedMode(game.prefs.getInteger("width", 800), game.prefs.getInteger("height", 600));
+ } else {
+ style = "windowed";
+ Gdx.graphics.setFullscreenMode(Gdx.graphics.getDisplayMode());
}
- });
+
+ game.prefs.putBoolean("fullscreen", !game.prefs.getBoolean("fullscreen"));
+ game.prefs.flush();
+
+ resolutionButton.setDrawable(widgetSkin, style);
+ clickSound.play(soundVolume);
+ }
+ });
+
+ if (!OsUtils.isMobile) {
+ rightGameControlTable.add(localeButton).size(iconSize).padRight(16f);
+ rightGameControlTable.add(musicButton).size(iconSize).padRight(16f);
rightGameControlTable.add(resolutionButton).size(iconSize);
controlTable.add(leftGameControlTable).grow();
} else {
rightGameControlTable.add(localeButton).size(iconSize).expand();
rightGameControlTable.add(musicButton).size(iconSize).expand();
+ rightGameControlTable.add(resolutionButton).size(iconSize).expand();
}
controlTable.add(rightGameControlTable).grow();
diff --git a/core/src/kz/ilotterytea/maxon/ui/game/QuickActionsTable.kt b/core/src/kz/ilotterytea/maxon/ui/game/QuickActionsTable.kt
index b2315c1..08b4bb7 100644
--- a/core/src/kz/ilotterytea/maxon/ui/game/QuickActionsTable.kt
+++ b/core/src/kz/ilotterytea/maxon/ui/game/QuickActionsTable.kt
@@ -9,6 +9,7 @@ import com.badlogic.gdx.scenes.scene2d.ui.Table
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener
import com.badlogic.gdx.utils.Align
import kz.ilotterytea.maxon.MaxonGame
+import kz.ilotterytea.maxon.constants.SettingsConstants
import kz.ilotterytea.maxon.screens.MenuScreen
import kz.ilotterytea.maxon.screens.SlotsMinigameScreen
import kz.ilotterytea.maxon.ui.ShakingImageButton
@@ -23,7 +24,7 @@ class QuickActionsTable(widgetSkin: Skin, uiSkin: Skin) : Table(uiSkin) {
256f
} else {
64f
- }
+ } * game.prefs.getFloat("guiScale", SettingsConstants.UI_DEFAULT_SCALE)
val slotsButton = ShakingImageButton(widgetSkin, "slots")
slotsButton.setOrigin(iconSize / 2f, iconSize / 2f)