cancel button for analysis page

This commit is contained in:
Harrison Deng 2018-01-17 14:03:25 -06:00
parent 4a37371fd4
commit 6c1981d60b
3 changed files with 16 additions and 3 deletions

View File

@ -34,7 +34,7 @@ public class AudioAnalyzer implements Disposable {
exec.submit(pdr);
}
public void stop() {
private void stop() {
sfar.work = false;
tcr.work = false;
pfr.work = false;

View File

@ -1,9 +1,11 @@
package zero1hd.rhythmbullet.desktop.graphics.ui.pages;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.assets.AssetManager;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
import com.badlogic.gdx.math.Vector3;
import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.ui.Image;
import com.badlogic.gdx.scenes.scene2d.ui.Label;
@ -19,6 +21,7 @@ import zero1hd.rhythmbullet.util.MusicManager;
public class AnalysisPage extends Page {
private boolean confirmed;
private TextButton backButton;
private AudioAnalyzer aa;
private Table table;
private Table adjustment;
@ -29,7 +32,7 @@ public class AnalysisPage extends Page {
private TextButton confirmButton;
private Image albumArt;
public AnalysisPage(Skin skin, AssetManager assets) {
public AnalysisPage(Skin skin, AssetManager assets, Vector3 cameraPosition) {
setTextureBackground(assets.get("gradients.atlas", TextureAtlas.class).findRegion("red-round"));
setBgColor(Color.toFloatBits(82,111,157, 255));
table = new Table();
@ -95,6 +98,16 @@ public class AnalysisPage extends Page {
progressLabel = new Label("Loading... ", skin);
adjustment.add(progressLabel).colspan(2).left().spaceTop(20f);
backButton = new TextButton("Cancel", skin);
backButton.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
cameraPosition.x = 1.5f*Gdx.graphics.getWidth();
aa.dispose();
}
});
backButton.setPosition(15, getHeight()-backButton.getHeight()-25);
addActor(backButton);
}
public void processSong(MusicManager mm, Texture albumCover, MusicInfo mi) {

View File

@ -102,7 +102,7 @@ public class MainMenu extends ScreenAdapter implements AdvancedResizeScreen {
creditsPage.setPosition(0, Gdx.graphics.getHeight());
stage.addActor(creditsPage);
analysisPage = new AnalysisPage(core.getDefaultSkin(),core.getAssetManager());
analysisPage = new AnalysisPage(core.getDefaultSkin(),core.getAssetManager(), cameraPosition);
analysisPage.setPosition(2*Gdx.graphics.getWidth(), 0f);
stage.addActor(analysisPage);