Merge branch 'master' of /home/ydeng/git/RhythmBullet

This commit is contained in:
Harrison Deng 2018-09-06 18:30:11 -05:00
commit 93939da1aa
4 changed files with 11 additions and 12 deletions

View File

@ -159,12 +159,13 @@ public class ScrollingText extends Widget {
coords.x = getX(); coords.x = getX();
coords.y = getY(); coords.y = getY();
getStage().stageToScreenCoordinates(coords);
clipBounds.setX(coords.x+1); clipBounds.setX(coords.x+1);
clipBounds.setY(coords.y - 0.5f*getHeight()); clipBounds.setY(coords.y - 0.5f*getHeight());
getStage().calculateScissors(clipBounds, scissors);
batch.flush(); batch.flush();
getStage().calculateScissors(clipBounds, scissors);
if (ScissorStack.pushScissors(scissors)) { if (ScissorStack.pushScissors(scissors)) {
font.draw(batch, text1, coords.x + text1Offset, coords.y + getFontHeight() + 4); font.draw(batch, text1, coords.x + text1Offset, coords.y + getFontHeight() + 4);
font.draw(batch, text2, coords.x + text2Offset, coords.y + getFontHeight() + 4); font.draw(batch, text2, coords.x + text2Offset, coords.y + getFontHeight() + 4);

View File

@ -30,6 +30,7 @@ public class AnalysisPage extends Page {
private Image albumImage; private Image albumImage;
private AudioMetadataController amc; private AudioMetadataController amc;
private MusicController mc; private MusicController mc;
public AnalysisPage(MusicController mc, AudioMetadataController amc, Skin skin, ChangeListener backButtonListener, ChangeListener confirmedButtonListener) { public AnalysisPage(MusicController mc, AudioMetadataController amc, Skin skin, ChangeListener backButtonListener, ChangeListener confirmedButtonListener) {
super(2, 0); super(2, 0);
table = new Table(); table = new Table();
@ -101,6 +102,7 @@ public class AnalysisPage extends Page {
adjustment.add(progressLabel).colspan(2).left().spaceTop(20f); adjustment.add(progressLabel).colspan(2).left().spaceTop(20f);
backButton = new TextButton("Cancel", skin); backButton = new TextButton("Cancel", skin);
backButton.setWidth(backButton.getWidth() + 20);
backButton.addListener(backButtonListener); backButton.addListener(backButtonListener);
backButton.addListener(new ChangeListener() { backButton.addListener(new ChangeListener() {
@Override @Override

View File

@ -5,7 +5,6 @@ import java.util.Observer;
import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.assets.AssetManager; import com.badlogic.gdx.assets.AssetManager;
import com.badlogic.gdx.graphics.GL20;
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.Batch;
import com.badlogic.gdx.graphics.g2d.ParticleEffect; import com.badlogic.gdx.graphics.g2d.ParticleEffect;
@ -138,14 +137,14 @@ public class MainPage extends Page implements Observer {
} }
private void updateParticles(Batch batch) { private void updateParticles(Batch batch) {
if (mc.isPlaying() && playParticles) { if (playParticles) {
if (particles.size < 16 && dhv.isSignificantBeat()) { if (particles.size < 16 && dhv.isSignificantBeat()) {
PooledEffect particle = particlePool.obtain(); PooledEffect particle = particlePool.obtain();
particle.scaleEffect(particleScale); particle.scaleEffect(particleScale);
particles.add(particle); particles.add(particle);
} }
if (particles.size > 0) { if (particles.size > 0) {
for (int i = particles.size - 1; i >= 0; i--) { for (int i = particles.size - 1; i >= 0 && particles.size > 0; i--) {
PooledEffect particle = particles.get(i); PooledEffect particle = particles.get(i);
particle.draw(batch, Gdx.graphics.getDeltaTime()); particle.draw(batch, Gdx.graphics.getDeltaTime());
if (particle.isComplete()) { if (particle.isComplete()) {
@ -155,22 +154,20 @@ public class MainPage extends Page implements Observer {
} }
} }
} }
batch.setBlendFunction(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
} }
public void stopParticles() { public void stopParticles() {
playParticles = false; playParticles = false;
for (int i = particles.size - 1; i >= 0 && particles.size > 0; i--) {
particles.get(i).free();
particles.clear();
}
} }
@Override @Override
public void dispose() { public void dispose() {
dhv.dispose(); dhv.dispose();
mc.getMusicList().deleteObserver(this); mc.getMusicList().deleteObserver(this);
for (int i = particles.size - 1; i >= 0 && particles.size > 0; i--) {
particles.get(i).free();
particles.clear();
}
super.dispose(); super.dispose();
} }

View File

@ -29,7 +29,6 @@ import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
import com.badlogic.gdx.scenes.scene2d.ui.VerticalGroup; import com.badlogic.gdx.scenes.scene2d.ui.VerticalGroup;
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener; import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable; import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable;
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener.ChangeEvent;
import com.badlogic.gdx.utils.Align; import com.badlogic.gdx.utils.Align;
import com.badlogic.gdx.utils.Array; import com.badlogic.gdx.utils.Array;