minor optimizations
This commit is contained in:
parent
6fe280044d
commit
86a606c44e
@ -53,7 +53,7 @@ public class MusicList extends Observable {
|
|||||||
Gdx.files.internal("music/Alan Walker - Spectre.mp3").copyTo(Gdx.files.external("RhythmBullet/Alan Walker - Spectre.mp3"));
|
Gdx.files.internal("music/Alan Walker - Spectre.mp3").copyTo(Gdx.files.external("RhythmBullet/Alan Walker - Spectre.mp3"));
|
||||||
}
|
}
|
||||||
musicList.add(Gdx.files.external("RhythmBullet/Alan Walker - Spectre.mp3"));
|
musicList.add(Gdx.files.external("RhythmBullet/Alan Walker - Spectre.mp3"));
|
||||||
|
setChanged();
|
||||||
Sort.instance().sort(musicList, fhac);
|
Sort.instance().sort(musicList, fhac);
|
||||||
searched = true;
|
searched = true;
|
||||||
if (notify) {
|
if (notify) {
|
||||||
|
@ -132,7 +132,6 @@ public class MusicListController extends Observable implements OnCompletionListe
|
|||||||
|
|
||||||
|
|
||||||
public MusicManager getCurrentMusicManager() {
|
public MusicManager getCurrentMusicManager() {
|
||||||
if (mm == null) throw new NullPointerException("Music manager not loaded yet. try calling load music.");
|
|
||||||
return mm;
|
return mm;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@ package zero1hd.rhythmbullet.graphics.ui.components;
|
|||||||
import com.badlogic.gdx.Preferences;
|
import com.badlogic.gdx.Preferences;
|
||||||
import com.badlogic.gdx.files.FileHandle;
|
import com.badlogic.gdx.files.FileHandle;
|
||||||
import com.badlogic.gdx.graphics.Texture;
|
import com.badlogic.gdx.graphics.Texture;
|
||||||
|
import com.badlogic.gdx.graphics.g2d.Batch;
|
||||||
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
||||||
import com.badlogic.gdx.scenes.scene2d.InputEvent;
|
import com.badlogic.gdx.scenes.scene2d.InputEvent;
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.Image;
|
import com.badlogic.gdx.scenes.scene2d.ui.Image;
|
||||||
@ -40,6 +41,7 @@ public class MusicSelectable extends WidgetGroup implements Disposable {
|
|||||||
public MusicSelectable(FileHandle musicFile, Preferences musicAnnotation, Skin skin, Texture defaultAlbumC, MusicSelectionPage msp) {
|
public MusicSelectable(FileHandle musicFile, Preferences musicAnnotation, Skin skin, Texture defaultAlbumC, MusicSelectionPage msp) {
|
||||||
table = new Table(skin);
|
table = new Table(skin);
|
||||||
table.setBackground("holo-pane");
|
table.setBackground("holo-pane");
|
||||||
|
table.setFillParent(true);
|
||||||
vGroup = new VerticalGroup();
|
vGroup = new VerticalGroup();
|
||||||
this.msp = msp;
|
this.msp = msp;
|
||||||
setName(musicFile.name());
|
setName(musicFile.name());
|
||||||
@ -64,7 +66,6 @@ public class MusicSelectable extends WidgetGroup implements Disposable {
|
|||||||
table.add(vGroup).expandX().fillX().center();
|
table.add(vGroup).expandX().fillX().center();
|
||||||
|
|
||||||
addActor(table);
|
addActor(table);
|
||||||
table.pack();
|
|
||||||
addListener(new ClickListener() {
|
addListener(new ClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void clicked(InputEvent event, float x, float y) {
|
public void clicked(InputEvent event, float x, float y) {
|
||||||
@ -72,7 +73,6 @@ public class MusicSelectable extends WidgetGroup implements Disposable {
|
|||||||
super.clicked(event, x, y);
|
super.clicked(event, x, y);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
table.pack();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -102,9 +102,13 @@ public class MusicSelectable extends WidgetGroup implements Disposable {
|
|||||||
super.layout();
|
super.layout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void draw(Batch batch, float parentAlpha) {
|
||||||
|
super.draw(batch, parentAlpha);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void act(float delta) {
|
public void act(float delta) {
|
||||||
table.setSize(getWidth(), getHeight());
|
|
||||||
super.act(delta);
|
super.act(delta);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,6 +62,7 @@ public class MusicSelectionPage extends Page implements Observer {
|
|||||||
|
|
||||||
private TextButton beginButton;
|
private TextButton beginButton;
|
||||||
private float scrollTimer, scrollDelay = 0.2f, scrollDelMod, songSelectionTimer;
|
private float scrollTimer, scrollDelay = 0.2f, scrollDelMod, songSelectionTimer;
|
||||||
|
private ExecutorService exec;
|
||||||
|
|
||||||
public MusicSelectionPage(Skin skin, MusicListController musicListController, AssetManager assetManager, Vector3 cameraTarget, AnalysisPage ap) {
|
public MusicSelectionPage(Skin skin, MusicListController musicListController, AssetManager assetManager, Vector3 cameraTarget, AnalysisPage ap) {
|
||||||
setTextureBackground(assetManager.get("gradients.atlas", TextureAtlas.class).findRegion("red-round"));
|
setTextureBackground(assetManager.get("gradients.atlas", TextureAtlas.class).findRegion("red-round"));
|
||||||
@ -136,6 +137,8 @@ public class MusicSelectionPage extends Page implements Observer {
|
|||||||
ap.processSong(mc.getMusicList().getAudioData(getSelectedMusic()));
|
ap.processSong(mc.getMusicList().getAudioData(getSelectedMusic()));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
exec = Executors.newSingleThreadExecutor();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -203,7 +206,6 @@ public class MusicSelectionPage extends Page implements Observer {
|
|||||||
musicTable.row();
|
musicTable.row();
|
||||||
}
|
}
|
||||||
|
|
||||||
ExecutorService exec = Executors.newSingleThreadExecutor();
|
|
||||||
exec.submit(() -> {
|
exec.submit(() -> {
|
||||||
for (int i = 0; i < selectables.size; i++) {
|
for (int i = 0; i < selectables.size; i++) {
|
||||||
MusicSelectable info = selectables.get(i);
|
MusicSelectable info = selectables.get(i);
|
||||||
|
Loading…
Reference in New Issue
Block a user