made more visualizer code accessible for other platforms by using interface
This commit is contained in:
parent
2aa498e292
commit
bfcad74529
@ -1,4 +1,4 @@
|
|||||||
package zero1hd.rhythmbullet.desktop.audio.visualizer;
|
package zero1hd.rhythmbullet.audio.visualizer;
|
||||||
|
|
||||||
import com.badlogic.gdx.Gdx;
|
import com.badlogic.gdx.Gdx;
|
||||||
import com.badlogic.gdx.graphics.Camera;
|
import com.badlogic.gdx.graphics.Camera;
|
||||||
@ -12,7 +12,7 @@ import com.badlogic.gdx.utils.Disposable;
|
|||||||
|
|
||||||
import zero1hd.rhythmbullet.RhythmBullet;
|
import zero1hd.rhythmbullet.RhythmBullet;
|
||||||
|
|
||||||
public class CircularVisualizer extends Visualizer implements Disposable {
|
public class CircularVisualizer implements Disposable {
|
||||||
private int circlePointIndex;
|
private int circlePointIndex;
|
||||||
private int centerX, centerY;
|
private int centerX, centerY;
|
||||||
private int r;
|
private int r;
|
||||||
@ -22,17 +22,21 @@ public class CircularVisualizer extends Visualizer implements Disposable {
|
|||||||
private float color;
|
private float color;
|
||||||
private Mesh mesh;
|
private Mesh mesh;
|
||||||
private ShaderProgram shader;
|
private ShaderProgram shader;
|
||||||
|
private Visualizer visualizer;
|
||||||
private int barCount = 180;
|
private int barCount = 180;
|
||||||
private float barHeightMultiplier = 1.5f;
|
private float barHeightMultiplier = 1.5f;
|
||||||
private float[] audioSpectrum;
|
private float[] audioSpectrum;
|
||||||
private Camera camera;
|
private Camera camera;
|
||||||
public CircularVisualizer() {
|
|
||||||
|
public CircularVisualizer(Visualizer visualizer) {
|
||||||
shader = new ShaderProgram(Gdx.files.internal("shaders/mesh.vsh"), Gdx.files.internal("shaders/mesh.fsh"));
|
shader = new ShaderProgram(Gdx.files.internal("shaders/mesh.vsh"), Gdx.files.internal("shaders/mesh.fsh"));
|
||||||
if (!shader.isCompiled() || shader.getLog().length() != 0) {
|
if (!shader.isCompiled() || shader.getLog().length() != 0) {
|
||||||
Gdx.app.debug("Circular visualizer shader", shader.getLog());
|
Gdx.app.debug("Circular visualizer shader", shader.getLog());
|
||||||
Gdx.app.exit();
|
Gdx.app.exit();
|
||||||
}
|
}
|
||||||
r = RhythmBullet.pixels_per_unit*RhythmBullet.SPAWN_CIRCLE_RADIUS;
|
r = RhythmBullet.pixels_per_unit*RhythmBullet.SPAWN_CIRCLE_RADIUS;
|
||||||
|
|
||||||
|
this.visualizer = visualizer;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
@ -1,4 +1,4 @@
|
|||||||
package zero1hd.rhythmbullet.desktop.audio.visualizer;
|
package zero1hd.rhythmbullet.audio.visualizer;
|
||||||
|
|
||||||
import com.badlogic.gdx.Gdx;
|
import com.badlogic.gdx.Gdx;
|
||||||
import com.badlogic.gdx.graphics.Color;
|
import com.badlogic.gdx.graphics.Color;
|
||||||
@ -10,11 +10,11 @@ import com.badlogic.gdx.graphics.g2d.Sprite;
|
|||||||
import com.badlogic.gdx.math.MathUtils;
|
import com.badlogic.gdx.math.MathUtils;
|
||||||
import com.badlogic.gdx.math.Vector2;
|
import com.badlogic.gdx.math.Vector2;
|
||||||
import com.badlogic.gdx.utils.Array;
|
import com.badlogic.gdx.utils.Array;
|
||||||
|
import com.badlogic.gdx.utils.Disposable;
|
||||||
|
|
||||||
import zero1hd.rhythmbullet.audio.MusicManager;
|
import zero1hd.rhythmbullet.audio.MusicManager;
|
||||||
import zero1hd.rhythmbullet.audio.visualizer.MirrorVisualizer;
|
|
||||||
|
|
||||||
public class HorizontalVisualizer extends Visualizer {
|
public class HorizontalVisualizer implements Disposable {
|
||||||
private Pixmap pixmap;
|
private Pixmap pixmap;
|
||||||
private Texture barTexture;
|
private Texture barTexture;
|
||||||
private int barWidth;
|
private int barWidth;
|
||||||
@ -34,7 +34,9 @@ public class HorizontalVisualizer extends Visualizer {
|
|||||||
private int barCount;
|
private int barCount;
|
||||||
private float width, height, x, y;
|
private float width, height, x, y;
|
||||||
|
|
||||||
public HorizontalVisualizer() {
|
private Visualizer visualizer;
|
||||||
|
|
||||||
|
public HorizontalVisualizer(Visualizer visualizer) {
|
||||||
super();
|
super();
|
||||||
mirrors = new Array<>();
|
mirrors = new Array<>();
|
||||||
pixmap = new Pixmap(2, 2, Format.RGBA8888);
|
pixmap = new Pixmap(2, 2, Format.RGBA8888);
|
||||||
@ -48,6 +50,7 @@ public class HorizontalVisualizer extends Visualizer {
|
|||||||
x = 0;
|
x = 0;
|
||||||
y = 0;
|
y = 0;
|
||||||
|
|
||||||
|
this.visualizer = visualizer;
|
||||||
|
|
||||||
smoothRange = 2;
|
smoothRange = 2;
|
||||||
angleRot = new Vector2(MathUtils.cosDeg(rotation), MathUtils.sinDeg(rotation));
|
angleRot = new Vector2(MathUtils.cosDeg(rotation), MathUtils.sinDeg(rotation));
|
||||||
@ -62,9 +65,8 @@ public class HorizontalVisualizer extends Visualizer {
|
|||||||
pixmap.dispose();
|
pixmap.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void render(Batch batch, float parentAlpha) {
|
public void render(Batch batch, float parentAlpha) {
|
||||||
if (mm != null) {
|
if (visualizer.getMM() != null) {
|
||||||
for (int i = 0; i < bars.length; i++) {
|
for (int i = 0; i < bars.length; i++) {
|
||||||
bars[i].draw(batch);
|
bars[i].draw(batch);
|
||||||
for (int j = 0; j < mirrors.size; j++) {
|
for (int j = 0; j < mirrors.size; j++) {
|
||||||
@ -72,16 +74,16 @@ public class HorizontalVisualizer extends Visualizer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
super.render(batch, parentAlpha);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void update(float delta) {
|
public void update(float delta) {
|
||||||
if (mm != null) {
|
if (visualizer.getMM() != null) {
|
||||||
//Averaging bins together
|
//Averaging bins together
|
||||||
for (int i = 0; i < barCount; i++) {
|
for (int i = 0; i < barCount; i++) {
|
||||||
float barHeight = 0;
|
float barHeight = 0;
|
||||||
for (int j = 0; j < binsPerBar; j++) {
|
for (int j = 0; j < binsPerBar; j++) {
|
||||||
barHeight += Math.abs(audioPCM[j+i*binsPerBar +1]);
|
barHeight += Math.abs(visualizer.getAudioPCMData()[j+i*binsPerBar +1]);
|
||||||
}
|
}
|
||||||
barHeight /= binsPerBar;
|
barHeight /= binsPerBar;
|
||||||
barHeight *= barHeightMultiplier;
|
barHeight *= barHeightMultiplier;
|
||||||
@ -115,7 +117,6 @@ public class HorizontalVisualizer extends Visualizer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setMM(MusicManager mm) {
|
public void setMM(MusicManager mm) {
|
||||||
maxAvgHeight = 0;
|
maxAvgHeight = 0;
|
||||||
currentAvg = 0;
|
currentAvg = 0;
|
||||||
@ -123,13 +124,12 @@ public class HorizontalVisualizer extends Visualizer {
|
|||||||
Gdx.app.debug("Visualizer", "valid frequency bins " + validBins);
|
Gdx.app.debug("Visualizer", "valid frequency bins " + validBins);
|
||||||
binsPerBar = MathUtils.round((validBins/barCount));
|
binsPerBar = MathUtils.round((validBins/barCount));
|
||||||
barHeights = new float[barCount];
|
barHeights = new float[barCount];
|
||||||
super.setMM(mm);
|
visualizer.setMM(mm);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
barTexture.dispose();
|
barTexture.dispose();
|
||||||
super.dispose();
|
visualizer.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updatePositionInfo() {
|
public void updatePositionInfo() {
|
||||||
@ -266,4 +266,16 @@ public class HorizontalVisualizer extends Visualizer {
|
|||||||
public float getHeight() {
|
public float getHeight() {
|
||||||
return height;
|
return height;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void calcPCMData() {
|
||||||
|
visualizer.calcPCMData();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void calculate() {
|
||||||
|
visualizer.fft();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Visualizer getVisualizer() {
|
||||||
|
return visualizer;
|
||||||
|
}
|
||||||
}
|
}
|
@ -2,7 +2,6 @@ package zero1hd.rhythmbullet.audio.visualizer;
|
|||||||
|
|
||||||
import java.util.concurrent.locks.ReentrantLock;
|
import java.util.concurrent.locks.ReentrantLock;
|
||||||
|
|
||||||
import com.badlogic.gdx.graphics.g2d.Batch;
|
|
||||||
import com.badlogic.gdx.utils.Disposable;
|
import com.badlogic.gdx.utils.Disposable;
|
||||||
|
|
||||||
import edu.emory.mathcs.jtransforms.fft.FloatFFT_1D;
|
import edu.emory.mathcs.jtransforms.fft.FloatFFT_1D;
|
||||||
@ -19,7 +18,7 @@ public class MusicManagerFFT implements Disposable {
|
|||||||
lock = new ReentrantLock();
|
lock = new ReentrantLock();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void calculate(float delta) {
|
public void calculate() {
|
||||||
if (mm != null && calc && mm.isPlaying()) {
|
if (mm != null && calc && mm.isPlaying()) {
|
||||||
lock.lock();
|
lock.lock();
|
||||||
fft.realForward(audioPCM);
|
fft.realForward(audioPCM);
|
||||||
@ -39,12 +38,6 @@ public class MusicManagerFFT implements Disposable {
|
|||||||
lock.unlock();
|
lock.unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void render(Batch batch, float parentAlpha) {
|
|
||||||
}
|
|
||||||
|
|
||||||
public void update(float delta) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
}
|
}
|
||||||
|
21
core/src/zero1hd/rhythmbullet/audio/visualizer/Visualizer.java
Executable file
21
core/src/zero1hd/rhythmbullet/audio/visualizer/Visualizer.java
Executable file
@ -0,0 +1,21 @@
|
|||||||
|
package zero1hd.rhythmbullet.audio.visualizer;
|
||||||
|
|
||||||
|
import com.badlogic.gdx.graphics.g2d.Batch;
|
||||||
|
import com.badlogic.gdx.utils.Disposable;
|
||||||
|
|
||||||
|
import zero1hd.rhythmbullet.audio.MusicManager;
|
||||||
|
|
||||||
|
public interface Visualizer extends Disposable {
|
||||||
|
|
||||||
|
void calcPCMData();
|
||||||
|
|
||||||
|
void setMM(MusicManager mm);
|
||||||
|
|
||||||
|
MusicManager getMM();
|
||||||
|
|
||||||
|
void render(Batch batch, float delta);
|
||||||
|
|
||||||
|
float[] getAudioPCMData();
|
||||||
|
|
||||||
|
void fft();
|
||||||
|
}
|
@ -9,21 +9,23 @@ import org.lwjgl.openal.AL11;
|
|||||||
|
|
||||||
import com.badlogic.gdx.Gdx;
|
import com.badlogic.gdx.Gdx;
|
||||||
import com.badlogic.gdx.backends.lwjgl.audio.OpenALMusic;
|
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.ClassReflection;
|
||||||
import com.badlogic.gdx.utils.reflect.Field;
|
import com.badlogic.gdx.utils.reflect.Field;
|
||||||
import com.badlogic.gdx.utils.reflect.ReflectionException;
|
import com.badlogic.gdx.utils.reflect.ReflectionException;
|
||||||
|
|
||||||
import zero1hd.rhythmbullet.audio.MusicManager;
|
import zero1hd.rhythmbullet.audio.MusicManager;
|
||||||
import zero1hd.rhythmbullet.audio.visualizer.MusicManagerFFT;
|
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 playingBuffer;
|
||||||
private ShortBuffer compareBuffer;
|
private ShortBuffer compareBuffer;
|
||||||
private ShortBuffer buffer;
|
private ShortBuffer buffer;
|
||||||
private int sourceID;
|
private int sourceID;
|
||||||
private int readWindowIndex;
|
private int readWindowIndex;
|
||||||
|
|
||||||
public Visualizer() {
|
public DesktopVisualizer() {
|
||||||
super();
|
super();
|
||||||
try {
|
try {
|
||||||
Field bufferField = ClassReflection.getDeclaredField(OpenALMusic.class, "tempBuffer");
|
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() {
|
public void calcPCMData() {
|
||||||
short chanVal;
|
short chanVal;
|
||||||
int bufferPosOffset = 0;
|
int bufferPosOffset = 0;
|
||||||
@ -98,6 +104,10 @@ public class Visualizer extends MusicManagerFFT {
|
|||||||
return pos;
|
return pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see zero1hd.rhythmbullet.desktop.audio.visualizer.Visualizer#setMM(zero1hd.rhythmbullet.audio.MusicManager)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
public void setMM(MusicManager mm) {
|
public void setMM(MusicManager mm) {
|
||||||
try {
|
try {
|
||||||
Field sourceIDField = ClassReflection.getDeclaredField(OpenALMusic.class, "sourceID");
|
Field sourceIDField = ClassReflection.getDeclaredField(OpenALMusic.class, "sourceID");
|
||||||
@ -123,4 +133,23 @@ public class Visualizer extends MusicManagerFFT {
|
|||||||
|
|
||||||
super.setMM(mm);
|
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();
|
||||||
|
}
|
||||||
}
|
}
|
@ -7,7 +7,8 @@ import com.badlogic.gdx.scenes.scene2d.ui.Widget;
|
|||||||
import com.badlogic.gdx.utils.Disposable;
|
import com.badlogic.gdx.utils.Disposable;
|
||||||
|
|
||||||
import zero1hd.rhythmbullet.audio.MusicManager;
|
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 {
|
public class HorizontalVisualizerWidget extends Widget implements Disposable {
|
||||||
private HorizontalVisualizer vis;
|
private HorizontalVisualizer vis;
|
||||||
@ -17,7 +18,7 @@ public class HorizontalVisualizerWidget extends Widget implements Disposable {
|
|||||||
private float visRefreshRate;
|
private float visRefreshRate;
|
||||||
private float timer;
|
private float timer;
|
||||||
public HorizontalVisualizerWidget() {
|
public HorizontalVisualizerWidget() {
|
||||||
vis = new HorizontalVisualizer();
|
vis = new HorizontalVisualizer(new DesktopVisualizer());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -49,7 +50,7 @@ public class HorizontalVisualizerWidget extends Widget implements Disposable {
|
|||||||
if (timer >= visRefreshRate) {
|
if (timer >= visRefreshRate) {
|
||||||
timer = 0;
|
timer = 0;
|
||||||
vis.calcPCMData();
|
vis.calcPCMData();
|
||||||
vis.calculate(delta);
|
vis.calculate();
|
||||||
} else {
|
} else {
|
||||||
timer += delta;
|
timer += delta;
|
||||||
}
|
}
|
||||||
@ -98,7 +99,7 @@ public class HorizontalVisualizerWidget extends Widget implements Disposable {
|
|||||||
return updatePositioning;
|
return updatePositioning;
|
||||||
}
|
}
|
||||||
|
|
||||||
public HorizontalVisualizer getVis() {
|
public HorizontalVisualizer getVisualizerType() {
|
||||||
return vis;
|
return vis;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,18 +33,18 @@ public class TitleBarVisualizer extends Group implements Disposable {
|
|||||||
public TitleBarVisualizer(AssetManager assets) {
|
public TitleBarVisualizer(AssetManager assets) {
|
||||||
if (assets == null) throw new NullPointerException("TitleBarVisualizer requires assets manager... ITS NULL YOU FOOL");
|
if (assets == null) throw new NullPointerException("TitleBarVisualizer requires assets manager... ITS NULL YOU FOOL");
|
||||||
visual = new HorizontalVisualizerWidget();
|
visual = new HorizontalVisualizerWidget();
|
||||||
visual.getVis().setSpaceBetweenBars(visual.getVis().getBarWidth()- 2);
|
visual.getVisualizerType().setSpaceBetweenBars(visual.getVisualizerType().getBarWidth()- 2);
|
||||||
addActor(visual);
|
addActor(visual);
|
||||||
|
|
||||||
setSize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()*0.2f);
|
setSize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()*0.2f);
|
||||||
setPosition(0, (Gdx.graphics.getHeight()-getHeight())/2f);
|
setPosition(0, (Gdx.graphics.getHeight()-getHeight())/2f);
|
||||||
visual.setWidth(getWidth());
|
visual.setWidth(getWidth());
|
||||||
visual.setHeight(getHeight());
|
visual.setHeight(getHeight());
|
||||||
visual.getVis().flip();
|
visual.getVisualizerType().flip();
|
||||||
visual.getVis().reverse();
|
visual.getVisualizerType().reverse();
|
||||||
visual2 = new MirrorVisualizer();
|
visual2 = new MirrorVisualizer();
|
||||||
visual.setUpdatePositioning(false);
|
visual.setUpdatePositioning(false);
|
||||||
visual.getVis().addMirrorVisualizer(visual2);
|
visual.getVisualizerType().addMirrorVisualizer(visual2);
|
||||||
visual2.setyPos(MathUtils.round(getHeight()));
|
visual2.setyPos(MathUtils.round(getHeight()));
|
||||||
visual.setY(-2);
|
visual.setY(-2);
|
||||||
visual.updateVisualPosition();
|
visual.updateVisualPosition();
|
||||||
@ -85,7 +85,7 @@ public class TitleBarVisualizer extends Group implements Disposable {
|
|||||||
@Override
|
@Override
|
||||||
public void act(float delta) {
|
public void act(float delta) {
|
||||||
if (particleLimitTime > 1f/60f) {
|
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();
|
PooledEffect effect = beatEffectPool.obtain();
|
||||||
effect.setPosition(0, 0);
|
effect.setPosition(0, 0);
|
||||||
effects.add(effect);
|
effects.add(effect);
|
||||||
|
@ -21,12 +21,10 @@ public class OptionsPage extends Page {
|
|||||||
private ProgressBar musicVolSlider;
|
private ProgressBar musicVolSlider;
|
||||||
private ProgressBar fxVolSlider;
|
private ProgressBar fxVolSlider;
|
||||||
private TextField directoryField;
|
private TextField directoryField;
|
||||||
private MusicListController mlc;
|
|
||||||
private float musicSearchTimer;
|
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());
|
super("General", core.getDefaultSkin());
|
||||||
this.mlc = mlc;
|
|
||||||
|
|
||||||
//Back button
|
//Back button
|
||||||
TextButton backButton = new TextButton("Back", core.getDefaultSkin());
|
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 com.badlogic.gdx.utils.viewport.ExtendViewport;
|
||||||
|
|
||||||
import zero1hd.rhythmbullet.RhythmBullet;
|
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;
|
import zero1hd.rhythmbullet.game.GameController;
|
||||||
|
|
||||||
public class GameScreen extends ScreenAdapter {
|
public class GameScreen extends ScreenAdapter {
|
||||||
@ -18,16 +19,17 @@ public class GameScreen extends ScreenAdapter {
|
|||||||
private SpriteBatch batch;
|
private SpriteBatch batch;
|
||||||
private ExtendViewport viewport;
|
private ExtendViewport viewport;
|
||||||
private GameController gc;
|
private GameController gc;
|
||||||
private CircularVisualizer cVisualizer;
|
private CircularVisualizer circleVisualizer;
|
||||||
|
|
||||||
public GameScreen(AssetManager assets, Preferences prefs) {
|
public GameScreen(AssetManager assets, Preferences prefs) {
|
||||||
this.assets = assets;
|
this.assets = assets;
|
||||||
batch = new SpriteBatch();
|
batch = new SpriteBatch();
|
||||||
viewport = new ExtendViewport(RhythmBullet.WORLD_WIDTH, RhythmBullet.WORLD_HEIGHT);
|
viewport = new ExtendViewport(RhythmBullet.WORLD_WIDTH, RhythmBullet.WORLD_HEIGHT);
|
||||||
cVisualizer = new CircularVisualizer();
|
circleVisualizer = new CircularVisualizer(new DesktopVisualizer());
|
||||||
cVisualizer.setCenter(Gdx.graphics.getWidth()/2, Gdx.graphics.getHeight()/2);
|
circleVisualizer.setCenter(Gdx.graphics.getWidth()/2, Gdx.graphics.getHeight()/2);
|
||||||
cVisualizer.setCamera(viewport.getCamera());
|
circleVisualizer.setCamera(viewport.getCamera());
|
||||||
cVisualizer.setColor(Color.CYAN.toFloatBits());
|
circleVisualizer.setColor(Color.CYAN.toFloatBits());
|
||||||
cVisualizer.applyPositionChanges();
|
circleVisualizer.applyPositionChanges();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -35,7 +37,7 @@ public class GameScreen extends ScreenAdapter {
|
|||||||
public void render(float delta) {
|
public void render(float delta) {
|
||||||
Gdx.gl.glClearColor(0.22f, 0.22f, 0.22f, 1f);
|
Gdx.gl.glClearColor(0.22f, 0.22f, 0.22f, 1f);
|
||||||
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
|
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
|
||||||
cVisualizer.drawVisualizer();
|
circleVisualizer.drawVisualizer();
|
||||||
super.render(delta);
|
super.render(delta);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,6 @@ public class SplashScreen extends ScreenAdapter implements AdvancedResizeScreen
|
|||||||
super.show();
|
super.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
float count = 0;
|
|
||||||
@Override
|
@Override
|
||||||
public void render(float delta) {
|
public void render(float delta) {
|
||||||
Gdx.gl.glClearColor(1f, 1f, 1f, 1f);
|
Gdx.gl.glClearColor(1f, 1f, 1f, 1f);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user