fixed mac render glitch, flipped visualizer
This commit is contained in:
parent
d64dc8a4d1
commit
307e118b3a
@ -24,7 +24,8 @@ public class BasicVisualizer extends VisualizerCore {
|
||||
private float barHeightMultiplier;
|
||||
private float rotation;
|
||||
private Vector2 angleRot;
|
||||
|
||||
private boolean flip;
|
||||
|
||||
public BasicVisualizer() {
|
||||
super(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()/2, 0, 0);
|
||||
barHeightMultiplier = Gdx.graphics.getHeight()*0.008f;
|
||||
@ -39,8 +40,7 @@ public class BasicVisualizer extends VisualizerCore {
|
||||
angleRot = new Vector2(MathUtils.cosDeg(rotation), MathUtils.sinDeg(rotation));
|
||||
textures = new Texture[barCount];
|
||||
bars = new Sprite[barCount];
|
||||
|
||||
|
||||
|
||||
for (int i = 0; i < textures.length; i++) {
|
||||
textures[i] = new Texture(pixmap);
|
||||
bars[i] = new Sprite(textures[i]);
|
||||
@ -108,7 +108,11 @@ public class BasicVisualizer extends VisualizerCore {
|
||||
|
||||
for (int i = 0; i < bars.length; i++) {
|
||||
barSpace = i*(barWidth+spaceBetweenBars);
|
||||
bars[i].setRotation(rotation);
|
||||
if (flip) {
|
||||
bars[i].setRotation(rotation+180);
|
||||
} else {
|
||||
bars[i].setRotation(rotation);
|
||||
}
|
||||
bars[i].setPosition(xPos + barSpace*angleRot.x, yPos + barSpace*angleRot.y);
|
||||
}
|
||||
}
|
||||
@ -128,4 +132,12 @@ public class BasicVisualizer extends VisualizerCore {
|
||||
public void setRotation(float rotation) {
|
||||
this.rotation = rotation;
|
||||
}
|
||||
|
||||
public void flip() {
|
||||
flip = flip ? false : true;
|
||||
}
|
||||
|
||||
public boolean isFlipped() {
|
||||
return flip;
|
||||
}
|
||||
}
|
||||
|
@ -81,24 +81,21 @@ public class TitleBarMesh implements Disposable {
|
||||
verts[idx++] = c;
|
||||
}
|
||||
|
||||
private void flush() {
|
||||
public void flush() {
|
||||
if (idx != 0) {
|
||||
mesh.setVertices(verts);
|
||||
|
||||
Gdx.gl.glDepthMask(false);
|
||||
Gdx.gl.glEnable(GL20.GL_BLEND);
|
||||
Gdx.gl.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
|
||||
int vertCount = idx/TOTAL_VARS;
|
||||
|
||||
cam.setToOrtho(false, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
|
||||
|
||||
shader.begin();
|
||||
|
||||
shader.setUniformMatrix("u_projTrans", cam.combined);
|
||||
|
||||
mesh.render(shader, GL20.GL_TRIANGLE_FAN, 0, vertCount);
|
||||
|
||||
shader.end();
|
||||
|
||||
Gdx.gl.glDepthMask(true);
|
||||
@ -110,5 +107,6 @@ public class TitleBarMesh implements Disposable {
|
||||
@Override
|
||||
public void dispose() {
|
||||
mesh.dispose();
|
||||
shader.dispose();
|
||||
}
|
||||
}
|
||||
|
@ -28,6 +28,7 @@ public class TitleBarVisualizer extends Group implements Disposable {
|
||||
|
||||
hvisual.setWidth(getWidth());
|
||||
hvisual.setHeight(Gdx.graphics.getHeight()*0.3f);
|
||||
hvisual.getVis().flip();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -38,6 +39,8 @@ public class TitleBarVisualizer extends Group implements Disposable {
|
||||
@Override
|
||||
public void draw(Batch batch, float parentAlpha) {
|
||||
background.draw();
|
||||
batch.end();
|
||||
batch.begin();
|
||||
super.draw(batch, parentAlpha);
|
||||
}
|
||||
|
||||
|
@ -63,4 +63,8 @@ public class Visualizer extends Widget {
|
||||
public boolean isUpdatePositioning() {
|
||||
return updatePositioning;
|
||||
}
|
||||
|
||||
public BasicVisualizer getVis() {
|
||||
return vis;
|
||||
}
|
||||
}
|
||||
|
@ -10,6 +10,9 @@ public class DesktopLauncher {
|
||||
LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
|
||||
config.title = "Rhythm Bullet";
|
||||
config.resizable = false;
|
||||
config.allowSoftwareMode = true;
|
||||
config.useHDPI = true;
|
||||
config.vSyncEnabled = true;
|
||||
new LwjglApplication(new RhythmBullet(), config);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user