diff --git a/core/src/zero1hd/rhythmbullet/screens/CreativeScreen.java b/core/src/zero1hd/rhythmbullet/screens/CreativeScreen.java index bea2c12..1e8a0c9 100755 --- a/core/src/zero1hd/rhythmbullet/screens/CreativeScreen.java +++ b/core/src/zero1hd/rhythmbullet/screens/CreativeScreen.java @@ -26,7 +26,7 @@ public class CreativeScreen extends ScreenAdapter { public CreativeScreen(RhythmBullet core, MainMenu mainMenu) { gamePlayArea = new GamePlayArea(core.getAssetManager(), core.getPrefs()); - ghud = new GameHUD(core.getDefaultSkin(), 100f, gamePlayArea); + ghud = new GameHUD(core.getDefaultSkin(), 100f, gamePlayArea, mainMenu, core); chud = new CreativeHUD(core, mainMenu, gamePlayArea, ghud); inputs = new InputMultiplexer(chud, ghud, gamePlayArea); diff --git a/core/src/zero1hd/rhythmbullet/screens/GameScreen.java b/core/src/zero1hd/rhythmbullet/screens/GameScreen.java index c705c57..9bc4d0a 100755 --- a/core/src/zero1hd/rhythmbullet/screens/GameScreen.java +++ b/core/src/zero1hd/rhythmbullet/screens/GameScreen.java @@ -2,6 +2,7 @@ package zero1hd.rhythmbullet.screens; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.InputMultiplexer; +import com.badlogic.gdx.Screen; import com.badlogic.gdx.ScreenAdapter; import com.badlogic.gdx.graphics.GL20; import com.badlogic.gdx.graphics.Texture; @@ -31,7 +32,7 @@ public class GameScreen extends ScreenAdapter { private ShaderProgram bgShader; private Texture background; - public GameScreen(RhythmBullet core) { + public GameScreen(RhythmBullet core, Screen screen) { this.core = core; // Overlay stuff @@ -47,7 +48,7 @@ public class GameScreen extends ScreenAdapter { }); gameArea = new GamePlayArea(core.getAssetManager(), core.getPrefs()); - gameHUD = new GameHUD(core.getDefaultSkin(), 100f, gameArea); + gameHUD = new GameHUD(core.getDefaultSkin(), 100f, gameArea, screen, core); inputs = new InputMultiplexer(); inputs.addProcessor(gameHUD); inputs.addProcessor(gameArea); diff --git a/core/src/zero1hd/rhythmbullet/ui/pages/AnalyzePage.java b/core/src/zero1hd/rhythmbullet/ui/pages/AnalyzePage.java index 4b89bb5..eba859d 100755 --- a/core/src/zero1hd/rhythmbullet/ui/pages/AnalyzePage.java +++ b/core/src/zero1hd/rhythmbullet/ui/pages/AnalyzePage.java @@ -266,7 +266,7 @@ public class AnalyzePage extends Page implements MiniListener { Gdx.app.postRunnable(new Runnable() { @Override public void run() { - gameScreen = new GameScreen(core); + gameScreen = new GameScreen(core, core.getScreen()); mapGenAlgorithm = new RhythmMapAlgorithm(gameScreen.getGameArea().em, gameScreen.getGameArea().cm, audioAnalyzer, speedModifier.getValue(), healthModifier.getValue(), sensitivityRating.getValue()); mapGenAlgorithm.getSender().addListener(ap); mapGenThread = new Thread(mapGenAlgorithm); @@ -288,6 +288,7 @@ public class AnalyzePage extends Page implements MiniListener { public void changed(ChangeEvent event, Actor actor) { gameScreen.setGamePlayMap(mapGenAlgorithm.getMap()); core.setScreen(gameScreen); + miniSender.send(MiniEvents.BACK); } }); diff --git a/core/src/zero1hd/rhythmbullet/ui/stages/GameHUD.java b/core/src/zero1hd/rhythmbullet/ui/stages/GameHUD.java index e00943f..b48d067 100755 --- a/core/src/zero1hd/rhythmbullet/ui/stages/GameHUD.java +++ b/core/src/zero1hd/rhythmbullet/ui/stages/GameHUD.java @@ -2,6 +2,7 @@ package zero1hd.rhythmbullet.ui.stages; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Input.Keys; +import com.badlogic.gdx.Screen; import com.badlogic.gdx.audio.Music; import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.Pixmap; @@ -18,15 +19,13 @@ import com.badlogic.gdx.scenes.scene2d.ui.Skin; import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener; import zero1hd.rhythmbullet.RhythmBullet; -import zero1hd.rhythmbullet.screens.PreGameScreen; import zero1hd.rhythmbullet.ui.builders.HealthBar; import zero1hd.rhythmbullet.ui.windows.FPSWindow; import zero1hd.rhythmbullet.ui.windows.PauseMenu; -import zero1hd.rhythmbullet.util.MiniEvents; import zero1hd.rhythmbullet.util.ScoreManager; public class GameHUD extends Stage { - private PreGameScreen pgs; + private Screen returnScreen; private Label scoreLabel; private ImageButton pause; private boolean paused; @@ -43,14 +42,14 @@ public class GameHUD extends Stage { private ScoreManager sm; private Color original, bass, um; - public GameHUD(Skin skin, float maxHealth, GamePlayArea gpa, PreGameScreen preGS, final RhythmBullet core) { + public GameHUD(Skin skin, float maxHealth, GamePlayArea gpa, Screen rs, final RhythmBullet core) { super(); scoreLabel = new Label("Score: 0", skin, "default-font", Color.WHITE); scoreLabel.setPosition(10f, Gdx.graphics.getHeight()-scoreLabel.getHeight() - 10f); addActor(scoreLabel); this.sm = gpa.score; this.gpa = gpa; - this.pgs = preGS; + this.returnScreen = rs; pause = new ImageButton(skin.getDrawable("pause"), skin.getDrawable("pause-down")); @@ -78,8 +77,7 @@ public class GameHUD extends Stage { pauseMenu.getQuitButton().addListener(new ChangeListener() { @Override public void changed(ChangeEvent event, Actor actor) { - pgs.ap.miniSender.send(MiniEvents.BACK); - core.setScreen(pgs); + core.setScreen(returnScreen); } }); pauseMenu.setPosition((Gdx.graphics.getWidth()-pauseMenu.getWidth())/2f, (Gdx.graphics.getHeight()-pauseMenu.getHeight())/2f);