diff --git a/frontend/android/assets/glassy/raw/ConfirmationSprite.png b/frontend/android/assets/glassy/raw/ConfirmationSprite.png new file mode 100644 index 0000000000000000000000000000000000000000..90edb606773c8507471d2e2fcd165adf9dd19929 Binary files /dev/null and b/frontend/android/assets/glassy/raw/ConfirmationSprite.png differ diff --git a/frontend/android/assets/glassy/raw/DimmingTexture.png b/frontend/android/assets/glassy/raw/DimmingTexture.png new file mode 100644 index 0000000000000000000000000000000000000000..660a9ad25cc2fc6574570093cd25ca857ef67e71 Binary files /dev/null and b/frontend/android/assets/glassy/raw/DimmingTexture.png differ diff --git a/frontend/android/assets/glassy/raw/ExitButton.png b/frontend/android/assets/glassy/raw/ExitButton.png new file mode 100644 index 0000000000000000000000000000000000000000..feb789f751ee76ad8d6e25bdc7e98609d4e09ee9 Binary files /dev/null and b/frontend/android/assets/glassy/raw/ExitButton.png differ diff --git a/frontend/android/assets/glassy/raw/PauseText.png b/frontend/android/assets/glassy/raw/PauseText.png index 32c2b42a05fa52302d22c006bcde72b22a6b55ff..7496fd7f6ca2aed81453db867919af7c512ae687 100644 Binary files a/frontend/android/assets/glassy/raw/PauseText.png and b/frontend/android/assets/glassy/raw/PauseText.png differ diff --git a/frontend/android/assets/glassy/raw/ResumeButton.png b/frontend/android/assets/glassy/raw/ResumeButton.png new file mode 100644 index 0000000000000000000000000000000000000000..eb15370fced7cb1222d15240f8afe28ee403587a Binary files /dev/null and b/frontend/android/assets/glassy/raw/ResumeButton.png differ diff --git a/frontend/core/src/com/gameware/game/GameWare.java b/frontend/core/src/com/gameware/game/GameWare.java index 2e55349b23b7cb08f049199dc450a0970675b421..3364214f6f2f949f27ef44decefbff5249d95d34 100644 --- a/frontend/core/src/com/gameware/game/GameWare.java +++ b/frontend/core/src/com/gameware/game/GameWare.java @@ -11,6 +11,7 @@ import com.gameware.game.states.BubbleWrapState; import com.gameware.game.models.Player; import com.gameware.game.states.ColorRushState; import com.gameware.game.states.GameStateManager; +import com.gameware.game.states.PauseState; import com.gameware.game.states.PlayStateTemplate; import com.gameware.game.states.LoginState; @@ -70,6 +71,7 @@ public class GameWare extends ApplicationAdapter { toggleMusic(); gsm.push(new LoginState(gsm)); + // try{ // List<Game> games = QueryIntermediate.getGames(); // System.out.println(games); diff --git a/frontend/core/src/com/gameware/game/sprites/ColorRushButton.java b/frontend/core/src/com/gameware/game/sprites/ColorRushButton.java index 9347f873034145a205a988356e9987825f9c4ede..a97e7896c240115b4f68f37c5ca0c5fe9b2c3547 100644 --- a/frontend/core/src/com/gameware/game/sprites/ColorRushButton.java +++ b/frontend/core/src/com/gameware/game/sprites/ColorRushButton.java @@ -48,8 +48,6 @@ public class ColorRushButton extends Sprite{ @Override public void update(float dt) { - position.x = (int) Math.round(position.x); - position.y = (int) Math.round(position.y); } @Override diff --git a/frontend/core/src/com/gameware/game/sprites/ConfirmationBox.java b/frontend/core/src/com/gameware/game/sprites/ConfirmationBox.java new file mode 100644 index 0000000000000000000000000000000000000000..61845202c01414afc90824dfefc16be113984526 --- /dev/null +++ b/frontend/core/src/com/gameware/game/sprites/ConfirmationBox.java @@ -0,0 +1,67 @@ +package com.gameware.game.sprites; + +import com.badlogic.gdx.Gdx; +import com.badlogic.gdx.graphics.Texture; +import com.badlogic.gdx.graphics.g2d.SpriteBatch; +import com.badlogic.gdx.math.Vector3; + +public class ConfirmationBox extends Sprite { + + private Texture boxTexture; + private Vector3 position; + private int width, height; + + public ConfirmationBox(int x, int y, int width, int height){ + this.position = new Vector3(x, y,0); + this.width = width; + this.height = height; + + this.boxTexture = new Texture(Gdx.files.internal("glassy/raw/ConfirmationSprite.png")); + } + + @Override + public void reset() { + + } + + @Override + public void draw(SpriteBatch sb) { + sb.begin(); + sb.draw(this.boxTexture, this.position.x, this.position.y, this.width, this.height); + sb.end(); + } + + @Override + public void update(float dt) { + + } + + @Override + public void dispose() { + this.boxTexture.dispose(); + } + + public boolean yesPressed(int xTouch, int yTouch){ + return xTouch > this.position.x && xTouch < (this.position.x + this.width/2) && yTouch > this.position.y && yTouch < (this.position.y + this.height/2); + } + + public boolean noPressed(int xTouch, int yTouch){ + return xTouch > (this.position.x + this.width/2) && xTouch < (this.position.x + this.width) && yTouch > this.position.y && yTouch < (this.position.y + this.height/2); + } + + public int getX(){ + return (int) this.position.x; + } + + public int getY(){ + return (int) this.position.y; + } + + public int getWidth(){ + return this.width; + } + + public int getHeight(){ + return this.height; + } +} diff --git a/frontend/core/src/com/gameware/game/sprites/PauseButton.java b/frontend/core/src/com/gameware/game/sprites/PauseButton.java index 13936591e8af1866c3761c87afd3c57fa56d885f..2579fa1776cc1961f72144ed5c253fbce476dcf0 100644 --- a/frontend/core/src/com/gameware/game/sprites/PauseButton.java +++ b/frontend/core/src/com/gameware/game/sprites/PauseButton.java @@ -5,34 +5,38 @@ import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.math.Vector3; +import javax.xml.soap.Text; + public class PauseButton extends Sprite { private int width; private int height; private Vector3 position; - private Texture mainTexture; + private Texture blackButtonTexture; + private Texture whiteButtonTexture; + private Texture currentActiveTexture; // Customizable constructor - public PauseButton(int x, int y, int width, int height, Texture pauseButtonTex){ + public PauseButton(int x, int y, int width, int height, Texture blackBtnTex, Texture whiteBtnTex){ this.position = new Vector3(x, y, 0); this.width = width; this.height = height; - this.mainTexture = pauseButtonTex; + this.blackButtonTexture = blackBtnTex; + this.whiteButtonTexture = whiteBtnTex; + + this.currentActiveTexture = blackButtonTexture; } // Constructor with default settings (black button) public PauseButton(){ - this(Gdx.graphics.getWidth() - Gdx.graphics.getWidth()/8,Gdx.graphics.getHeight() - Gdx.graphics.getHeight()/13,Gdx.graphics.getWidth()/10,Gdx.graphics.getWidth()/10, new Texture(Gdx.files.internal("glassy/raw/PauseButtonBlack.png"))); - } - - // Constructor with default settings but customizable texture - public PauseButton(Texture pauseButtonTex){ - this(Gdx.graphics.getWidth() - Gdx.graphics.getWidth()/8,Gdx.graphics.getHeight() - Gdx.graphics.getHeight()/13,Gdx.graphics.getWidth()/10,Gdx.graphics.getWidth()/10, pauseButtonTex); + this(Gdx.graphics.getWidth() - Gdx.graphics.getWidth()/8, + Gdx.graphics.getHeight() - Gdx.graphics.getHeight()/13, + Gdx.graphics.getWidth()/10,Gdx.graphics.getWidth()/10, + new Texture(Gdx.files.internal("glassy/raw/PauseButtonBlack.png")), + new Texture(Gdx.files.internal("glassy/raw/PauseButtonWhite.png"))); } - - @Override public void reset() { @@ -42,7 +46,7 @@ public class PauseButton extends Sprite { public void draw(SpriteBatch sb) { sb.begin(); - sb.draw(this.mainTexture, this.position.x, this.position.y, this.width, this.height); + sb.draw(this.currentActiveTexture, this.position.x, this.position.y, this.width, this.height); sb.end(); } @@ -53,10 +57,23 @@ public class PauseButton extends Sprite { @Override public void dispose() { - this.mainTexture.dispose(); + this.blackButtonTexture.dispose(); + this.whiteButtonTexture.dispose(); } public boolean isPressed(int x, int y){ return x > this.position.x && x < (this.position.x + this.width) && (Gdx.graphics.getHeight() - y) > this.position.y && (Gdx.graphics.getHeight() - y) < (this.position.y + this.height); } + + // The following two methods are used by the minigame-state to change the color of the pause button. + // This can be done during playtime if any future games has a dynamic background and want to + // alternate between using the two different colors on the pause button. + + public void setButtonWhite(){ + this.currentActiveTexture = this.whiteButtonTexture; + } + + public void setButtonBlack(){ + this.currentActiveTexture = this.blackButtonTexture; + } } diff --git a/frontend/core/src/com/gameware/game/sprites/PauseMenuButton.java b/frontend/core/src/com/gameware/game/sprites/PauseMenuButton.java new file mode 100644 index 0000000000000000000000000000000000000000..f116ad9d45c0a3099ea5a9893dfab636bbd1087f --- /dev/null +++ b/frontend/core/src/com/gameware/game/sprites/PauseMenuButton.java @@ -0,0 +1,44 @@ +package com.gameware.game.sprites; + +import com.badlogic.gdx.graphics.Texture; +import com.badlogic.gdx.graphics.g2d.SpriteBatch; +import com.badlogic.gdx.math.Vector3; + +public class PauseMenuButton extends Sprite { + private Texture buttonTexture; + private Vector3 position; + private int width, height; + + public PauseMenuButton(Texture buttonTex, int x, int y, int width, int height){ + this.buttonTexture = buttonTex; + this.width = width; + this.height = height; + + this.position = new Vector3(x, y,0); + } + + @Override + public void reset() { + } + + @Override + public void draw(SpriteBatch sb) { + sb.begin(); + sb.draw(this.buttonTexture, this.position.x, this.position.y, this.width, this.height); + sb.end(); + } + + @Override + public void update(float dt) { + + } + + @Override + public void dispose() { + this.buttonTexture.dispose(); + } + + public boolean isPressed(int xTouch, int yTouch){ + return xTouch > this.position.x && xTouch < (this.position.x + this.width) && yTouch > this.position.y && yTouch < (this.position.y + this.height); + } +} diff --git a/frontend/core/src/com/gameware/game/states/BubbleWrapState.java b/frontend/core/src/com/gameware/game/states/BubbleWrapState.java index f7d7a0b0d60cf0ee42fc56d62dff33cd1a390b2b..6983a16443faf94af7034dd70352165a17d11f3d 100644 --- a/frontend/core/src/com/gameware/game/states/BubbleWrapState.java +++ b/frontend/core/src/com/gameware/game/states/BubbleWrapState.java @@ -1,11 +1,16 @@ package com.gameware.game.states; import com.badlogic.gdx.Gdx; +import com.badlogic.gdx.graphics.Color; +import com.badlogic.gdx.graphics.Pixmap; import com.badlogic.gdx.graphics.Texture; +import com.badlogic.gdx.graphics.g2d.BitmapFont; import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.scenes.scene2d.ui.Container; +import com.badlogic.gdx.scenes.scene2d.ui.Image; import com.badlogic.gdx.scenes.scene2d.ui.Label; import com.badlogic.gdx.scenes.scene2d.ui.Table; +import com.gameware.game.GameWare; import com.gameware.game.sprites.Bubble; import com.gameware.game.sprites.PauseButton; @@ -15,11 +20,10 @@ public class BubbleWrapState extends PlayStateTemplate { private ArrayList<Bubble> bubbles; private int poppedBubbles; - private Texture background; + private Image background; private float currentTime = 0f; private float totalTime = totalGameTime; private Label timeLabel; - private PauseButton pauseButton; private Texture unpopped; private Texture popped1; private Texture popped2; @@ -28,6 +32,8 @@ public class BubbleWrapState extends PlayStateTemplate { public BubbleWrapState(GameStateManager gsm) { super(gsm); + super.setPauseButtonWhite(); + super.screenshot = new Texture(Gdx.files.internal("bubbleWrapPhotoEdit.png")); unpopped = new Texture(Gdx.files.internal("glassy/raw/bubble_unpopped_1.png")); @@ -36,12 +42,23 @@ public class BubbleWrapState extends PlayStateTemplate { popped3 = new Texture(Gdx.files.internal("glassy/raw/bubble_popped_3.png")); this.poppedBubbles = 0; - this.background = new Texture(Gdx.files.internal("glassy/raw/bubblewrap_background.jpg")); - this.pauseButton = new PauseButton(new Texture(Gdx.files.internal("glassy/raw/PauseButtonWhite.png"))); + + this.background = new Image(new Texture(Gdx.files.internal("glassy/raw/bubblewrap_background.jpg"))); + this.background.setWidth(Gdx.graphics.getWidth()); + this.background.setHeight(Gdx.graphics.getHeight()); + stage.addActor(this.background); // Label that displays how much time is left this.timeLabel = new Label("Time left: ", skin); - timeLabel.setPosition(Gdx.graphics.getWidth()/8, Gdx.graphics.getHeight() - Gdx.graphics.getHeight()/10); + + // Changes the label to a white color + BitmapFont font = new BitmapFont(); + font.getData().setScale(Gdx.graphics.getWidth() / GameWare.WIDTH * 2.5f); + Label.LabelStyle style = new Label.LabelStyle(font, Color.WHITE); + timeLabel.setStyle(style); + + timeLabel.setPosition(Gdx.graphics.getWidth()/2 - timeLabel.getWidth() / 2f, Gdx.graphics.getHeight() - Gdx.graphics.getHeight()/10); + stage.addActor(timeLabel); @@ -63,16 +80,18 @@ public class BubbleWrapState extends PlayStateTemplate { } } + // Keeps score consistent + this.setScore(this.poppedBubbles); + // Checks if the pause button was pressed - if(this.pauseButton.isPressed(Gdx.input.getX(), Gdx.input.getY())){ - this.gsm.push(new PauseState(this.gsm)); - } + super.checkPause(); } } @Override public void update(float dt) { Gdx.input.setInputProcessor(stage); + this.handleInput(); this.currentTime += dt; @@ -95,12 +114,10 @@ public class BubbleWrapState extends PlayStateTemplate { // Stage uses a Batch to draw @Override public void render(SpriteBatch sb) { - stage.getBatch().begin(); - stage.getBatch().draw(this.background, 0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); - stage.getBatch().end(); stage.draw(); - this.pauseButton.draw(sb); + // Renders pause button + super.renderPauseButton(sb); } @@ -157,8 +174,7 @@ public class BubbleWrapState extends PlayStateTemplate { this.popped1.dispose(); this.popped2.dispose(); this.popped3.dispose(); - this.pauseButton.dispose(); - background.dispose(); + super.pauseButton.dispose(); } @Override diff --git a/frontend/core/src/com/gameware/game/states/ColorRushState.java b/frontend/core/src/com/gameware/game/states/ColorRushState.java index 1ffaceb81f05439648eaea8e95cbb0e09cacb187..c6693667febb8914562ff0d9a51b4f9e1591a9f4 100644 --- a/frontend/core/src/com/gameware/game/states/ColorRushState.java +++ b/frontend/core/src/com/gameware/game/states/ColorRushState.java @@ -30,8 +30,6 @@ public class ColorRushState extends PlayStateTemplate { private boolean buttonsEnabled = true; private boolean disposeTargetLeft = true; - private PauseButton pauseButton; - public ColorRushState(GameStateManager gsm){ super(gsm); super.screenshot = new Texture(Gdx.files.internal("colorRushPhotoEdit.png")); @@ -39,9 +37,6 @@ public class ColorRushState extends PlayStateTemplate { // Creates the background this.background = new Texture(Gdx.files.internal("glassy/raw/ColorRushBackground.jpg")); - // Creates the pause button - this.pauseButton = new PauseButton(); - // Creates the bitmapfont font = new BitmapFont(); font.setColor(Color.BLACK); @@ -71,6 +66,7 @@ public class ColorRushState extends PlayStateTemplate { buttons.add(new ColorRushButton(Gdx.graphics.getWidth()/2, Gdx.graphics.getHeight()/8,Gdx.graphics.getWidth()/2,Gdx.graphics.getHeight()/8, this.colorTextures.get(3), this.disabledColorTexture, 3)); + // Parameters for the targets int targetWidth = Gdx.graphics.getWidth()/8; int targetHeight = Gdx.graphics.getWidth()/8; int targetX = Gdx.graphics.getWidth()/2 - targetWidth/2; @@ -105,10 +101,11 @@ public class ColorRushState extends PlayStateTemplate { } } - // Checks if the pause button was pressed - if(this.pauseButton.isPressed(Gdx.input.getX(), Gdx.input.getY())){ - this.gsm.push(new PauseState(this.gsm)); - } + // Keeps score consistent + this.setScore(this.targetsHit); + + //Pauses the game if the user pressed the pause button + super.checkPause(); } } @@ -179,7 +176,8 @@ public class ColorRushState extends PlayStateTemplate { sb.end(); - this.pauseButton.draw(sb); + // Renders pause button + super.renderPauseButton(sb); for (ColorRushButton button : this.buttons) { button.draw(sb); @@ -217,6 +215,7 @@ public class ColorRushState extends PlayStateTemplate { this.font.dispose(); this.background.dispose(); this.disabledColorTexture.dispose(); + super.pauseButton.dispose(); } @Override diff --git a/frontend/core/src/com/gameware/game/states/PauseState.java b/frontend/core/src/com/gameware/game/states/PauseState.java index 4ef33b946354ba3d903c1fbd72accfc39fa053e4..8dccc6cd8c050b78bf8a3ec7420a1bdc766fb44d 100644 --- a/frontend/core/src/com/gameware/game/states/PauseState.java +++ b/frontend/core/src/com/gameware/game/states/PauseState.java @@ -1,34 +1,50 @@ package com.gameware.game.states; import com.badlogic.gdx.Gdx; -import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.Texture; -import com.badlogic.gdx.graphics.g2d.Animation; import com.badlogic.gdx.graphics.g2d.SpriteBatch; -import com.badlogic.gdx.graphics.g2d.TextureRegion; import com.badlogic.gdx.graphics.glutils.ShapeRenderer; -import com.gameware.game.sprites.LoadingCircle; +import com.gameware.game.sprites.ConfirmationBox; import com.gameware.game.sprites.PauseCircle; +import com.gameware.game.sprites.PauseMenuButton; import java.util.ArrayList; import java.util.List; -import sun.awt.image.GifImageDecoder; - public class PauseState extends State { private ShapeRenderer sr; private List<PauseCircle> pauseCircles; private Texture background; private Texture pauseText; - - public PauseState(GameStateManager gsm) { + private Texture dimmingTexture; + private ConfirmationBox confirmationBox; + private PauseMenuButton resumeButton; + private PauseMenuButton exitButton; + private boolean needsConfirmation; + private PlayStateTemplate pausedGame; + + public PauseState(GameStateManager gsm, PlayStateTemplate pausedGame) { super(gsm); this.background = new Texture(Gdx.files.internal("glassy/raw/PauseBackground.jpg")); this.pauseText = new Texture(Gdx.files.internal("glassy/raw/PauseText.png")); + this.dimmingTexture = new Texture(Gdx.files.internal("glassy/raw/DimmingTexture.png")); this.pauseCircles = new ArrayList<PauseCircle>(); + this.pausedGame = pausedGame; + + int confirmationBoxWidth = Gdx.graphics.getWidth()*7/8; + int confirmationBoxHeight = confirmationBoxWidth/2; + this.confirmationBox = new ConfirmationBox(Gdx.graphics.getWidth()/2 - confirmationBoxWidth/2, Gdx.graphics.getHeight()/2 - confirmationBoxHeight/2, confirmationBoxWidth, confirmationBoxHeight); + this.needsConfirmation = false; + + int buttonWidth = Gdx.graphics.getWidth()/3; + int buttonHeight = buttonWidth/2; + this.resumeButton = new PauseMenuButton(new Texture(Gdx.files.internal("glassy/raw/ResumeButton.png")), buttonWidth/3, Gdx.graphics.getHeight()/7, buttonWidth, buttonHeight); + this.exitButton = new PauseMenuButton(new Texture(Gdx.files.internal("glassy/raw/ExitButton.png")), buttonWidth + buttonWidth*2/3, Gdx.graphics.getHeight()/7, buttonWidth, buttonHeight); + + for(int i = 0; i<25; i++){ this.pauseCircles.add(new PauseCircle()); } @@ -37,7 +53,33 @@ public class PauseState extends State { @Override protected void handleInput() { if(Gdx.input.justTouched()){ - this.gsm.pop(); + int touchX = Gdx.input.getX(); + int touchY = Gdx.graphics.getHeight() - Gdx.input.getY(); + + if(this.needsConfirmation) { + // User doesn't want to exit after all + if(this.confirmationBox.noPressed(touchX, touchY)) { + this.needsConfirmation = false; + } + + // User confirms the exit, posts the current score + if(this.confirmationBox.yesPressed(touchX, touchY)) { + this.gsm.pop(); + this.pausedGame.gameDone(); + } + } + + else { + // Resumes the game + if(this.resumeButton.isPressed(touchX, touchY)){ + this.gsm.pop(); + } + + // First step of exitting; user now needs to confirm the exit via the popup + if(this.exitButton.isPressed(touchX, touchY)){ + this.needsConfirmation = true; + } + } } } @@ -66,15 +108,31 @@ public class PauseState extends State { } - int scrollWidth = Gdx.graphics.getWidth()/2; - int scrollHeight = Gdx.graphics.getWidth()/4; + // Draws the two bu + this.resumeButton.draw(sb); + this.exitButton.draw(sb); + + int textWidth = Gdx.graphics.getWidth()/2; + int textHeight = textWidth/15*4; sb.begin(); - // Pause scroll - sb.draw(this.pauseText, Gdx.graphics.getWidth()/2 - scrollWidth/2 , Gdx.graphics.getHeight()*3/4, scrollWidth, scrollHeight); + // Pause text + sb.draw(this.pauseText, Gdx.graphics.getWidth()/2 - textWidth/2 , Gdx.graphics.getHeight()*7/10, textWidth, textHeight); + + // Dimming layer that dims everything except the confirmation box when the + // user needs to confirm exit + if(this.needsConfirmation) { + sb.draw(this.dimmingTexture, 0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); + } sb.end(); + + // Needs confirmation if the user has pressed the exit button + if(this.needsConfirmation){ + this.confirmationBox.draw(sb); + } + } @Override @@ -85,6 +143,10 @@ public class PauseState extends State { this.background.dispose(); this.pauseText.dispose(); + this.resumeButton.dispose(); + this.exitButton.dispose(); + this.confirmationBox.dispose(); + this.dimmingTexture.dispose(); } @Override diff --git a/frontend/core/src/com/gameware/game/states/PlayStateTemplate.java b/frontend/core/src/com/gameware/game/states/PlayStateTemplate.java index 83bae43491a5be273acd8d720140af244029f703..12c2656c505a82154e0f93d0ec0d52d6f1486498 100644 --- a/frontend/core/src/com/gameware/game/states/PlayStateTemplate.java +++ b/frontend/core/src/com/gameware/game/states/PlayStateTemplate.java @@ -1,12 +1,15 @@ package com.gameware.game.states; +import com.badlogic.gdx.Gdx; import com.badlogic.gdx.graphics.Texture; +import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.gameware.game.GameWare; import com.gameware.game.QueryIntermediate; import com.gameware.game.models.Round; import com.gameware.game.models.RoundCheck; import com.gameware.game.models.Tournament; +import com.gameware.game.sprites.PauseButton; import java.io.IOException; @@ -15,12 +18,21 @@ public abstract class PlayStateTemplate extends State { private int score; private Round round = null; private Tournament tournament = null; + private Round nextRound = null; + protected PauseButton pauseButton; private Round updatedRound = null; protected float totalGameTime = 30f; protected Texture screenshot = null; public PlayStateTemplate(GameStateManager gsm){ super(gsm); + + // Default pause button (black color) + this.pauseButton = new PauseButton(); + } + + public void renderPauseButton(SpriteBatch sb){ + this.pauseButton.draw(sb); } public void setRound(Round r){ @@ -91,5 +103,22 @@ public abstract class PlayStateTemplate extends State { updatedRound = QueryIntermediate.putRoundScore(round.get_id(),tournament.get_id(), this.score); } } + + // Checks if the pause button was pressed, and pauses the minigame accordingly + public void checkPause(){ + if(this.pauseButton.isPressed(Gdx.input.getX(), Gdx.input.getY())){ + this.gsm.push(new PauseState(this.gsm, this)); + } + } + + // Changes the color of the pause button to white + public void setPauseButtonWhite(){ + this.pauseButton.setButtonWhite(); + } + + // Changes the color of the pause button back to black if it was previously changed to white + public void setPauseButtonBlack(){ + this.pauseButton.setButtonBlack(); + } }