diff options
| author | ilotterytea <iltsu@alright.party> | 2024-11-06 21:05:11 +0500 |
|---|---|---|
| committer | ilotterytea <iltsu@alright.party> | 2024-11-06 22:04:39 +0500 |
| commit | 196f6376be6caada1efeda9869f8fbfa9bd12fff (patch) | |
| tree | 64e97541d957a7408aea736e3be44b9f2aa90340 /core | |
| parent | 218f80d9e747637c3cb231ee64ff4a50f9161ece (diff) | |
upd: magnified the icons for mobile screens
Diffstat (limited to 'core')
3 files changed, 49 insertions, 19 deletions
diff --git a/core/src/kz/ilotterytea/maxon/screens/MenuScreen.java b/core/src/kz/ilotterytea/maxon/screens/MenuScreen.java index 0998cb2..2e1fe1f 100644 --- a/core/src/kz/ilotterytea/maxon/screens/MenuScreen.java +++ b/core/src/kz/ilotterytea/maxon/screens/MenuScreen.java @@ -76,6 +76,8 @@ public class MenuScreen implements Screen { soundVolume = game.prefs.getInteger("sfx", 10) / 10f; // - - - - - - U I - - - - - - + float iconSize = OsUtils.isMobile ? 256f : 64f; + Table menuTable = new Table(); menuTable.setFillParent(true); @@ -173,6 +175,7 @@ public class MenuScreen implements Screen { leftGameControlTable.align(Align.left); ShakingImageButton quitButton = new ShakingImageButton(widgetSkin, "exit"); + quitButton.setOrigin(iconSize / 2f, iconSize / 2f); quitButton.addListener(new ClickListener() { @Override @@ -183,7 +186,7 @@ public class MenuScreen implements Screen { } }); - leftGameControlTable.add(quitButton).padRight(12f); + leftGameControlTable.add(quitButton).size(iconSize).padRight(12f); // Right part of menu control Table rightGameControlTable = new Table(); @@ -197,6 +200,7 @@ public class MenuScreen implements Screen { String[] fh4Locale = game.getLocale().getHandle().nameWithoutExtension().split("_"); String localeButtonStyleName = "locale_" + fh4Locale[0]; ShakingImageButton localeButton = new ShakingImageButton(widgetSkin, localeButtonStyleName); + localeButton.setOrigin(iconSize / 2f, iconSize / 2f); localeButton.addListener(new ClickListener() { @Override @@ -236,6 +240,7 @@ public class MenuScreen implements Screen { } ShakingImageButton musicButton = new ShakingImageButton(widgetSkin, musicButtonStyleName); + musicButton.setOrigin(iconSize / 2f, iconSize / 2f); musicButton.addListener(new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { @@ -266,8 +271,8 @@ public class MenuScreen implements Screen { }); if (!OsUtils.isMobile) { - rightGameControlTable.add(localeButton).padRight(16f); - rightGameControlTable.add(musicButton).padRight(16f); + rightGameControlTable.add(localeButton).size(iconSize).padRight(16f); + rightGameControlTable.add(musicButton).size(iconSize).padRight(16f); // Resolution button String resolutionButtonStyleName; @@ -279,6 +284,7 @@ public class MenuScreen implements Screen { } 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) { @@ -301,12 +307,12 @@ public class MenuScreen implements Screen { clickSound.play(soundVolume); } }); - rightGameControlTable.add(resolutionButton); + rightGameControlTable.add(resolutionButton).size(iconSize); controlTable.add(leftGameControlTable).grow(); } else { - rightGameControlTable.add(localeButton).expand(); - rightGameControlTable.add(musicButton).expand(); + rightGameControlTable.add(localeButton).size(iconSize).expand(); + rightGameControlTable.add(musicButton).size(iconSize).expand(); } controlTable.add(rightGameControlTable).grow(); @@ -530,6 +536,8 @@ public class MenuScreen implements Screen { } private void openCredits() { + String labelStyleName = OsUtils.isMobile ? "defaultMobile" : "default"; + Image bgTint = new Image(uiSkin, "halftransparentblack"); bgTint.setFillParent(true); stage.addActor(bgTint); @@ -559,11 +567,11 @@ public class MenuScreen implements Screen { window.add(titleTable).growX().row(); // Title - Label titleLabel = new Label(game.getLocale().getLine(LineId.CreditsTitle), uiSkin); + Label titleLabel = new Label(game.getLocale().getLine(LineId.CreditsTitle), uiSkin, labelStyleName); titleTable.add(titleLabel).pad(8f, 16f, 8f, 16f).growX(); // Close button - TextButton closeButton = new TextButton(" X ", uiSkin); + TextButton closeButton = new TextButton(" X ", uiSkin, labelStyleName); closeButton.addListener(new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { @@ -601,13 +609,13 @@ public class MenuScreen implements Screen { contributorTable.add(widget).padBottom(16f); // Name - Label name = new Label(contributor.getFirst(), uiSkin, "credits_name"); + Label name = new Label(contributor.getFirst(), uiSkin, OsUtils.isMobile ? "credits_name_mobile" : "credits_name"); name.setAlignment(Align.center); widget.add(name).grow().padBottom(8f).row(); // Icon Image icon = new Image(friendSkin.getDrawable(contributor.getFirst())); - widget.add(icon).padBottom(8f).row(); + widget.add(icon).size(OsUtils.isMobile ? 128f : 64f).padBottom(8f).row(); // Role LineId id = switch (contributor.getThird()) { @@ -620,7 +628,7 @@ public class MenuScreen implements Screen { default -> LineId.CreditsMaxon; }; - Label role = new Label(game.getLocale().getLine(id), uiSkin, "credits_role"); + Label role = new Label(game.getLocale().getLine(id), uiSkin, OsUtils.isMobile ? "credits_role_mobile" : "credits_role"); role.setAlignment(Align.center); widget.add(role).grow().row(); @@ -632,7 +640,7 @@ public class MenuScreen implements Screen { engineCredits.setBackground("bg2"); window.add(engineCredits).growX().row(); - Label engineLabel = new Label("Made with", uiSkin); + Label engineLabel = new Label("Made with", uiSkin, labelStyleName); engineCredits.add(engineLabel).padRight(16f); TextureAtlas brandAtlas = game.assetManager.get("sprites/gui/brand.atlas"); @@ -645,6 +653,6 @@ public class MenuScreen implements Screen { clickSound.play(soundVolume); } }); - engineCredits.add(engineImage).height(32f).width(180f); + engineCredits.add(engineImage).height(OsUtils.isMobile ? 64f : 32f).width(OsUtils.isMobile ? 360f : 180f); } } diff --git a/core/src/kz/ilotterytea/maxon/screens/game/GameScreen.java b/core/src/kz/ilotterytea/maxon/screens/game/GameScreen.java index 16d75b0..5b79473 100644 --- a/core/src/kz/ilotterytea/maxon/screens/game/GameScreen.java +++ b/core/src/kz/ilotterytea/maxon/screens/game/GameScreen.java @@ -13,6 +13,7 @@ import com.badlogic.gdx.math.MathUtils; import com.badlogic.gdx.math.Vector3; import com.badlogic.gdx.scenes.scene2d.Stage; import com.badlogic.gdx.scenes.scene2d.ui.*; +import com.badlogic.gdx.utils.Align; import com.badlogic.gdx.utils.Timer; import com.badlogic.gdx.utils.viewport.ScreenViewport; import kz.ilotterytea.maxon.MaxonGame; @@ -341,7 +342,13 @@ public class GameScreen implements Screen, InputProcessor { DebugWidget debugWidget = new DebugWidget(uiSkin); this.stage.addActor(debugWidget); - this.stage.addActor(new QuickActionsTable(this.game.assetManager.get("sprites/gui/widgets.skin", Skin.class))); + QuickActionsTable quickActionsTable = new QuickActionsTable(this.game.assetManager.get("sprites/gui/widgets.skin", Skin.class), uiSkin); + if (OsUtils.isMobile) { + quickActionsTable.setFillParent(true); + quickActionsTable.align(Align.bottom); + } + + this.stage.addActor(quickActionsTable); } @Override diff --git a/core/src/kz/ilotterytea/maxon/ui/game/QuickActionsTable.kt b/core/src/kz/ilotterytea/maxon/ui/game/QuickActionsTable.kt index c8c0eef..b2315c1 100644 --- a/core/src/kz/ilotterytea/maxon/ui/game/QuickActionsTable.kt +++ b/core/src/kz/ilotterytea/maxon/ui/game/QuickActionsTable.kt @@ -12,14 +12,21 @@ import kz.ilotterytea.maxon.MaxonGame import kz.ilotterytea.maxon.screens.MenuScreen import kz.ilotterytea.maxon.screens.SlotsMinigameScreen import kz.ilotterytea.maxon.ui.ShakingImageButton +import kz.ilotterytea.maxon.utils.OsUtils -class QuickActionsTable(skin: Skin) : Table() { +class QuickActionsTable(widgetSkin: Skin, uiSkin: Skin) : Table(uiSkin) { init { val game = MaxonGame.getInstance() val clickSound = game.assetManager.get("sfx/ui/click.ogg", Sound::class.java) val soundVolume = game.prefs.getInteger("sfx", 10) / 10f + val iconSize = if (OsUtils.isMobile) { + 256f + } else { + 64f + } - val slotsButton = ShakingImageButton(skin, "slots") + val slotsButton = ShakingImageButton(widgetSkin, "slots") + slotsButton.setOrigin(iconSize / 2f, iconSize / 2f) slotsButton.addListener(object : ClickListener() { override fun clicked(event: InputEvent, x: Float, y: Float) { super.clicked(event, x, y) @@ -27,9 +34,10 @@ class QuickActionsTable(skin: Skin) : Table() { game.screen = SlotsMinigameScreen() } }) - add(slotsButton).height(64f).width(64f).padRight(8f) + val slotsCell = add(slotsButton).size(iconSize).padRight(8f) - val quitButton = ShakingImageButton(skin, "exit") + val quitButton = ShakingImageButton(widgetSkin, "exit") + quitButton.setOrigin(iconSize / 2f, iconSize / 2f) quitButton.addListener(object : ClickListener() { override fun clicked(event: InputEvent, x: Float, y: Float) { super.clicked(event, x, y) @@ -37,12 +45,19 @@ class QuickActionsTable(skin: Skin) : Table() { game.screen = MenuScreen() } }) - add(quitButton).height(64f).width(64f) + val quitCell = add(quitButton).size(iconSize) + + if (OsUtils.isMobile) { + slotsCell.expandX() + quitCell.expandX() + } } override fun draw(batch: Batch?, parentAlpha: Float) { super.draw(batch, parentAlpha) + if (OsUtils.isMobile) return + // i'm not sure how much does it affect on performance setX(Gdx.graphics.width - 36f * 2f, Align.left) setY(Gdx.graphics.height - 36f, Align.top) |
