Skip to content

Commit

Permalink
Credits!
Browse files Browse the repository at this point in the history
  • Loading branch information
mklemmingen committed Dec 29, 2023
1 parent 0960fbb commit 549e200
Show file tree
Hide file tree
Showing 8 changed files with 142 additions and 74 deletions.
Binary file added assets/Misc/credits.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/Misc/credits.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/Misc/extendedCredits.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/Misc/extendedCredits.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 10 additions & 2 deletions core/src/com/boomchess/game/BoomChess.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

// -----------------------------------------------------------------------------------------


Expand All @@ -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();

Expand Down Expand Up @@ -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
Expand Down
105 changes: 94 additions & 11 deletions core/src/com/boomchess/game/frontend/stage/CreditsStage.java
Original file line number Diff line number Diff line change
@@ -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 {

Expand All @@ -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<Image> 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<Image> 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);
}
}
57 changes: 3 additions & 54 deletions core/src/com/boomchess/game/frontend/stage/MenuStage.java
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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() {
Expand All @@ -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) {
Expand Down
42 changes: 35 additions & 7 deletions core/src/com/boomchess/game/frontend/stage/OptionsStage.java
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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) {
Expand All @@ -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) {
Expand All @@ -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) {
Expand All @@ -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) {
Expand All @@ -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) {
Expand Down

0 comments on commit 549e200

Please sign in to comment.