made more visualizer code accessible for other platforms by using interface
This commit is contained in:
@@ -1,186 +0,0 @@
|
||||
package zero1hd.rhythmbullet.desktop.audio.visualizer;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.graphics.Camera;
|
||||
import com.badlogic.gdx.graphics.GL20;
|
||||
import com.badlogic.gdx.graphics.Mesh;
|
||||
import com.badlogic.gdx.graphics.OrthographicCamera;
|
||||
import com.badlogic.gdx.graphics.VertexAttribute;
|
||||
import com.badlogic.gdx.graphics.VertexAttributes.Usage;
|
||||
import com.badlogic.gdx.graphics.glutils.ShaderProgram;
|
||||
import com.badlogic.gdx.utils.Disposable;
|
||||
|
||||
import zero1hd.rhythmbullet.RhythmBullet;
|
||||
|
||||
public class CircularVisualizer extends Visualizer implements Disposable {
|
||||
private int circlePointIndex;
|
||||
private int centerX, centerY;
|
||||
private int r;
|
||||
private int componentCount = 2 + 1;
|
||||
private float[][] circlePoints;
|
||||
private float[] vertComponents;
|
||||
private float color;
|
||||
private Mesh mesh;
|
||||
private ShaderProgram shader;
|
||||
private int barCount = 180;
|
||||
private float barHeightMultiplier = 1.5f;
|
||||
private float[] audioSpectrum;
|
||||
private Camera camera;
|
||||
public CircularVisualizer() {
|
||||
shader = new ShaderProgram(Gdx.files.internal("shaders/mesh.vsh"), Gdx.files.internal("shaders/mesh.fsh"));
|
||||
if (!shader.isCompiled() || shader.getLog().length() != 0) {
|
||||
Gdx.app.debug("Circular visualizer shader", shader.getLog());
|
||||
Gdx.app.exit();
|
||||
}
|
||||
r = RhythmBullet.pixels_per_unit*RhythmBullet.SPAWN_CIRCLE_RADIUS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Only should be called when all changes have been done.
|
||||
*/
|
||||
public void applyPositionChanges() {
|
||||
int vertsReq = calculateVerticeCount(centerX, centerY, r);
|
||||
vertComponents = new float[vertsReq * componentCount];
|
||||
circlePoints = new float[vertsReq][2];
|
||||
Gdx.app.debug("Circular Visualizer", "Using " + circlePoints.length + " points to create a circle.");
|
||||
|
||||
if (mesh != null) {
|
||||
mesh.dispose();
|
||||
}
|
||||
createCircleVertices(centerX, centerY, r);
|
||||
mesh = new Mesh(true, circlePoints.length, 0, new VertexAttribute(Usage.Position, 2, "a_position"), new VertexAttribute(Usage.ColorPacked, 4, "a_color"));
|
||||
}
|
||||
|
||||
public void setCenter(int x, int y) {
|
||||
this.centerX = x;
|
||||
this.centerY = y;
|
||||
}
|
||||
|
||||
private void addCircleVertex(int x, int y) {
|
||||
circlePoints[circlePointIndex][0] = x;
|
||||
circlePoints[circlePointIndex][1] = y;
|
||||
circlePointIndex++;
|
||||
}
|
||||
|
||||
public void drawVisualizer() {
|
||||
for (int circlePointIndex = 0; circlePointIndex < circlePoints.length; circlePointIndex++) {
|
||||
for (int componentIndex = 0; componentIndex < componentCount; componentIndex++) {
|
||||
int index = circlePointIndex*componentCount + componentIndex;
|
||||
|
||||
if (componentIndex == 2) {
|
||||
vertComponents[index] = color;
|
||||
} else {
|
||||
vertComponents[index] = circlePoints[circlePointIndex][componentIndex];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
flush();
|
||||
}
|
||||
|
||||
private void flush() {
|
||||
mesh.setVertices(vertComponents);
|
||||
|
||||
Gdx.gl.glEnable(GL20.GL_BLEND);
|
||||
Gdx.gl.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
int vertexCount = circlePoints.length;
|
||||
((OrthographicCamera) camera).setToOrtho(false, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
|
||||
|
||||
shader.begin();
|
||||
shader.setUniformMatrix("u_projTrans", camera.combined);
|
||||
|
||||
mesh.render(shader, GL20.GL_TRIANGLE_FAN, 0, vertexCount);
|
||||
shader.end();
|
||||
|
||||
Gdx.gl.glDepthMask(true);
|
||||
}
|
||||
|
||||
private void createCircleVertices(int centerX, int centerY, int radius) {
|
||||
int x = radius - 1;
|
||||
int y = 0;
|
||||
int dx = 1;
|
||||
int dy = 1;
|
||||
int err = dx - (radius << 1);
|
||||
circlePointIndex = 0;
|
||||
while (x >= y)
|
||||
{
|
||||
addCircleVertex(centerX + x, centerY + y);
|
||||
addCircleVertex(centerX + y, centerY + x);
|
||||
addCircleVertex(centerX - y, centerY + x);
|
||||
addCircleVertex(centerX - x, centerY + y);
|
||||
addCircleVertex(centerX - x, centerY - y);
|
||||
addCircleVertex(centerX - y, centerY - x);
|
||||
addCircleVertex(centerX + y, centerY - x);
|
||||
addCircleVertex(centerX + x, centerY - y);
|
||||
|
||||
if (err <= 0) {
|
||||
y++;
|
||||
err += dy;
|
||||
dy += 2;
|
||||
} else {
|
||||
x--;
|
||||
dx += 2;
|
||||
err += dx - (radius << 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private int calculateVerticeCount(int centerX, int centerY, int radius) {
|
||||
int x = radius - 1;
|
||||
int y = 0;
|
||||
int dx = 1;
|
||||
int dy = 1;
|
||||
int err = dx - (radius << 1);
|
||||
int vertCount = 0;
|
||||
while (x >= y)
|
||||
{
|
||||
vertCount += 8;
|
||||
|
||||
if (err <= 0) {
|
||||
y++;
|
||||
err += dy;
|
||||
dy += 2;
|
||||
} else {
|
||||
x--;
|
||||
dx += 2;
|
||||
err += dx - (radius << 1);
|
||||
}
|
||||
}
|
||||
return vertCount;
|
||||
}
|
||||
|
||||
public void setColor(float color) {
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
mesh.dispose();
|
||||
shader.dispose();
|
||||
}
|
||||
|
||||
/**
|
||||
* set the maximum radius
|
||||
* @param r
|
||||
*/
|
||||
public void setR(int r) {
|
||||
this.r = r;
|
||||
}
|
||||
|
||||
/**
|
||||
* get the maximum radius
|
||||
* @return
|
||||
*/
|
||||
public int getR() {
|
||||
return r;
|
||||
}
|
||||
|
||||
public void setCamera(Camera camera) {
|
||||
this.camera = camera;
|
||||
}
|
||||
|
||||
public Camera getCamera() {
|
||||
return camera;
|
||||
}
|
||||
}
|
@@ -9,21 +9,23 @@ import org.lwjgl.openal.AL11;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.backends.lwjgl.audio.OpenALMusic;
|
||||
import com.badlogic.gdx.graphics.g2d.Batch;
|
||||
import com.badlogic.gdx.utils.reflect.ClassReflection;
|
||||
import com.badlogic.gdx.utils.reflect.Field;
|
||||
import com.badlogic.gdx.utils.reflect.ReflectionException;
|
||||
|
||||
import zero1hd.rhythmbullet.audio.MusicManager;
|
||||
import zero1hd.rhythmbullet.audio.visualizer.MusicManagerFFT;
|
||||
import zero1hd.rhythmbullet.audio.visualizer.Visualizer;
|
||||
|
||||
public class Visualizer extends MusicManagerFFT {
|
||||
public class DesktopVisualizer extends MusicManagerFFT implements Visualizer {
|
||||
private ShortBuffer playingBuffer;
|
||||
private ShortBuffer compareBuffer;
|
||||
private ShortBuffer buffer;
|
||||
private int sourceID;
|
||||
private int readWindowIndex;
|
||||
|
||||
public Visualizer() {
|
||||
public DesktopVisualizer() {
|
||||
super();
|
||||
try {
|
||||
Field bufferField = ClassReflection.getDeclaredField(OpenALMusic.class, "tempBuffer");
|
||||
@@ -36,6 +38,10 @@ public class Visualizer extends MusicManagerFFT {
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see zero1hd.rhythmbullet.desktop.audio.visualizer.Visualizer#calcPCMData()
|
||||
*/
|
||||
@Override
|
||||
public void calcPCMData() {
|
||||
short chanVal;
|
||||
int bufferPosOffset = 0;
|
||||
@@ -98,6 +104,10 @@ public class Visualizer extends MusicManagerFFT {
|
||||
return pos;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see zero1hd.rhythmbullet.desktop.audio.visualizer.Visualizer#setMM(zero1hd.rhythmbullet.audio.MusicManager)
|
||||
*/
|
||||
@Override
|
||||
public void setMM(MusicManager mm) {
|
||||
try {
|
||||
Field sourceIDField = ClassReflection.getDeclaredField(OpenALMusic.class, "sourceID");
|
||||
@@ -123,4 +133,23 @@ public class Visualizer extends MusicManagerFFT {
|
||||
|
||||
super.setMM(mm);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MusicManager getMM() {
|
||||
return mm;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(Batch batch, float parentAlpha) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public float[] getAudioPCMData() {
|
||||
return getAudioPCM();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fft() {
|
||||
calculate();
|
||||
}
|
||||
}
|
@@ -1,269 +0,0 @@
|
||||
package zero1hd.rhythmbullet.desktop.audio.visualizer;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.graphics.Pixmap;
|
||||
import com.badlogic.gdx.graphics.Pixmap.Format;
|
||||
import com.badlogic.gdx.graphics.Texture;
|
||||
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;
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
|
||||
import zero1hd.rhythmbullet.audio.MusicManager;
|
||||
import zero1hd.rhythmbullet.audio.visualizer.MirrorVisualizer;
|
||||
|
||||
public class HorizontalVisualizer extends Visualizer {
|
||||
private Pixmap pixmap;
|
||||
private Texture barTexture;
|
||||
private int barWidth;
|
||||
private int binsPerBar;
|
||||
private int spaceBetweenBars;
|
||||
private Sprite[] bars;
|
||||
private float[] barHeights;
|
||||
private int smoothRange;
|
||||
private float barHeightMultiplier;
|
||||
private float rotation;
|
||||
private Vector2 angleRot;
|
||||
private boolean flip;
|
||||
private Array<MirrorVisualizer> mirrors;
|
||||
private boolean reverse;
|
||||
private float maxAvgHeight;
|
||||
private float currentAvg;
|
||||
private int barCount;
|
||||
private float width, height, x, y;
|
||||
|
||||
public HorizontalVisualizer() {
|
||||
super();
|
||||
mirrors = new Array<>();
|
||||
pixmap = new Pixmap(2, 2, Format.RGBA8888);
|
||||
pixmap.setColor(Color.WHITE);
|
||||
pixmap.fill();
|
||||
|
||||
barCount = 68;
|
||||
|
||||
width = Gdx.graphics.getWidth();
|
||||
height = Gdx.graphics.getHeight()/2f;
|
||||
x = 0;
|
||||
y = 0;
|
||||
|
||||
|
||||
smoothRange = 2;
|
||||
angleRot = new Vector2(MathUtils.cosDeg(rotation), MathUtils.sinDeg(rotation));
|
||||
bars = new Sprite[barCount];
|
||||
barHeights = new float[barCount];
|
||||
barTexture = new Texture(pixmap);
|
||||
for (int i = 0; i < bars.length; i++) {
|
||||
bars[i] = new Sprite(barTexture);
|
||||
}
|
||||
|
||||
updatePositionInfo();
|
||||
pixmap.dispose();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(Batch batch, float parentAlpha) {
|
||||
if (mm != null) {
|
||||
for (int i = 0; i < bars.length; i++) {
|
||||
bars[i].draw(batch);
|
||||
for (int j = 0; j < mirrors.size; j++) {
|
||||
mirrors.get(j).render(i, batch, parentAlpha, bars);
|
||||
}
|
||||
}
|
||||
}
|
||||
super.render(batch, parentAlpha);
|
||||
}
|
||||
|
||||
public void update(float delta) {
|
||||
if (mm != null) {
|
||||
//Averaging bins together
|
||||
for (int i = 0; i < barCount; i++) {
|
||||
float barHeight = 0;
|
||||
for (int j = 0; j < binsPerBar; j++) {
|
||||
barHeight += Math.abs(audioPCM[j+i*binsPerBar +1]);
|
||||
}
|
||||
barHeight /= binsPerBar;
|
||||
barHeight *= barHeightMultiplier;
|
||||
barHeights[i] = barHeight;
|
||||
}
|
||||
currentAvg = 0;
|
||||
for (int i = 0; i < barCount; i++) {
|
||||
int avg = 0;
|
||||
//Averaging the bars
|
||||
for (int range = 0; range < smoothRange; range++) {
|
||||
if (i+range < barCount) {
|
||||
avg += barHeights[i+range];
|
||||
}
|
||||
if (i-range >= 0) {
|
||||
avg += barHeights[i-range];
|
||||
}
|
||||
}
|
||||
avg /= smoothRange*2;
|
||||
barHeights[i] = avg;
|
||||
currentAvg += barHeights[i];
|
||||
if (bars[i].getHeight() > barHeights[i]) {
|
||||
bars[i].setSize(barWidth, bars[i].getHeight() - (15f*delta*(bars[i].getHeight()-barHeights[i])));
|
||||
} else {
|
||||
bars[i].setSize(barWidth, bars[i].getHeight() + (20f*delta*(barHeights[i] - bars[i].getHeight())));
|
||||
}
|
||||
}
|
||||
currentAvg /= barHeights.length;
|
||||
if (currentAvg > maxAvgHeight) {
|
||||
maxAvgHeight = currentAvg;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMM(MusicManager mm) {
|
||||
maxAvgHeight = 0;
|
||||
currentAvg = 0;
|
||||
float validBins = (1700/((mm.getSampleRate()/2)/((mm.getReadWindowSize()/2)+1)));
|
||||
Gdx.app.debug("Visualizer", "valid frequency bins " + validBins);
|
||||
binsPerBar = MathUtils.round((validBins/barCount));
|
||||
barHeights = new float[barCount];
|
||||
super.setMM(mm);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
barTexture.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
public void updatePositionInfo() {
|
||||
barHeightMultiplier = height*0.03f;
|
||||
int barSpace = 0;
|
||||
angleRot.set(MathUtils.cosDeg(rotation), MathUtils.sinDeg(rotation));
|
||||
|
||||
barWidth = MathUtils.round((float) width/(float) barCount);
|
||||
barWidth -= spaceBetweenBars;
|
||||
for (int i = 0; i < bars.length; i++) {
|
||||
barSpace = i*(barWidth+spaceBetweenBars);
|
||||
if (flip) {
|
||||
bars[i].setRotation(rotation+180);
|
||||
} else {
|
||||
bars[i].setRotation(rotation);
|
||||
}
|
||||
if (reverse) {
|
||||
bars[bars.length-i-1].setPosition(x + barSpace*angleRot.x, y + barSpace*angleRot.y);
|
||||
} else {
|
||||
bars[i].setPosition(x + barSpace*angleRot.x, y + barSpace*angleRot.y);
|
||||
}
|
||||
for (int mirrorIndex = 0; mirrorIndex < mirrors.size; mirrorIndex++) {
|
||||
mirrors.get(mirrorIndex).position(i, barWidth, spaceBetweenBars);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public float getActualWidth() {
|
||||
return (barWidth+spaceBetweenBars)*(barCount - 1);
|
||||
}
|
||||
|
||||
public void setColor(Color color) {
|
||||
for (int i = 0; i < bars.length; i++) {
|
||||
bars[i].setColor(color);
|
||||
}
|
||||
for (int i = 0; i < mirrors.size; i++) {
|
||||
mirrors.get(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);
|
||||
}
|
||||
for (int i = 0; i < mirrors.size; i++) {
|
||||
mirrors.get(i).setColor(r, g, b, a);
|
||||
}
|
||||
}
|
||||
|
||||
public void setRotation(float rotation) {
|
||||
this.rotation = rotation;
|
||||
}
|
||||
|
||||
public void flip() {
|
||||
flip = !flip;
|
||||
}
|
||||
|
||||
public boolean isFlipped() {
|
||||
return flip;
|
||||
}
|
||||
|
||||
public void addMirrorVisualizer(MirrorVisualizer mirror) {
|
||||
updatePositionInfo();
|
||||
mirror.setup(bars, x, y, rotation);
|
||||
mirrors.add(mirror);
|
||||
x = (int) (((width - getActualWidth())/2f));
|
||||
}
|
||||
|
||||
public void removeMirrorVisualizer(MirrorVisualizer mirror) {
|
||||
mirrors.removeValue(mirror, true);
|
||||
}
|
||||
|
||||
public void setSpaceBetweenBars(int spaceBetweenBars) {
|
||||
this.spaceBetweenBars = spaceBetweenBars;
|
||||
}
|
||||
|
||||
public int getBarWidth() {
|
||||
return barWidth;
|
||||
}
|
||||
|
||||
public void reverse() {
|
||||
reverse = reverse ? false : true;
|
||||
}
|
||||
|
||||
public boolean isReversed() {
|
||||
return reverse;
|
||||
}
|
||||
|
||||
public Sprite[] getBars() {
|
||||
return bars;
|
||||
}
|
||||
|
||||
public float getCurrentAvg() {
|
||||
return currentAvg;
|
||||
}
|
||||
|
||||
public float getMaxAvgHeight() {
|
||||
return maxAvgHeight;
|
||||
}
|
||||
|
||||
public int getSpaceBetweenBars() {
|
||||
return spaceBetweenBars;
|
||||
}
|
||||
|
||||
public void setX(float x) {
|
||||
this.x = x;
|
||||
}
|
||||
|
||||
public float getX() {
|
||||
return x;
|
||||
}
|
||||
|
||||
public void setY(float y) {
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
public float getY() {
|
||||
return y;
|
||||
}
|
||||
|
||||
public void setWidth(float width) {
|
||||
this.width = width;
|
||||
}
|
||||
|
||||
public float getWidth() {
|
||||
return width;
|
||||
}
|
||||
|
||||
public void setHeight(float height) {
|
||||
this.height = height;
|
||||
}
|
||||
|
||||
public float getHeight() {
|
||||
return height;
|
||||
}
|
||||
}
|
@@ -7,7 +7,8 @@ import com.badlogic.gdx.scenes.scene2d.ui.Widget;
|
||||
import com.badlogic.gdx.utils.Disposable;
|
||||
|
||||
import zero1hd.rhythmbullet.audio.MusicManager;
|
||||
import zero1hd.rhythmbullet.desktop.audio.visualizer.HorizontalVisualizer;
|
||||
import zero1hd.rhythmbullet.audio.visualizer.HorizontalVisualizer;
|
||||
import zero1hd.rhythmbullet.desktop.audio.visualizer.DesktopVisualizer;
|
||||
|
||||
public class HorizontalVisualizerWidget extends Widget implements Disposable {
|
||||
private HorizontalVisualizer vis;
|
||||
@@ -17,7 +18,7 @@ public class HorizontalVisualizerWidget extends Widget implements Disposable {
|
||||
private float visRefreshRate;
|
||||
private float timer;
|
||||
public HorizontalVisualizerWidget() {
|
||||
vis = new HorizontalVisualizer();
|
||||
vis = new HorizontalVisualizer(new DesktopVisualizer());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -49,7 +50,7 @@ public class HorizontalVisualizerWidget extends Widget implements Disposable {
|
||||
if (timer >= visRefreshRate) {
|
||||
timer = 0;
|
||||
vis.calcPCMData();
|
||||
vis.calculate(delta);
|
||||
vis.calculate();
|
||||
} else {
|
||||
timer += delta;
|
||||
}
|
||||
@@ -98,7 +99,7 @@ public class HorizontalVisualizerWidget extends Widget implements Disposable {
|
||||
return updatePositioning;
|
||||
}
|
||||
|
||||
public HorizontalVisualizer getVis() {
|
||||
public HorizontalVisualizer getVisualizerType() {
|
||||
return vis;
|
||||
}
|
||||
|
||||
|
@@ -33,18 +33,18 @@ public class TitleBarVisualizer extends Group implements Disposable {
|
||||
public TitleBarVisualizer(AssetManager assets) {
|
||||
if (assets == null) throw new NullPointerException("TitleBarVisualizer requires assets manager... ITS NULL YOU FOOL");
|
||||
visual = new HorizontalVisualizerWidget();
|
||||
visual.getVis().setSpaceBetweenBars(visual.getVis().getBarWidth()- 2);
|
||||
visual.getVisualizerType().setSpaceBetweenBars(visual.getVisualizerType().getBarWidth()- 2);
|
||||
addActor(visual);
|
||||
|
||||
setSize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()*0.2f);
|
||||
setPosition(0, (Gdx.graphics.getHeight()-getHeight())/2f);
|
||||
visual.setWidth(getWidth());
|
||||
visual.setHeight(getHeight());
|
||||
visual.getVis().flip();
|
||||
visual.getVis().reverse();
|
||||
visual.getVisualizerType().flip();
|
||||
visual.getVisualizerType().reverse();
|
||||
visual2 = new MirrorVisualizer();
|
||||
visual.setUpdatePositioning(false);
|
||||
visual.getVis().addMirrorVisualizer(visual2);
|
||||
visual.getVisualizerType().addMirrorVisualizer(visual2);
|
||||
visual2.setyPos(MathUtils.round(getHeight()));
|
||||
visual.setY(-2);
|
||||
visual.updateVisualPosition();
|
||||
@@ -85,7 +85,7 @@ public class TitleBarVisualizer extends Group implements Disposable {
|
||||
@Override
|
||||
public void act(float delta) {
|
||||
if (particleLimitTime > 1f/60f) {
|
||||
if (visual.getVis().getMm() != null && visual.getVis().getMm().isPlaying() && visual.getVis().getCurrentAvg() > visual.getVis().getMaxAvgHeight()*0.55f) {
|
||||
if (visual.getVisualizerType().getVisualizer().getMM() != null && visual.getVisualizerType().getVisualizer().getMM().isPlaying() && visual.getVisualizerType().getCurrentAvg() > visual.getVisualizerType().getMaxAvgHeight()*0.55f) {
|
||||
PooledEffect effect = beatEffectPool.obtain();
|
||||
effect.setPosition(0, 0);
|
||||
effects.add(effect);
|
||||
|
@@ -21,12 +21,10 @@ public class OptionsPage extends Page {
|
||||
private ProgressBar musicVolSlider;
|
||||
private ProgressBar fxVolSlider;
|
||||
private TextField directoryField;
|
||||
private MusicListController mlc;
|
||||
private float musicSearchTimer;
|
||||
|
||||
public OptionsPage(final RhythmBullet core, final Vector3 targetPosition, KeybindOptionsPage moreOptionsPage, final MusicListController mlc) {
|
||||
public OptionsPage(final RhythmBullet core, final Vector3 targetPosition, KeybindOptionsPage moreOptionsPage, MusicListController mlc) {
|
||||
super("General", core.getDefaultSkin());
|
||||
this.mlc = mlc;
|
||||
|
||||
//Back button
|
||||
TextButton backButton = new TextButton("Back", core.getDefaultSkin());
|
||||
|
@@ -10,7 +10,8 @@ import com.badlogic.gdx.graphics.g2d.SpriteBatch;
|
||||
import com.badlogic.gdx.utils.viewport.ExtendViewport;
|
||||
|
||||
import zero1hd.rhythmbullet.RhythmBullet;
|
||||
import zero1hd.rhythmbullet.desktop.audio.visualizer.CircularVisualizer;
|
||||
import zero1hd.rhythmbullet.audio.visualizer.CircularVisualizer;
|
||||
import zero1hd.rhythmbullet.desktop.audio.visualizer.DesktopVisualizer;
|
||||
import zero1hd.rhythmbullet.game.GameController;
|
||||
|
||||
public class GameScreen extends ScreenAdapter {
|
||||
@@ -18,16 +19,17 @@ public class GameScreen extends ScreenAdapter {
|
||||
private SpriteBatch batch;
|
||||
private ExtendViewport viewport;
|
||||
private GameController gc;
|
||||
private CircularVisualizer cVisualizer;
|
||||
private CircularVisualizer circleVisualizer;
|
||||
|
||||
public GameScreen(AssetManager assets, Preferences prefs) {
|
||||
this.assets = assets;
|
||||
batch = new SpriteBatch();
|
||||
viewport = new ExtendViewport(RhythmBullet.WORLD_WIDTH, RhythmBullet.WORLD_HEIGHT);
|
||||
cVisualizer = new CircularVisualizer();
|
||||
cVisualizer.setCenter(Gdx.graphics.getWidth()/2, Gdx.graphics.getHeight()/2);
|
||||
cVisualizer.setCamera(viewport.getCamera());
|
||||
cVisualizer.setColor(Color.CYAN.toFloatBits());
|
||||
cVisualizer.applyPositionChanges();
|
||||
circleVisualizer = new CircularVisualizer(new DesktopVisualizer());
|
||||
circleVisualizer.setCenter(Gdx.graphics.getWidth()/2, Gdx.graphics.getHeight()/2);
|
||||
circleVisualizer.setCamera(viewport.getCamera());
|
||||
circleVisualizer.setColor(Color.CYAN.toFloatBits());
|
||||
circleVisualizer.applyPositionChanges();
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +37,7 @@ public class GameScreen extends ScreenAdapter {
|
||||
public void render(float delta) {
|
||||
Gdx.gl.glClearColor(0.22f, 0.22f, 0.22f, 1f);
|
||||
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
|
||||
cVisualizer.drawVisualizer();
|
||||
circleVisualizer.drawVisualizer();
|
||||
super.render(delta);
|
||||
}
|
||||
}
|
||||
|
@@ -29,7 +29,6 @@ public class SplashScreen extends ScreenAdapter implements AdvancedResizeScreen
|
||||
super.show();
|
||||
}
|
||||
|
||||
float count = 0;
|
||||
@Override
|
||||
public void render(float delta) {
|
||||
Gdx.gl.glClearColor(1f, 1f, 1f, 1f);
|
||||
|
Reference in New Issue
Block a user