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.Gdx;
|
||||||
import com.badlogic.gdx.Preferences;
|
import com.badlogic.gdx.Preferences;
|
||||||
|
import com.badlogic.gdx.files.FileHandle;
|
||||||
import com.badlogic.gdx.utils.Array;
|
import com.badlogic.gdx.utils.Array;
|
||||||
import com.badlogic.gdx.utils.Disposable;
|
import com.badlogic.gdx.utils.Disposable;
|
||||||
|
|
||||||
@ -63,4 +64,8 @@ public class MusicInfoController implements Disposable {
|
|||||||
public Array<MusicInfo> getSongInfoArray() {
|
public Array<MusicInfo> getSongInfoArray() {
|
||||||
return songInfoArray;
|
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;
|
package zero1hd.rhythmbullet.desktop.graphics.ui.pages;
|
||||||
|
|
||||||
import com.badlogic.gdx.assets.AssetManager;
|
import com.badlogic.gdx.assets.AssetManager;
|
||||||
|
import com.badlogic.gdx.graphics.Texture;
|
||||||
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
|
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
|
||||||
import com.badlogic.gdx.scenes.scene2d.Actor;
|
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.Label;
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
|
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.Slider;
|
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.ui.TextButton;
|
||||||
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
|
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
|
||||||
|
|
||||||
|
import zero1hd.rhythmbullet.audio.MusicInfo;
|
||||||
import zero1hd.rhythmbullet.audio.analyzer.AudioAnalyzer;
|
import zero1hd.rhythmbullet.audio.analyzer.AudioAnalyzer;
|
||||||
import zero1hd.rhythmbullet.util.MusicManager;
|
import zero1hd.rhythmbullet.util.MusicManager;
|
||||||
|
|
||||||
@ -17,11 +20,13 @@ public class AnalysisPage extends Page {
|
|||||||
private boolean confirmed;
|
private boolean confirmed;
|
||||||
private AudioAnalyzer aa;
|
private AudioAnalyzer aa;
|
||||||
private Table table;
|
private Table table;
|
||||||
|
private Table adjustment;
|
||||||
private Label difficultyModLabel, healthModLabel, speedModLabel;
|
private Label difficultyModLabel, healthModLabel, speedModLabel;
|
||||||
private Slider difficultyModifierSlider, healthModifierSlider, speedModifierSlider;
|
private Slider difficultyModifierSlider, healthModifierSlider, speedModifierSlider;
|
||||||
private Label diffModPercentLabel, heltModPercentLabel, speeModPercentLabel;
|
private Label diffModPercentLabel, heltModPercentLabel, speeModPercentLabel;
|
||||||
private Label progressLabel;
|
private Label progressLabel;
|
||||||
private TextButton confirmButton;
|
private TextButton confirmButton;
|
||||||
|
private Image albumArt;
|
||||||
|
|
||||||
public AnalysisPage(Skin skin, AssetManager assets) {
|
public AnalysisPage(Skin skin, AssetManager assets) {
|
||||||
setTextureBackground(assets.get("gradients.atlas", TextureAtlas.class).findRegion("red-round"));
|
setTextureBackground(assets.get("gradients.atlas", TextureAtlas.class).findRegion("red-round"));
|
||||||
@ -30,6 +35,7 @@ public class AnalysisPage extends Page {
|
|||||||
table.defaults().space(10f);
|
table.defaults().space(10f);
|
||||||
addActor(table);
|
addActor(table);
|
||||||
|
|
||||||
|
adjustment = new Table();
|
||||||
difficultyModLabel = new Label("Difficulty Modifier: ", skin, "sub-font", skin.getColor("default"));
|
difficultyModLabel = new Label("Difficulty Modifier: ", skin, "sub-font", skin.getColor("default"));
|
||||||
difficultyModifierSlider = new Slider(1, 3, 0.5f, false, skin);
|
difficultyModifierSlider = new Slider(1, 3, 0.5f, false, skin);
|
||||||
diffModPercentLabel = new Label(String.valueOf(difficultyModifierSlider.getValue()) + "x", 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");
|
diffModPercentLabel.setText(String.valueOf(difficultyModifierSlider.getValue()) + "x");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
table.add(difficultyModLabel);
|
adjustment.add(difficultyModLabel);
|
||||||
table.add(difficultyModifierSlider).minWidth(0.5f*getWidth());
|
adjustment.add(difficultyModifierSlider).minWidth(0.5f*getWidth());
|
||||||
table.add(diffModPercentLabel).minWidth(diffModPercentLabel.getWidth()*1.5f);
|
adjustment.add(diffModPercentLabel).spaceLeft(10f);
|
||||||
table.row();
|
adjustment.row();
|
||||||
healthModLabel = new Label("Health Modifier: ", skin, "sub-font", skin.getColor("default"));
|
healthModLabel = new Label("Health Modifier: ", skin, "sub-font", skin.getColor("default"));
|
||||||
healthModifierSlider = new Slider(1f, 3f, 0.5f, false, skin);
|
healthModifierSlider = new Slider(1f, 3f, 0.5f, false, skin);
|
||||||
heltModPercentLabel = new Label(String.valueOf(healthModifierSlider.getValue()) + "x", 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");
|
heltModPercentLabel.setText(String.valueOf(healthModifierSlider.getValue()) + "x");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
table.add(healthModLabel);
|
adjustment.add(healthModLabel);
|
||||||
table.add(healthModifierSlider).fillX();
|
adjustment.add(healthModifierSlider).fillX();
|
||||||
table.add(heltModPercentLabel).fillX();
|
adjustment.add(heltModPercentLabel).spaceLeft(10f);
|
||||||
table.row();
|
adjustment.row();
|
||||||
speedModLabel = new Label("Speed Modifier: ", skin, "sub-font", skin.getColor("default"));
|
speedModLabel = new Label("Speed Modifier: ", skin, "sub-font", skin.getColor("default"));
|
||||||
speedModifierSlider = new Slider(1, 3, 0.5f, false, skin);
|
speedModifierSlider = new Slider(1, 3, 0.5f, false, skin);
|
||||||
speeModPercentLabel = new Label(String.valueOf(speedModifierSlider.getValue()) + "x", 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");
|
speeModPercentLabel.setText(String.valueOf(speedModifierSlider.getValue()) + "x");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
table.add(speedModLabel);
|
adjustment.add(speedModLabel);
|
||||||
table.add(speedModifierSlider).fillX();
|
adjustment.add(speedModifierSlider).fillX();
|
||||||
table.add(speeModPercentLabel).fillX();
|
adjustment.add(speeModPercentLabel).spaceLeft(10f);
|
||||||
table.row();
|
adjustment.row();
|
||||||
|
|
||||||
confirmButton = new TextButton("Confirm", skin);
|
confirmButton = new TextButton("Confirm", skin);
|
||||||
confirmButton.addListener(new ChangeListener() {
|
confirmButton.addListener(new ChangeListener() {
|
||||||
@ -82,17 +88,25 @@ public class AnalysisPage extends Page {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
table.add(confirmButton).colspan(3).fillX();
|
adjustment.add(confirmButton).colspan(3).fillX();
|
||||||
table.row();
|
adjustment.row();
|
||||||
progressLabel = new Label("Loading... ", skin);
|
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);
|
confirmButton.setDisabled(false);
|
||||||
speedModifierSlider.setDisabled(false);
|
speedModifierSlider.setDisabled(false);
|
||||||
healthModifierSlider.setDisabled(false);
|
healthModifierSlider.setDisabled(false);
|
||||||
difficultyModifierSlider.setDisabled(false);
|
difficultyModifierSlider.setDisabled(false);
|
||||||
|
|
||||||
|
table.clear();
|
||||||
|
table.add(this.albumArt).size(adjustment.getMinHeight());
|
||||||
|
table.row();
|
||||||
|
table.add(adjustment);
|
||||||
if (aa != null) {
|
if (aa != null) {
|
||||||
aa.dispose();
|
aa.dispose();
|
||||||
}
|
}
|
||||||
|
@ -138,7 +138,7 @@ public class MusicSelectionPage extends Page implements Observer {
|
|||||||
@Override
|
@Override
|
||||||
public void changed(ChangeEvent event, Actor actor) {
|
public void changed(ChangeEvent event, Actor actor) {
|
||||||
cameraTarget.x = 2.5f*getWidth();
|
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))));
|
albumCover.setDrawable((new TextureRegionDrawable(new TextureRegion(albumCoverTexture))));
|
||||||
} else {
|
} else {
|
||||||
albumCover.setDrawable((new TextureRegionDrawable(new TextureRegion(assets.get("defaultCover.png", Texture.class)))));
|
albumCover.setDrawable((new TextureRegionDrawable(new TextureRegion(assets.get("defaultCover.png", Texture.class)))));
|
||||||
|
albumCoverTexture = assets.get("defaultCover.png", Texture.class);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user