added proper menu screen controller for music playback; changed valid bin range for visualizer
This commit is contained in:
parent
d75f9692de
commit
871e667707
@ -12,14 +12,6 @@ check-off
|
|||||||
orig: 14, 14
|
orig: 14, 14
|
||||||
offset: 0, 0
|
offset: 0, 0
|
||||||
index: -1
|
index: -1
|
||||||
textfield
|
|
||||||
rotate: false
|
|
||||||
xy: 11, 5
|
|
||||||
size: 14, 14
|
|
||||||
split: 3, 3, 3, 3
|
|
||||||
orig: 14, 14
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
check-on
|
check-on
|
||||||
rotate: false
|
rotate: false
|
||||||
xy: 125, 35
|
xy: 125, 35
|
||||||
@ -28,6 +20,22 @@ check-on
|
|||||||
orig: 14, 14
|
orig: 14, 14
|
||||||
offset: 0, 0
|
offset: 0, 0
|
||||||
index: -1
|
index: -1
|
||||||
|
check-disabled
|
||||||
|
rotate: false
|
||||||
|
xy: 192, 20
|
||||||
|
size: 14, 14
|
||||||
|
split: 5, 5, 5, 5
|
||||||
|
orig: 14, 14
|
||||||
|
offset: 0, 0
|
||||||
|
index: -1
|
||||||
|
textfield
|
||||||
|
rotate: false
|
||||||
|
xy: 11, 5
|
||||||
|
size: 14, 14
|
||||||
|
split: 3, 3, 3, 3
|
||||||
|
orig: 14, 14
|
||||||
|
offset: 0, 0
|
||||||
|
index: -1
|
||||||
cursor
|
cursor
|
||||||
rotate: false
|
rotate: false
|
||||||
xy: 23, 1
|
xy: 23, 1
|
||||||
@ -224,15 +232,15 @@ white
|
|||||||
pause
|
pause
|
||||||
rotate: false
|
rotate: false
|
||||||
xy: 1, 50
|
xy: 1, 50
|
||||||
size: 44, 44
|
size: 45, 45
|
||||||
orig: 44, 44
|
orig: 45, 45
|
||||||
offset: 0, 0
|
offset: 0, 0
|
||||||
index: -1
|
index: -1
|
||||||
pause-down
|
pause-down
|
||||||
rotate: false
|
rotate: false
|
||||||
xy: 46, 50
|
xy: 1, 96
|
||||||
size: 44, 44
|
size: 45, 45
|
||||||
orig: 44, 44
|
orig: 45, 45
|
||||||
offset: 0, 0
|
offset: 0, 0
|
||||||
index: -1
|
index: -1
|
||||||
bar-fill
|
bar-fill
|
||||||
@ -267,32 +275,67 @@ left-button-down
|
|||||||
orig: 12, 20
|
orig: 12, 20
|
||||||
offset: 0, 0
|
offset: 0, 0
|
||||||
index: -1
|
index: -1
|
||||||
arrow
|
play
|
||||||
rotate: false
|
rotate: false
|
||||||
xy: 91, 50
|
xy: 47, 50
|
||||||
size: 44, 44
|
size: 45, 45
|
||||||
orig: 44, 44
|
orig: 45, 45
|
||||||
|
offset: 0, 0
|
||||||
|
index: -1
|
||||||
|
play-down
|
||||||
|
rotate: false
|
||||||
|
xy: 47, 96
|
||||||
|
size: 45, 45
|
||||||
|
orig: 45, 45
|
||||||
|
offset: 0, 0
|
||||||
|
index: -1
|
||||||
|
fast-forward
|
||||||
|
rotate: false
|
||||||
|
xy: 93, 50
|
||||||
|
size: 45, 45
|
||||||
|
orig: 45, 45
|
||||||
|
offset: 0, 0
|
||||||
|
index: -1
|
||||||
|
fast-forward-down
|
||||||
|
rotate: false
|
||||||
|
xy: 93, 96
|
||||||
|
size: 45, 45
|
||||||
|
orig: 45, 45
|
||||||
|
offset: 0, 0
|
||||||
|
index: -1
|
||||||
|
rewind
|
||||||
|
rotate: false
|
||||||
|
xy: 139, 50
|
||||||
|
size: 45, 45
|
||||||
|
orig: 45, 45
|
||||||
|
offset: 0, 0
|
||||||
|
index: -1
|
||||||
|
rewind-down
|
||||||
|
rotate: false
|
||||||
|
xy: 139, 96
|
||||||
|
size: 45, 45
|
||||||
|
orig: 45, 45
|
||||||
|
offset: 0, 0
|
||||||
|
index: -1
|
||||||
|
shuffle
|
||||||
|
rotate: false
|
||||||
|
xy: 185, 50
|
||||||
|
size: 45, 45
|
||||||
|
orig: 45, 45
|
||||||
|
offset: 0, 0
|
||||||
|
index: -1
|
||||||
|
shuffle-down
|
||||||
|
rotate: false;
|
||||||
|
xy: 185, 96
|
||||||
|
size: 45, 45
|
||||||
|
orig: 45, 45
|
||||||
offset: 0, 0
|
offset: 0, 0
|
||||||
index: -1
|
index: -1
|
||||||
loading
|
loading
|
||||||
rotate: false;
|
rotate: false;
|
||||||
xy: 136, 50
|
xy: 47, 142
|
||||||
size: 44, 44
|
size: 45, 45
|
||||||
orig: 44, 44
|
orig: 45, 45
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
left-double-arrow
|
|
||||||
rotate: false;
|
|
||||||
xy: 1, 95
|
|
||||||
size: 21, 21
|
|
||||||
orig: 21, 21
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
right-double-arrow
|
|
||||||
rotate: false;
|
|
||||||
xy: 23, 95
|
|
||||||
size: 21, 21
|
|
||||||
orig: 21, 21
|
|
||||||
offset: 0, 0
|
offset: 0, 0
|
||||||
index: -1
|
index: -1
|
||||||
holo-pane
|
holo-pane
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 6.1 KiB After Width: | Height: | Size: 11 KiB |
@ -1,5 +1,7 @@
|
|||||||
package zero1hd.rhythmbullet;
|
package zero1hd.rhythmbullet;
|
||||||
|
|
||||||
|
import java.awt.Checkbox;
|
||||||
|
|
||||||
import com.badlogic.gdx.Application;
|
import com.badlogic.gdx.Application;
|
||||||
import com.badlogic.gdx.Game;
|
import com.badlogic.gdx.Game;
|
||||||
import com.badlogic.gdx.Gdx;
|
import com.badlogic.gdx.Gdx;
|
||||||
@ -20,6 +22,7 @@ import com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator;
|
|||||||
import com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator.FreeTypeFontParameter;
|
import com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator.FreeTypeFontParameter;
|
||||||
import com.badlogic.gdx.math.MathUtils;
|
import com.badlogic.gdx.math.MathUtils;
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.CheckBox.CheckBoxStyle;
|
import com.badlogic.gdx.scenes.scene2d.ui.CheckBox.CheckBoxStyle;
|
||||||
|
import com.badlogic.gdx.scenes.scene2d.ui.ImageButton.ImageButtonStyle;
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.Label.LabelStyle;
|
import com.badlogic.gdx.scenes.scene2d.ui.Label.LabelStyle;
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.List.ListStyle;
|
import com.badlogic.gdx.scenes.scene2d.ui.List.ListStyle;
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane.ScrollPaneStyle;
|
import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane.ScrollPaneStyle;
|
||||||
@ -290,16 +293,39 @@ public class RhythmBullet extends Game {
|
|||||||
getDefaultSkin().add("default", defaultScrollPane);
|
getDefaultSkin().add("default", defaultScrollPane);
|
||||||
|
|
||||||
CheckBoxStyle defaultCheckBox = new CheckBoxStyle(getDefaultSkin().getDrawable("check-off"), getDefaultSkin().getDrawable("check-on"), getDefaultSkin().getFont("window-font"), getDefaultSkin().getColor("default"));
|
CheckBoxStyle defaultCheckBox = new CheckBoxStyle(getDefaultSkin().getDrawable("check-off"), getDefaultSkin().getDrawable("check-on"), getDefaultSkin().getFont("window-font"), getDefaultSkin().getColor("default"));
|
||||||
|
defaultCheckBox.disabled = getDefaultSkin().getDrawable("check-disabled");
|
||||||
getDefaultSkin().add("default", defaultCheckBox);
|
getDefaultSkin().add("default", defaultCheckBox);
|
||||||
|
|
||||||
CheckBoxStyle expandableCheckBox = new CheckBoxStyle(defaultCheckBox);
|
|
||||||
expandableCheckBox.font = getDefaultSkin().getFont("sub-font");
|
|
||||||
getDefaultSkin().add("expandable", expandableCheckBox);
|
|
||||||
|
|
||||||
SelectBoxStyle defaultSelectBox = new SelectBoxStyle(getDefaultSkin().getFont("default-font"), getDefaultSkin().getColor("default"), getDefaultSkin().getDrawable("default-select"), defaultScrollPane, defaultList);
|
SelectBoxStyle defaultSelectBox = new SelectBoxStyle(getDefaultSkin().getFont("default-font"), getDefaultSkin().getColor("default"), getDefaultSkin().getDrawable("default-select"), defaultScrollPane, defaultList);
|
||||||
getDefaultSkin().add("default", defaultSelectBox);
|
getDefaultSkin().add("default", defaultSelectBox);
|
||||||
|
|
||||||
Gdx.app.debug("Prelaunch Debug Info", "UI Skin has been defined.");
|
Gdx.app.debug("Prelaunch Debug Info", "UI Skin has been defined.");
|
||||||
|
|
||||||
|
CheckBoxStyle playButtonStyle = new CheckBoxStyle(defaultCheckBox);
|
||||||
|
playButtonStyle.checkboxOn = getDefaultSkin().getDrawable("play-down");
|
||||||
|
playButtonStyle.checkboxOff = getDefaultSkin().getDrawable("play");
|
||||||
|
getDefaultSkin().add("play-button", playButtonStyle);
|
||||||
|
|
||||||
|
ImageButtonStyle pauseButtonStyle = new ImageButtonStyle();
|
||||||
|
pauseButtonStyle.down = getDefaultSkin().getDrawable("pause-down");
|
||||||
|
pauseButtonStyle.up = getDefaultSkin().getDrawable("pause");
|
||||||
|
getDefaultSkin().add("pause-button", pauseButtonStyle);
|
||||||
|
|
||||||
|
ImageButtonStyle fastForwardButtonStyle = new ImageButtonStyle();
|
||||||
|
fastForwardButtonStyle.down = getDefaultSkin().getDrawable("fast-forward-down");
|
||||||
|
fastForwardButtonStyle.up = getDefaultSkin().getDrawable("fast-forward");
|
||||||
|
getDefaultSkin().add("fast-forward-button", fastForwardButtonStyle);
|
||||||
|
|
||||||
|
ImageButtonStyle reverseButtonStyle = new ImageButtonStyle();
|
||||||
|
reverseButtonStyle.down = getDefaultSkin().getDrawable("rewind-down");
|
||||||
|
reverseButtonStyle.up = getDefaultSkin().getDrawable("rewind");
|
||||||
|
getDefaultSkin().add("rewind-button", reverseButtonStyle);
|
||||||
|
|
||||||
|
CheckBoxStyle shuffleButtonStyle = new CheckBoxStyle(defaultCheckBox);
|
||||||
|
shuffleButtonStyle.checkboxOff = getDefaultSkin().getDrawable("shuffle");
|
||||||
|
shuffleButtonStyle.checkboxOn = getDefaultSkin().getDrawable("shuffle-down");
|
||||||
|
getDefaultSkin().add("shuffle-button", shuffleButtonStyle);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public RoundingResolutionHandler getrRHandler() {
|
public RoundingResolutionHandler getrRHandler() {
|
||||||
|
@ -209,7 +209,7 @@ public class Mp3Manager implements MusicManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getPosition() {
|
public float getPositionInSeconds() {
|
||||||
return playbackMusic.getPosition();
|
return playbackMusic.getPosition();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ public interface MusicManager extends Disposable {
|
|||||||
|
|
||||||
public boolean isPlaying();
|
public boolean isPlaying();
|
||||||
|
|
||||||
public float getPosition();
|
public float getPositionInSeconds();
|
||||||
|
|
||||||
public void setPosition(float position);
|
public void setPosition(float position);
|
||||||
|
|
||||||
|
@ -89,7 +89,6 @@ public class SongListController implements OnCompletionListener {
|
|||||||
|
|
||||||
public void setShuffle(boolean shuffle) {
|
public void setShuffle(boolean shuffle) {
|
||||||
this.shuffle = shuffle;
|
this.shuffle = shuffle;
|
||||||
shuffle();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isShuffle() {
|
public boolean isShuffle() {
|
||||||
@ -105,6 +104,16 @@ public class SongListController implements OnCompletionListener {
|
|||||||
mdp.dispose();
|
mdp.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (shuffle) {
|
||||||
|
currentPlaybackID = rand.nextInt(songList.getAmountOfSongs());
|
||||||
|
} else {
|
||||||
|
if (currentPlaybackID > songList.getAmountOfSongs() -1) {
|
||||||
|
currentPlaybackID = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (currentPlaybackID < 0) {
|
||||||
|
currentPlaybackID = 0;
|
||||||
|
}
|
||||||
this.mdp = songList.getMusicInfoFromIndex(currentPlaybackID);
|
this.mdp = songList.getMusicInfoFromIndex(currentPlaybackID);
|
||||||
if (mdp == null) {
|
if (mdp == null) {
|
||||||
if (!Gdx.files.external("RhythmBullet/Alan Walker - Spectre.mp3").exists()) {
|
if (!Gdx.files.external("RhythmBullet/Alan Walker - Spectre.mp3").exists()) {
|
||||||
|
@ -104,7 +104,7 @@ public class WAVManager implements MusicManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getPosition() {
|
public float getPositionInSeconds() {
|
||||||
return playbackMusic.getPosition();
|
return playbackMusic.getPosition();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ public class BasicVisualizer extends VisualizerCore {
|
|||||||
pixmap.setColor(Color.WHITE);
|
pixmap.setColor(Color.WHITE);
|
||||||
pixmap.fill();
|
pixmap.fill();
|
||||||
barCount = 65;
|
barCount = 65;
|
||||||
smoothRange = 2;
|
smoothRange = 3;
|
||||||
angleRot = new Vector2(MathUtils.cosDeg(rotation), MathUtils.sinDeg(rotation));
|
angleRot = new Vector2(MathUtils.cosDeg(rotation), MathUtils.sinDeg(rotation));
|
||||||
textures = new Texture[barCount];
|
textures = new Texture[barCount];
|
||||||
bars = new Sprite[barCount];
|
bars = new Sprite[barCount];
|
||||||
@ -110,7 +110,7 @@ public class BasicVisualizer extends VisualizerCore {
|
|||||||
super.setMM(mm);
|
super.setMM(mm);
|
||||||
maxAvgHeight = 0;
|
maxAvgHeight = 0;
|
||||||
currentAvg = 0;
|
currentAvg = 0;
|
||||||
float validBins = (5000/((mm.getSampleRate()/2)/((audioPCM.length/2)+1)));
|
float validBins = (5500/((mm.getSampleRate()/2)/((audioPCM.length/2)+1)));
|
||||||
Gdx.app.debug("Visualizer", "valid frequency bins " + validBins);
|
Gdx.app.debug("Visualizer", "valid frequency bins " + validBins);
|
||||||
binsPerBar = MathUtils.round((validBins/barCount));
|
binsPerBar = MathUtils.round((validBins/barCount));
|
||||||
barHeights = new float[barCount];
|
barHeights = new float[barCount];
|
||||||
|
@ -37,7 +37,7 @@ public class GraphicsOptions extends Table {
|
|||||||
add(shaders).fillX();
|
add(shaders).fillX();
|
||||||
row();
|
row();
|
||||||
|
|
||||||
glowShader = new CheckBox(" Glow Shader", skin, "expandable");
|
glowShader = new CheckBox(" Glow Shader", skin);
|
||||||
glowShader.setChecked(prefs.getBoolean("glow shader", true));
|
glowShader.setChecked(prefs.getBoolean("glow shader", true));
|
||||||
glowShader.addListener(new ChangeListener() {
|
glowShader.addListener(new ChangeListener() {
|
||||||
@Override
|
@Override
|
||||||
@ -45,12 +45,15 @@ public class GraphicsOptions extends Table {
|
|||||||
save();
|
save();
|
||||||
if (glowShader.isChecked()) {
|
if (glowShader.isChecked()) {
|
||||||
mainMenu.loadShaders();
|
mainMenu.loadShaders();
|
||||||
|
enhancedGlow.setDisabled(false);
|
||||||
} else {
|
} else {
|
||||||
mainMenu.unloadShaders();
|
mainMenu.unloadShaders();
|
||||||
|
enhancedGlow.setChecked(false);
|
||||||
|
enhancedGlow.setDisabled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
add(glowShader).minHeight(shaders.getHeight());
|
add(glowShader);
|
||||||
row();
|
row();
|
||||||
|
|
||||||
enhancedGlow = new CheckBox(" Enhanced Glow", skin);
|
enhancedGlow = new CheckBox(" Enhanced Glow", skin);
|
||||||
@ -66,7 +69,7 @@ public class GraphicsOptions extends Table {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
add(enhancedGlow).minHeight(shaders.getHeight());
|
add(enhancedGlow);
|
||||||
row();
|
row();
|
||||||
|
|
||||||
resolutions = new Label("Resolutions: ", skin);
|
resolutions = new Label("Resolutions: ", skin);
|
||||||
|
@ -33,26 +33,28 @@ public class TitleBarVisualizer extends Group implements Disposable {
|
|||||||
public TitleBarVisualizer(AssetManager assets) {
|
public TitleBarVisualizer(AssetManager assets) {
|
||||||
if (assets == null) throw new NullPointerException("TitleBarVisualizer requires assets manager... ITS NULL YOU FOOL");
|
if (assets == null) throw new NullPointerException("TitleBarVisualizer requires assets manager... ITS NULL YOU FOOL");
|
||||||
visual = new Visualizer();
|
visual = new Visualizer();
|
||||||
visual.getVis().setSpaceBetweenBars(visual.getVis().getBarWidth()-1);
|
visual.getVis().setSpaceBetweenBars(visual.getVis().getBarWidth()-2);
|
||||||
addActor(visual);
|
addActor(visual);
|
||||||
|
|
||||||
setSize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()*0.2f);
|
setSize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()*0.2f);
|
||||||
setPosition(0, (Gdx.graphics.getHeight()-getHeight())/2f);
|
setPosition(0, (Gdx.graphics.getHeight()-getHeight())/2f);
|
||||||
visual.setWidth(getWidth());
|
visual.setWidth(getWidth());
|
||||||
visual.setHeight(getHeight());
|
visual.setHeight(getHeight());
|
||||||
visual.setY(-2);
|
|
||||||
visual.getVis().flip();
|
visual.getVis().flip();
|
||||||
visual.getVis().reverse();
|
visual.getVis().reverse();
|
||||||
visual2 = new MirrorVisualizer();
|
visual2 = new MirrorVisualizer();
|
||||||
visual.setUpdatePositioning(false);
|
visual.setUpdatePositioning(false);
|
||||||
visual.getVis().addMirrorVisualizer(visual2);
|
visual.getVis().addMirrorVisualizer(visual2);
|
||||||
visual2.setyPos(MathUtils.round(getHeight()));
|
visual2.setyPos(MathUtils.round(getHeight()));
|
||||||
|
visual.setY(-2);
|
||||||
visual.updateVisualPosition();
|
visual.updateVisualPosition();
|
||||||
|
|
||||||
Pixmap pixmap = new Pixmap(MathUtils.round(getWidth()), MathUtils.round(getHeight()), Format.RGBA8888);
|
Pixmap pixmap = new Pixmap(MathUtils.round(getWidth()), MathUtils.round(getHeight()), Format.RGBA8888);
|
||||||
pixmap.setColor(Color.WHITE);
|
pixmap.setColor(Color.WHITE);
|
||||||
pixmap.drawLine(0, 0, pixmap.getWidth(), 0);
|
pixmap.drawLine(0, 0, pixmap.getWidth(), 0);
|
||||||
|
pixmap.drawLine(0, 1, pixmap.getWidth(), 1);
|
||||||
pixmap.drawLine(0, pixmap.getHeight()-1, pixmap.getWidth(), pixmap.getHeight()-1);
|
pixmap.drawLine(0, pixmap.getHeight()-1, pixmap.getWidth(), pixmap.getHeight()-1);
|
||||||
|
pixmap.drawLine(0, pixmap.getHeight()-2, pixmap.getWidth(), pixmap.getHeight()-2);
|
||||||
bgTexture = new Texture(pixmap);
|
bgTexture = new Texture(pixmap);
|
||||||
pixmap.dispose();
|
pixmap.dispose();
|
||||||
|
|
||||||
|
@ -34,11 +34,7 @@ public class Visualizer extends Widget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
vis.modify(delta);
|
vis.modify(delta);
|
||||||
vis.setHeight(getHeight());
|
setVisualizerPosProp();
|
||||||
vis.setWidth(getWidth());
|
|
||||||
vis.setxPos(getX());
|
|
||||||
vis.setyPos(getY());
|
|
||||||
vis.setRotation(getRotation());
|
|
||||||
if (updatePositioning) {
|
if (updatePositioning) {
|
||||||
vis.updatePositionInfo();
|
vis.updatePositionInfo();
|
||||||
vis.setxPos((getWidth() - vis.getActualWidth())/2f);
|
vis.setxPos((getWidth() - vis.getActualWidth())/2f);
|
||||||
@ -65,14 +61,23 @@ public class Visualizer extends Widget {
|
|||||||
super.setColor(r, g, b, a);
|
super.setColor(r, g, b, a);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setVisualizerPosProp() {
|
||||||
|
vis.setHeight(getHeight());
|
||||||
|
vis.setWidth(getWidth());
|
||||||
|
vis.setxPos(getX());
|
||||||
|
vis.setyPos(getY());
|
||||||
|
vis.setRotation(getRotation());
|
||||||
|
}
|
||||||
|
|
||||||
public void setUpdatePositioning(boolean updatePositioning) {
|
public void setUpdatePositioning(boolean updatePositioning) {
|
||||||
vis.updatePositionInfo();
|
updateVisualPosition();
|
||||||
vis.setxPos(((vis.getWidth() - vis.getActualWidth())/2f));
|
vis.setxPos(((vis.getWidth() - vis.getActualWidth())/2f));
|
||||||
vis.updatePositionInfo();
|
updateVisualPosition();
|
||||||
this.updatePositioning = updatePositioning;
|
this.updatePositioning = updatePositioning;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateVisualPosition() {
|
public void updateVisualPosition() {
|
||||||
|
setVisualizerPosProp();
|
||||||
vis.updatePositionInfo();
|
vis.updatePositionInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,6 +14,7 @@ import zero1hd.rhythmbullet.RhythmBullet;
|
|||||||
import zero1hd.rhythmbullet.audio.MusicManager;
|
import zero1hd.rhythmbullet.audio.MusicManager;
|
||||||
import zero1hd.rhythmbullet.audio.SongListController;
|
import zero1hd.rhythmbullet.audio.SongListController;
|
||||||
import zero1hd.rhythmbullet.events.OnDifferentSongListener;
|
import zero1hd.rhythmbullet.events.OnDifferentSongListener;
|
||||||
|
import zero1hd.rhythmbullet.graphics.ui.components.MusicControls;
|
||||||
import zero1hd.rhythmbullet.graphics.ui.components.TitleBarVisualizer;
|
import zero1hd.rhythmbullet.graphics.ui.components.TitleBarVisualizer;
|
||||||
|
|
||||||
public class MainPage extends Page implements OnDifferentSongListener {
|
public class MainPage extends Page implements OnDifferentSongListener {
|
||||||
@ -25,6 +26,8 @@ public class MainPage extends Page implements OnDifferentSongListener {
|
|||||||
private TextButton playButton;
|
private TextButton playButton;
|
||||||
private TextButton optionsButton;
|
private TextButton optionsButton;
|
||||||
private TextButton quitButton;
|
private TextButton quitButton;
|
||||||
|
|
||||||
|
private MusicControls musicControls;
|
||||||
public MainPage(RhythmBullet core, Vector3 targetPosition, SongListController sc) {
|
public MainPage(RhythmBullet core, Vector3 targetPosition, SongListController sc) {
|
||||||
this.sc = sc;
|
this.sc = sc;
|
||||||
|
|
||||||
@ -75,6 +78,10 @@ public class MainPage extends Page implements OnDifferentSongListener {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
table.add(quitButton).fillX();
|
table.add(quitButton).fillX();
|
||||||
|
|
||||||
|
musicControls = new MusicControls(core.getDefaultSkin(), sc);
|
||||||
|
musicControls.setPosition((getWidth()-musicControls.getMinWidth() - 20f), getHeight()-musicControls.getMinHeight());
|
||||||
|
addActor(musicControls);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -67,7 +67,7 @@ public class OptionsPage extends Page {
|
|||||||
core.getPrefs().putFloat("music vol", musicVolSlider.getPercent());
|
core.getPrefs().putFloat("music vol", musicVolSlider.getPercent());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
optionsTable.add(musicVolPercentage).center();
|
optionsTable.add(musicVolPercentage).left();
|
||||||
|
|
||||||
optionsTable.row();
|
optionsTable.row();
|
||||||
|
|
||||||
@ -85,13 +85,13 @@ public class OptionsPage extends Page {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
optionsTable.add(fxVolPercentage).center();
|
optionsTable.add(fxVolPercentage).left();
|
||||||
|
|
||||||
optionsTable.row();
|
optionsTable.row();
|
||||||
|
|
||||||
Label musicDirectoryLabel = new Label("Music Directory: ", core.getDefaultSkin());
|
Label musicDirectoryLabel = new Label("Music Directory: ", core.getDefaultSkin());
|
||||||
optionsTable.add(musicDirectoryLabel).left();
|
optionsTable.add(musicDirectoryLabel).left();
|
||||||
Label songCount = new Label(": " + sc.getSongList().getAmountOfSongs(), core.getDefaultSkin(), "sub-font", core.getDefaultSkin().getColor("default"));
|
Label songCount = new Label("Songs: " + sc.getSongList().getAmountOfSongs(), core.getDefaultSkin(), "sub-font", core.getDefaultSkin().getColor("default"));
|
||||||
directoryField = new TextField(null, core.getDefaultSkin() ) {
|
directoryField = new TextField(null, core.getDefaultSkin() ) {
|
||||||
@Override
|
@Override
|
||||||
public void act(float delta) {
|
public void act(float delta) {
|
||||||
@ -100,7 +100,7 @@ public class OptionsPage extends Page {
|
|||||||
if (musicSearchTimer <= 0) {
|
if (musicSearchTimer <= 0) {
|
||||||
sc.getSongList().setSearchPath(directoryField.getText());
|
sc.getSongList().setSearchPath(directoryField.getText());
|
||||||
sc.getSongList().refresh();
|
sc.getSongList().refresh();
|
||||||
songCount.setText(": " + sc.getSongList().getAmountOfSongs());
|
songCount.setText("Songs: " + sc.getSongList().getAmountOfSongs());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
super.act(delta);
|
super.act(delta);
|
||||||
@ -115,7 +115,7 @@ public class OptionsPage extends Page {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
optionsTable.add(directoryField).fillX();
|
optionsTable.add(directoryField).fillX();
|
||||||
optionsTable.add(songCount);
|
optionsTable.add(songCount).left();
|
||||||
|
|
||||||
optionsTable.row();
|
optionsTable.row();
|
||||||
|
|
||||||
|
@ -34,8 +34,8 @@ public class MusicController extends Window implements OnCompletionListener {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void changed(ChangeEvent event, Actor actor) {
|
public void changed(ChangeEvent event, Actor actor) {
|
||||||
audiofile.setPosition(audiofile.getPosition() - 2);
|
audiofile.setPosition(audiofile.getPositionInSeconds() - 2);
|
||||||
info.setText(String.valueOf(MathUtils.round(audiofile.getPosition())) + " sec");
|
info.setText(String.valueOf(MathUtils.round(audiofile.getPositionInSeconds())) + " sec");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -72,8 +72,8 @@ public class MusicController extends Window implements OnCompletionListener {
|
|||||||
public void changed(ChangeEvent event, Actor actor) {
|
public void changed(ChangeEvent event, Actor actor) {
|
||||||
if (audiofile != null) {
|
if (audiofile != null) {
|
||||||
audiofile.play();
|
audiofile.play();
|
||||||
audiofile.setPosition(audiofile.getPosition() + 2);
|
audiofile.setPosition(audiofile.getPositionInSeconds() + 2);
|
||||||
info.setText(String.valueOf(MathUtils.round(audiofile.getPosition())) + " sec");
|
info.setText(String.valueOf(MathUtils.round(audiofile.getPositionInSeconds())) + " sec");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -84,7 +84,7 @@ public class MusicController extends Window implements OnCompletionListener {
|
|||||||
@Override
|
@Override
|
||||||
public void act(float delta) {
|
public void act(float delta) {
|
||||||
if (audiofile != null && audiofile.isPlaying()) {
|
if (audiofile != null && audiofile.isPlaying()) {
|
||||||
setText(String.valueOf(MathUtils.round(audiofile.getPosition())) + " sec");
|
setText(String.valueOf(MathUtils.round(audiofile.getPositionInSeconds())) + " sec");
|
||||||
}
|
}
|
||||||
super.act(delta);
|
super.act(delta);
|
||||||
}
|
}
|
||||||
|
@ -66,6 +66,7 @@ public class MainMenu extends ScreenAdapter implements TransitionAdapter {
|
|||||||
sc = new SongListController(songList, core.getPrefs());
|
sc = new SongListController(songList, core.getPrefs());
|
||||||
sc.setAutoPlay(true);
|
sc.setAutoPlay(true);
|
||||||
sc.setShuffle(true);
|
sc.setShuffle(true);
|
||||||
|
sc.shuffle();
|
||||||
|
|
||||||
postTransition();
|
postTransition();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user