From b4e7f97f5bac959c01d49dc54aeeec9bf8b960bc Mon Sep 17 00:00:00 2001 From: Recrown Date: Fri, 22 Sep 2017 15:28:59 -0500 Subject: [PATCH] linked basic visualizer with mirror visualizer --- .../rhythmbullet/audio/visualizer/BasicVisualizer.java | 10 +++++++++- .../audio/visualizer/MirrorVisualizer.java | 4 +++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/core/src/zero1hd/rhythmbullet/audio/visualizer/BasicVisualizer.java b/core/src/zero1hd/rhythmbullet/audio/visualizer/BasicVisualizer.java index 1ee0672..e66f436 100755 --- a/core/src/zero1hd/rhythmbullet/audio/visualizer/BasicVisualizer.java +++ b/core/src/zero1hd/rhythmbullet/audio/visualizer/BasicVisualizer.java @@ -30,6 +30,7 @@ public class BasicVisualizer extends VisualizerCore { public BasicVisualizer() { super(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()/2, 0, 0); + mirrors = new Array<>(); barHeightMultiplier = Gdx.graphics.getHeight()*0.01f; pixmap = new Pixmap(2, 2, Format.RGBA8888); pixmap.setColor(Color.WHITE); @@ -79,6 +80,10 @@ public class BasicVisualizer extends VisualizerCore { bars[i].setSize(barWidth, avg/(smoothRange*2)); bars[i].draw(batch); } + + for (int i = 0; i < mirrors.size; i++) { + mirrors.get(i).render(bars, batch); + } } super.render(batch, parentAlpha); } @@ -98,7 +103,7 @@ public class BasicVisualizer extends VisualizerCore { } public void updatePositionInfo() { - int barSpace; + int barSpace = 0; angleRot.set(MathUtils.cosDeg(rotation), MathUtils.sinDeg(rotation)); barWidth = MathUtils.ceil((float) width/(float) barCount); @@ -114,6 +119,9 @@ public class BasicVisualizer extends VisualizerCore { } bars[i].setPosition(xPos + barSpace*angleRot.x, yPos + barSpace*angleRot.y); } + for (int i = 0; i < mirrors.size; i++) { + mirrors.get(i).updatePositioning(bars, barSpace); + } } public void setColor(Color color) { diff --git a/core/src/zero1hd/rhythmbullet/audio/visualizer/MirrorVisualizer.java b/core/src/zero1hd/rhythmbullet/audio/visualizer/MirrorVisualizer.java index 8294816..08cb7d9 100644 --- a/core/src/zero1hd/rhythmbullet/audio/visualizer/MirrorVisualizer.java +++ b/core/src/zero1hd/rhythmbullet/audio/visualizer/MirrorVisualizer.java @@ -1,5 +1,6 @@ package zero1hd.rhythmbullet.audio.visualizer; +import com.badlogic.gdx.graphics.g2d.Batch; import com.badlogic.gdx.graphics.g2d.Sprite; import com.badlogic.gdx.math.MathUtils; import com.badlogic.gdx.math.Vector2; @@ -21,9 +22,10 @@ public class MirrorVisualizer { } } - protected void updateSpriteSize(Sprite[] sprites) { + protected void render(Sprite[] sprites, Batch batch) { for (int i = 0; i < sprites.length; i++) { bars[i].setSize(bars[i].getWidth(), sprites[i].getHeight()); + bars[i].draw(batch); } }