music analysis page now has album art
This commit is contained in:
parent
f5d3a01e76
commit
d4869d0348
@ -5,6 +5,7 @@ import java.util.concurrent.Executors;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.Preferences;
|
||||
import com.badlogic.gdx.files.FileHandle;
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
import com.badlogic.gdx.utils.Disposable;
|
||||
|
||||
@ -63,4 +64,8 @@ public class MusicInfoController implements Disposable {
|
||||
public Array<MusicInfo> getSongInfoArray() {
|
||||
return songInfoArray;
|
||||
}
|
||||
|
||||
public MusicInfo getInfo(FileHandle filehandle) {
|
||||
return songInfoArray.get(musicList.getMusicList().indexOf(filehandle, true));
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,10 @@
|
||||
package zero1hd.rhythmbullet.desktop.graphics.ui.pages;
|
||||
|
||||
import com.badlogic.gdx.assets.AssetManager;
|
||||
import com.badlogic.gdx.graphics.Texture;
|
||||
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
|
||||
import com.badlogic.gdx.scenes.scene2d.Actor;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Image;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Label;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Slider;
|
||||
@ -10,6 +12,7 @@ import com.badlogic.gdx.scenes.scene2d.ui.Table;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
|
||||
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
|
||||
|
||||
import zero1hd.rhythmbullet.audio.MusicInfo;
|
||||
import zero1hd.rhythmbullet.audio.analyzer.AudioAnalyzer;
|
||||
import zero1hd.rhythmbullet.util.MusicManager;
|
||||
|
||||
@ -17,11 +20,13 @@ public class AnalysisPage extends Page {
|
||||
private boolean confirmed;
|
||||
private AudioAnalyzer aa;
|
||||
private Table table;
|
||||
private Table adjustment;
|
||||
private Label difficultyModLabel, healthModLabel, speedModLabel;
|
||||
private Slider difficultyModifierSlider, healthModifierSlider, speedModifierSlider;
|
||||
private Label diffModPercentLabel, heltModPercentLabel, speeModPercentLabel;
|
||||
private Label progressLabel;
|
||||
private TextButton confirmButton;
|
||||
private Image albumArt;
|
||||
|
||||
public AnalysisPage(Skin skin, AssetManager assets) {
|
||||
setTextureBackground(assets.get("gradients.atlas", TextureAtlas.class).findRegion("red-round"));
|
||||
@ -30,6 +35,7 @@ public class AnalysisPage extends Page {
|
||||
table.defaults().space(10f);
|
||||
addActor(table);
|
||||
|
||||
adjustment = new Table();
|
||||
difficultyModLabel = new Label("Difficulty Modifier: ", skin, "sub-font", skin.getColor("default"));
|
||||
difficultyModifierSlider = new Slider(1, 3, 0.5f, false, skin);
|
||||
diffModPercentLabel = new Label(String.valueOf(difficultyModifierSlider.getValue()) + "x", skin);
|
||||
@ -39,10 +45,10 @@ public class AnalysisPage extends Page {
|
||||
diffModPercentLabel.setText(String.valueOf(difficultyModifierSlider.getValue()) + "x");
|
||||
}
|
||||
});
|
||||
table.add(difficultyModLabel);
|
||||
table.add(difficultyModifierSlider).minWidth(0.5f*getWidth());
|
||||
table.add(diffModPercentLabel).minWidth(diffModPercentLabel.getWidth()*1.5f);
|
||||
table.row();
|
||||
adjustment.add(difficultyModLabel);
|
||||
adjustment.add(difficultyModifierSlider).minWidth(0.5f*getWidth());
|
||||
adjustment.add(diffModPercentLabel).spaceLeft(10f);
|
||||
adjustment.row();
|
||||
healthModLabel = new Label("Health Modifier: ", skin, "sub-font", skin.getColor("default"));
|
||||
healthModifierSlider = new Slider(1f, 3f, 0.5f, false, skin);
|
||||
heltModPercentLabel = new Label(String.valueOf(healthModifierSlider.getValue()) + "x", skin);
|
||||
@ -52,10 +58,10 @@ public class AnalysisPage extends Page {
|
||||
heltModPercentLabel.setText(String.valueOf(healthModifierSlider.getValue()) + "x");
|
||||
}
|
||||
});
|
||||
table.add(healthModLabel);
|
||||
table.add(healthModifierSlider).fillX();
|
||||
table.add(heltModPercentLabel).fillX();
|
||||
table.row();
|
||||
adjustment.add(healthModLabel);
|
||||
adjustment.add(healthModifierSlider).fillX();
|
||||
adjustment.add(heltModPercentLabel).spaceLeft(10f);
|
||||
adjustment.row();
|
||||
speedModLabel = new Label("Speed Modifier: ", skin, "sub-font", skin.getColor("default"));
|
||||
speedModifierSlider = new Slider(1, 3, 0.5f, false, skin);
|
||||
speeModPercentLabel = new Label(String.valueOf(speedModifierSlider.getValue()) + "x", skin);
|
||||
@ -65,10 +71,10 @@ public class AnalysisPage extends Page {
|
||||
speeModPercentLabel.setText(String.valueOf(speedModifierSlider.getValue()) + "x");
|
||||
}
|
||||
});
|
||||
table.add(speedModLabel);
|
||||
table.add(speedModifierSlider).fillX();
|
||||
table.add(speeModPercentLabel).fillX();
|
||||
table.row();
|
||||
adjustment.add(speedModLabel);
|
||||
adjustment.add(speedModifierSlider).fillX();
|
||||
adjustment.add(speeModPercentLabel).spaceLeft(10f);
|
||||
adjustment.row();
|
||||
|
||||
confirmButton = new TextButton("Confirm", skin);
|
||||
confirmButton.addListener(new ChangeListener() {
|
||||
@ -82,17 +88,25 @@ public class AnalysisPage extends Page {
|
||||
}
|
||||
});
|
||||
|
||||
table.add(confirmButton).colspan(3).fillX();
|
||||
table.row();
|
||||
adjustment.add(confirmButton).colspan(3).fillX();
|
||||
adjustment.row();
|
||||
progressLabel = new Label("Loading... ", skin);
|
||||
table.add(progressLabel).colspan(2).left().spaceTop(20f);
|
||||
adjustment.add(progressLabel).colspan(2).left().spaceTop(20f);
|
||||
|
||||
adjustment.debug();
|
||||
}
|
||||
|
||||
public void processSong(MusicManager mm) {
|
||||
public void processSong(MusicManager mm, Texture albumCover, MusicInfo mi) {
|
||||
this.albumArt = new Image(albumCover);
|
||||
confirmButton.setDisabled(false);
|
||||
speedModifierSlider.setDisabled(false);
|
||||
healthModifierSlider.setDisabled(false);
|
||||
difficultyModifierSlider.setDisabled(false);
|
||||
|
||||
table.clear();
|
||||
table.add(this.albumArt).size(adjustment.getMinHeight());
|
||||
table.row();
|
||||
table.add(adjustment);
|
||||
if (aa != null) {
|
||||
aa.dispose();
|
||||
}
|
||||
|
@ -138,7 +138,7 @@ public class MusicSelectionPage extends Page implements Observer {
|
||||
@Override
|
||||
public void changed(ChangeEvent event, Actor actor) {
|
||||
cameraTarget.x = 2.5f*getWidth();
|
||||
ap.processSong(mc.getMusicList().getAudioData(getSelectedMusic()));
|
||||
ap.processSong(mc.getMusicList().getAudioData(getSelectedMusic()), albumCoverTexture, mic.getInfo(getSelectedMusic()));
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -339,6 +339,7 @@ public class MusicSelectionPage extends Page implements Observer {
|
||||
albumCover.setDrawable((new TextureRegionDrawable(new TextureRegion(albumCoverTexture))));
|
||||
} else {
|
||||
albumCover.setDrawable((new TextureRegionDrawable(new TextureRegion(assets.get("defaultCover.png", Texture.class)))));
|
||||
albumCoverTexture = assets.get("defaultCover.png", Texture.class);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user