added coloring to visualizer

This commit is contained in:
Harrison Deng 2017-09-12 20:14:02 -05:00
parent 1b061902cb
commit 4ba2deb8da
3 changed files with 27 additions and 3 deletions

View File

@ -111,7 +111,6 @@ public class WavAudioData implements MusicManager {
@Override
public void setPosition(float position) {
playbackMusic.setPosition(position);
}
@Override

View File

@ -29,7 +29,7 @@ public class BasicVisualizer extends VisualizerCore {
super(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()/2, 0, 0);
barHeightMultiplier = Gdx.graphics.getHeight()*0.008f;
pixmap = new Pixmap(2, 2, Format.RGBA8888);
pixmap.setColor(Color.GRAY);
pixmap.setColor(Color.WHITE);
pixmap.fill();
barCount = 70;
barWidth = MathUtils.ceil((float) width/(float) barCount);
@ -108,6 +108,18 @@ public class BasicVisualizer extends VisualizerCore {
}
}
public void setColor(Color color) {
for (int i = 0; i < bars.length; i++) {
bars[i].setColor(color);
}
}
public void setColor(float r, float g, float b, float a) {
for (int i = 0; i < bars.length; i++) {
bars[i].setColor(r, g, b, a);
}
}
@Override
public void setHeight(int height) {
updatePositionInfo();

View File

@ -1,5 +1,6 @@
package zero1hd.rhythmbullet.ui.components;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.g2d.Batch;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.scenes.scene2d.ui.Widget;
@ -91,4 +92,16 @@ public class Visualizer extends Widget {
vis.updatePositionInfo();
super.layout();
}
@Override
public void setColor(Color color) {
vis.setColor(color);
super.setColor(color);
}
@Override
public void setColor(float r, float g, float b, float a) {
vis.setColor(r, g, b, a);
super.setColor(r, g, b, a);
}
}