diff options
| -rw-r--r-- | assets/sprites/gui/ui.skin | 1 | ||||
| -rw-r--r-- | core/src/kz/ilotterytea/maxon/screens/SplashScreen.java | 78 | ||||
| -rw-r--r-- | core/src/kz/ilotterytea/maxon/ui/MovingChessBackground.java | 5 |
3 files changed, 33 insertions, 51 deletions
diff --git a/assets/sprites/gui/ui.skin b/assets/sprites/gui/ui.skin index cc281a1..1e7ff60 100644 --- a/assets/sprites/gui/ui.skin +++ b/assets/sprites/gui/ui.skin @@ -22,6 +22,7 @@ white_tile: { color: white, name: tile }, halftransparentblack: { color: { hex: "#00000099" }, name: tile }, + black: { color: { hex: "#000000" }, name: tile }, // Store store: { color: { hex: "#59413aff" }, name: square }, diff --git a/core/src/kz/ilotterytea/maxon/screens/SplashScreen.java b/core/src/kz/ilotterytea/maxon/screens/SplashScreen.java index e38944a..7b7fd02 100644 --- a/core/src/kz/ilotterytea/maxon/screens/SplashScreen.java +++ b/core/src/kz/ilotterytea/maxon/screens/SplashScreen.java @@ -1,42 +1,40 @@ package kz.ilotterytea.maxon.screens; import com.badlogic.gdx.*; -import com.badlogic.gdx.audio.Sound; import com.badlogic.gdx.graphics.GL20; import com.badlogic.gdx.graphics.g2d.TextureAtlas; -import com.badlogic.gdx.math.Interpolation; import com.badlogic.gdx.scenes.scene2d.Action; -import com.badlogic.gdx.scenes.scene2d.InputEvent; import com.badlogic.gdx.scenes.scene2d.Stage; import com.badlogic.gdx.scenes.scene2d.actions.Actions; -import com.badlogic.gdx.scenes.scene2d.actions.RepeatAction; import com.badlogic.gdx.scenes.scene2d.ui.*; -import com.badlogic.gdx.scenes.scene2d.utils.ClickListener; +import com.badlogic.gdx.scenes.scene2d.utils.Drawable; import com.badlogic.gdx.utils.Align; -import com.badlogic.gdx.utils.viewport.FitViewport; +import com.badlogic.gdx.utils.viewport.*; import kz.ilotterytea.maxon.MaxonConstants; import kz.ilotterytea.maxon.assets.AssetUtils; import kz.ilotterytea.maxon.MaxonGame; +import kz.ilotterytea.maxon.ui.MovingChessBackground; import kz.ilotterytea.maxon.utils.OsUtils; +import java.util.ArrayList; + public class SplashScreen implements Screen { private MaxonGame game = MaxonGame.getInstance(); private Stage stage; + private MovingChessBackground background; + private TextureAtlas brandAtlas; - private Skin contributorsSkin; - private Sound clickSound; - private float soundVolume; + private Skin contributorSkin; + private Image backgroundTint; private ProgressBar bar; private boolean assetsLoaded = false; @Override public void show() { this.game = MaxonGame.getInstance(); - clickSound = Gdx.audio.newSound(Gdx.files.internal("sfx/ui/click.ogg")); - soundVolume = game.prefs.getInteger("sfx", 10) / 10f; this.stage = new Stage(new FitViewport(800, 600)); Skin skin = new Skin(Gdx.files.internal("sprites/gui/ui.skin")); @@ -45,6 +43,11 @@ public class SplashScreen implements Screen { logoTable.setFillParent(true); logoTable.align(Align.center); + backgroundTint = new Image(skin, "black"); + backgroundTint.setFillParent(true); + backgroundTint.addAction(Actions.alpha(0.5f)); + stage.addActor(backgroundTint); + brandAtlas = new TextureAtlas(Gdx.files.internal("sprites/gui/ilotterytea.atlas")); Image image = new Image(brandAtlas.findRegion("devOld")); @@ -61,43 +64,18 @@ public class SplashScreen implements Screen { logoTable.add(image).size(image.getWidth(), image.getHeight()).padBottom(30f).row(); - // Showing contributors - Table contributorsTable = new Table(); - contributorsSkin = new Skin(Gdx.files.internal("sprites/gui/friends.skin")); + // Extracting drawables of contributors + ArrayList<Drawable> contributors = new ArrayList<>(); + contributorSkin = new Skin(Gdx.files.internal("sprites/gui/friends.skin")); for (int i = 0; i < MaxonConstants.GAME_DEVELOPERS.length; i++) { String name = MaxonConstants.GAME_DEVELOPERS[i][0]; - String url = MaxonConstants.GAME_DEVELOPERS[i][1]; - - ImageButton imageButton = new ImageButton(contributorsSkin, name); - - imageButton.addAction( - Actions.sequence( - Actions.delay(0.5f * i), - Actions.repeat( - RepeatAction.FOREVER, - Actions.sequence( - Actions.moveBy(0f, 20f, 2f, Interpolation.smoother), - Actions.moveBy(0f, -20f, 2f, Interpolation.smoother) - ) - ) - ) - ); - - imageButton.addListener(new ClickListener() { - @Override - public void clicked(InputEvent event, float x, float y) { - super.clicked(event, x, y); - Gdx.net.openURI(url); - clickSound.play(soundVolume); - } - }); - - Cell<ImageButton> cell = contributorsTable.add(imageButton).size(OsUtils.isMobile ? 64f : 32f); - if (i + 1 < MaxonConstants.GAME_DEVELOPERS.length) cell.padRight(OsUtils.isMobile? 32f : 8f); + Drawable icon = contributorSkin.getDrawable(name); + contributors.add(icon); } - logoTable.add(contributorsTable).width(image.getWidth()).padBottom(30f).row(); + // Background + background = new MovingChessBackground(1f, 0f, Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), contributors); // Progress bar bar = new ProgressBar(0f, 100f, 1f, false, skin); @@ -113,9 +91,9 @@ public class SplashScreen implements Screen { private void update() { if (game.assetManager.update() && !assetsLoaded) { - stage.addAction( + backgroundTint.addAction( Actions.sequence( - Actions.alpha(0.0f, 1f), + Actions.alpha(1.0f, 1f), new Action() { @Override public boolean act(float v) { @@ -133,9 +111,13 @@ public class SplashScreen implements Screen { @Override public void render(float delta) { - Gdx.gl.glClearColor(1, 1, 1, 1); + Gdx.gl.glClearColor(0, 0, 0, 1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); + game.batch.begin(); + background.draw(game.batch); + game.batch.end(); + stage.draw(); stage.act(delta); @@ -146,6 +128,7 @@ public class SplashScreen implements Screen { @Override public void resize(int width, int height) { stage.getViewport().update(width, height, true); + background.update(width, height); } @Override public void pause() {} @@ -153,7 +136,6 @@ public class SplashScreen implements Screen { @Override public void hide() { dispose(); } @Override public void dispose() { brandAtlas.dispose(); - contributorsSkin.dispose(); - clickSound.dispose(); + contributorSkin.dispose(); } } diff --git a/core/src/kz/ilotterytea/maxon/ui/MovingChessBackground.java b/core/src/kz/ilotterytea/maxon/ui/MovingChessBackground.java index 3ae73c6..74a9299 100644 --- a/core/src/kz/ilotterytea/maxon/ui/MovingChessBackground.java +++ b/core/src/kz/ilotterytea/maxon/ui/MovingChessBackground.java @@ -7,7 +7,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; public class MovingChessBackground { @@ -33,10 +32,10 @@ public class MovingChessBackground { float velocityY, float screenWidth, float screenHeight, - Drawable... drawables + ArrayList<Drawable> drawables ) { this.tiles = new ArrayList<>(); - this.drawables = Arrays.asList(drawables); + this.drawables = drawables; this.velocityX = velocityX; this.velocityY = velocityY; |
