diff --git a/assets/Misc/credits.jpg b/assets/Misc/credits.jpg new file mode 100644 index 0000000..fdb2e03 Binary files /dev/null and b/assets/Misc/credits.jpg differ diff --git a/assets/Misc/credits.png b/assets/Misc/credits.png new file mode 100644 index 0000000..92d0402 Binary files /dev/null and b/assets/Misc/credits.png differ diff --git a/assets/Misc/extendedCredits.jpg b/assets/Misc/extendedCredits.jpg new file mode 100644 index 0000000..eb5d860 Binary files /dev/null and b/assets/Misc/extendedCredits.jpg differ diff --git a/assets/Misc/extendedCredits.png b/assets/Misc/extendedCredits.png new file mode 100644 index 0000000..071d616 Binary files /dev/null and b/assets/Misc/extendedCredits.png differ diff --git a/core/src/com/boomchess/game/BoomChess.java b/core/src/com/boomchess/game/BoomChess.java index 0a35423..1305dd5 100644 --- a/core/src/com/boomchess/game/BoomChess.java +++ b/core/src/com/boomchess/game/BoomChess.java @@ -269,6 +269,11 @@ public class BoomChess extends ApplicationAdapter { public static Stage inGamOptStage; public static Texture clipBoard; + // extended Credits + + public static Texture credits; + public static Texture extendedCredits; + // ----------------------------------------------------------------------------------------- @@ -280,9 +285,7 @@ public void create() { // loading Screen is going till loading complete and main menu starts ---------------------------- loadingScreenTextures = new RandomImage(); - loadingScreenTextures.addTexture("loadingScreen/loadingScreen.png"); loadingScreenTextures.addTexture("loadingScreen/loadingScreen2.png"); - loadingScreenTextures.addTexture("loadingScreen/loadingScreen3.png"); loadingSound = Gdx.audio.newSound(Gdx.files.internal("sounds/countdown.mp3")); loadingStage = LoadingScreenStage.initalizeUI(); @@ -767,6 +770,11 @@ private static void loadAllAssets(){ wrongMoveLogo = new Texture("Misc/WrongMove.png"); + // credits + + credits = new Texture("Misc/credits.png"); + extendedCredits = new Texture("Misc/extendedCredits.png"); + // load the menu music menu_music = Gdx.audio.newMusic(Gdx.files.internal diff --git a/core/src/com/boomchess/game/frontend/stage/CreditsStage.java b/core/src/com/boomchess/game/frontend/stage/CreditsStage.java index b3486ff..9bce1c3 100644 --- a/core/src/com/boomchess/game/frontend/stage/CreditsStage.java +++ b/core/src/com/boomchess/game/frontend/stage/CreditsStage.java @@ -1,14 +1,14 @@ package com.boomchess.game.frontend.stage; +import com.badlogic.gdx.Gdx; import com.badlogic.gdx.scenes.scene2d.Actor; import com.badlogic.gdx.scenes.scene2d.Stage; -import com.badlogic.gdx.scenes.scene2d.ui.Table; -import com.badlogic.gdx.scenes.scene2d.ui.TextButton; +import com.badlogic.gdx.scenes.scene2d.ui.*; import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener; +import com.badlogic.gdx.utils.Scaling; import com.boomchess.game.BoomChess; -import static com.boomchess.game.BoomChess.skin; -import static com.boomchess.game.BoomChess.tileSize; +import static com.boomchess.game.BoomChess.*; public class CreditsStage { @@ -17,24 +17,107 @@ public static Stage initializeUI() { // Begin of Options Menu Layout - Root Table arranges content automatically and adaptively as ui-structure final Table root = new Table(); - root.setFillParent(true); - creditsStage.addActor(root); - // TODO add long list of names of people who worked on the game, what they did, sources and tools used + // ---------------------- Credits Image ---------------------------------------------------------- + + Image credits = new Image(BoomChess.credits); + + credits.setScaling(Scaling.fit); // Set scaling to fit + + // Wrap in a container for better control + Container container = new Container<>(credits); + container.setClip(true); // Enable clipping if necessary + container.prefSize(tileSize*12, tileSize*7); // Set preferred size + + Stack creditsStack = new Stack(); + creditsStack.add(container); // Add container to the stack + + // Add stack to the root table and adjust layout + root.add(creditsStack).center(); // Expand, fill, and center in the table cell + root.row().left(); // Move to the next row for other UI elements + + //---------------------- Buttons ----------------------------------------------------------- + + // extended credits button + TextButton extendedCreditsButton = new TextButton("Sound Credits", skin); + root.add(extendedCreditsButton).center().padBottom(tileSize/8); + extendedCreditsButton.addListener(new ChangeListener() { + @Override + public void changed(ChangeListener.ChangeEvent event, Actor actor) { + createExtendedCredits(); + } + }); - // https://javadoc.io/doc/com.badlogicgames.gdx/gdx/latest/com/badlogic/gdx/scenes/scene2d/ui/TextArea.html - // so called TextArea Widget used for displaying text in a scrollable box + root.row().left(); // back button to return to the main menu TextButton backButton = new TextButton("Back", skin); - root.add(backButton).padBottom(tileSize/4); + root.add(backButton).center(); backButton.addListener(new ChangeListener() { @Override public void changed(ChangeListener.ChangeEvent event, Actor actor) { BoomChess.createMainMenuStage(); } }); - root.row(); + + root.row().left(); + + //------------------------------------------------------------------------------------------ + + // Set root to expand and fill the stage + root.setFillParent(true); + + creditsStage.addActor(root); + return creditsStage; } + + public static void createExtendedCredits(){ + + Stage creditsStage = new Stage(); + + // Begin of Options Menu Layout - Root Table arranges content automatically and adaptively as ui-structure + final Table root = new Table(); + + // ---------------------- Credits Image ---------------------------------------------------------- + + Image credits = new Image(BoomChess.extendedCredits); + + credits.setScaling(Scaling.fit); // Set scaling to fit + + // Wrap in a container for better control + Container container = new Container<>(credits); + container.setClip(true); // Enable clipping if necessary + container.prefSize(tileSize*12, tileSize*7); // Set preferred size + + Stack creditsStack = new Stack(); + creditsStack.add(container); // Add container to the stack + + // Add stack to the root table and adjust layout + root.add(creditsStack).center(); // Expand, fill, and center in the table cell + root.row().left(); // Move to the next row for other UI elements + + //---------------------- Buttons ----------------------------------------------------------- + + // back button to return to the main menu + TextButton backButton = new TextButton("Back", skin); + root.add(backButton).center(); + backButton.addListener(new ChangeListener() { + @Override + public void changed(ChangeListener.ChangeEvent event, Actor actor) { + createCreditsStage(); + } + }); + + root.row().left(); + + //------------------------------------------------------------------------------------------ + + // Set root to expand and fill the stage + root.setFillParent(true); + + creditsStage.addActor(root); + + switchToStage(creditsStage); + } } diff --git a/core/src/com/boomchess/game/frontend/stage/MenuStage.java b/core/src/com/boomchess/game/frontend/stage/MenuStage.java index d989690..a9c32a9 100644 --- a/core/src/com/boomchess/game/frontend/stage/MenuStage.java +++ b/core/src/com/boomchess/game/frontend/stage/MenuStage.java @@ -97,8 +97,8 @@ public void changed(ChangeEvent event, Actor actor) { }); root.row(); - TextButton playBotButton = new TextButton("Play Against Computer: " + botDifficulty, skin); - root.add(playBotButton).padBottom(tileSize/40); + TextButton playBotButton = new TextButton("Play Against Computer", skin); + root.add(playBotButton).padBottom(tileSize/4); playBotButton.addListener(new ChangeListener() { @Override public void changed(ChangeEvent event, Actor actor) { @@ -133,57 +133,6 @@ public void changed(ChangeEvent event, Actor actor) { }); root.row(); - // button to change bot difficulty - // text that displays a text saying "Bot Difficulty" - final TextButton botDifficultyText = new TextButton("Change Bot", skin); - root.add(botDifficultyText).padBottom(tileSize/4); - botDifficultyText.addListener(new ChangeListener() { - @Override - public void changed(ChangeEvent event, Actor actor) { - switch (botDifficulty) { - case "easy": - botDifficulty = "medium"; - break; - case "medium": - botDifficulty = "hard"; - break; - case "hard": - botDifficulty = "easy"; - break; - } - BoomChess.createMainMenuStage(); - } - }); - root.row(); - - // Change Mode button to switch medieval and modern - String currentMode; - if(isMedievalMode){ - currentMode = "Medieval"; - } - else{ - currentMode = "Modern"; - } - TextButton modeButton = new TextButton("Switch Mode: " + currentMode, skin); - root.add(modeButton).padBottom(tileSize/4); - modeButton.addListener(new ChangeListener() { - @Override - public void changed(ChangeListener.ChangeEvent event, Actor actor) { - if(isMedievalMode){ - isMedievalMode = false; - isBeepMode = false; - createMapStage(); - } - else{ - isMedievalMode = true; - isBeepMode = true; - createMapStage(); - } - BoomChess.createMainMenuStage(); - } - }); - root.row(); - TextButton optionsButton = new TextButton("Options", skin); root.add(optionsButton).padBottom(tileSize/4); optionsButton.addListener(new ChangeListener() { @@ -205,7 +154,7 @@ public void changed(ChangeEvent event, Actor actor) { root.row(); TextButton exitButton = new TextButton("Exit", skin); - root.add(exitButton).padBottom(tileSize/40).padRight(tileSize/4); + root.add(exitButton).padBottom(tileSize/4).padRight(tileSize/4); exitButton.addListener(new ChangeListener() { @Override public void changed(ChangeEvent event, Actor actor) { diff --git a/core/src/com/boomchess/game/frontend/stage/OptionsStage.java b/core/src/com/boomchess/game/frontend/stage/OptionsStage.java index 8ea49a5..507faf5 100644 --- a/core/src/com/boomchess/game/frontend/stage/OptionsStage.java +++ b/core/src/com/boomchess/game/frontend/stage/OptionsStage.java @@ -23,7 +23,7 @@ public static Stage initalizeUI() { // text that displays a text saying "Bot Difficulty" String currentDif = botDifficulty; final TextButton botDifficultyText = new TextButton("Bot Difficulty: " + currentDif, skin); - root.add(botDifficultyText).padBottom(tileSize/2); + root.add(botDifficultyText).padBottom(tileSize/8); botDifficultyText.addListener(new ChangeListener() { @Override public void changed(ChangeEvent event, Actor actor) { @@ -43,16 +43,44 @@ public void changed(ChangeEvent event, Actor actor) { }); root.row(); + // Change Mode button to switch medieval and modern + String currentGameMode; + if(isMedievalMode){ + currentGameMode = "Medieval"; + } + else{ + currentGameMode = "Modern"; + } + TextButton modeGameButton = new TextButton("Switch Mode: " + currentGameMode, skin); + root.add(modeGameButton).padBottom(tileSize/8); + modeGameButton.addListener(new ChangeListener() { + @Override + public void changed(ChangeListener.ChangeEvent event, Actor actor) { + if(isMedievalMode){ + isMedievalMode = false; + isBeepMode = false; + createMapStage(); + } + else{ + isMedievalMode = true; + isBeepMode = true; + createMapStage(); + } + BoomChess.createOptionsStage(); + } + }); + root.row(); + // text that displays a text saying "Number of Obstacles" final TextButton numberObstaclesText = new TextButton("Number of Obstacles 0-10", skin); - root.add(numberObstaclesText).padBottom(tileSize/8); + root.add(numberObstaclesText).padBottom(tileSize/12); root.row(); // slider for setting the number of obstacles in the initial no mans land final Slider obstacleSlider; obstacleSlider = new Slider(0, 10, 1f, false, skin); obstacleSlider.setValue(numberObstacle); - root.add(obstacleSlider).padBottom(tileSize/2); + root.add(obstacleSlider).padBottom(tileSize/8); obstacleSlider.addListener(new ChangeListener() { @Override public void changed(ChangeEvent event, Actor actor) { @@ -70,7 +98,7 @@ public void changed(ChangeEvent event, Actor actor) { currentMode = "Green"; } TextButton modeButton = new TextButton("Switch 1.Player Colour: " + currentMode, skin); - root.add(modeButton).padBottom(tileSize/2); + root.add(modeButton).padBottom(tileSize/8); modeButton.addListener(new ChangeListener() { @Override public void changed(ChangeListener.ChangeEvent event, Actor actor) { @@ -89,7 +117,7 @@ public void changed(ChangeListener.ChangeEvent event, Actor actor) { currentBeepMode = "Battlefield"; } TextButton beepModeButton = new TextButton("Speech Bubbles: " + currentBeepMode, skin); - root.add(beepModeButton).padBottom(tileSize/2); + root.add(beepModeButton).padBottom(tileSize/8); beepModeButton.addListener(new ChangeListener() { @Override public void changed(ChangeListener.ChangeEvent event, Actor actor) { @@ -102,7 +130,7 @@ public void changed(ChangeListener.ChangeEvent event, Actor actor) { // button for turning the arm on and off root.row().padBottom(tileSize/8); TextButton armButton = new TextButton("BotArm: " + showArm, skin); - root.add(armButton).padBottom(tileSize/2); + root.add(armButton).padBottom(tileSize/8); armButton.addListener(new ChangeListener() { @Override public void changed(ChangeEvent event, Actor actor) { @@ -116,7 +144,7 @@ public void changed(ChangeEvent event, Actor actor) { // back button to return to the main menu TextButton backButton = new TextButton("Back", skin); - root.add(backButton).padBottom(tileSize/4); + root.add(backButton).padBottom(tileSize/8); backButton.addListener(new ChangeListener() { @Override public void changed(ChangeListener.ChangeEvent event, Actor actor) {