fixed visualizer width, changed scroll bar skin, changed functioning of shader options
This commit is contained in:
parent
36e121fef0
commit
31ad6f4a10
Binary file not shown.
Before Width: | Height: | Size: 6.2 KiB After Width: | Height: | Size: 6.1 KiB |
@ -68,7 +68,6 @@ public class BasicVisualizer extends VisualizerCore {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void modify(float delta) {
|
public void modify(float delta) {
|
||||||
|
|
||||||
//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;
|
||||||
@ -128,18 +127,18 @@ public class BasicVisualizer extends VisualizerCore {
|
|||||||
int barSpace = 0;
|
int barSpace = 0;
|
||||||
angleRot.set(MathUtils.cosDeg(rotation), MathUtils.sinDeg(rotation));
|
angleRot.set(MathUtils.cosDeg(rotation), MathUtils.sinDeg(rotation));
|
||||||
|
|
||||||
barWidth = MathUtils.ceil((float) width/(float) barCount);
|
barWidth = MathUtils.round((float) width/(float) barCount);
|
||||||
barWidth -= spaceBetweenBars;
|
barWidth -= spaceBetweenBars;
|
||||||
for (int i = 0; i < bars.length; i++) {
|
for (int i = 0; i < bars.length; i++) {
|
||||||
barSpace = i*(barWidth+spaceBetweenBars);
|
barSpace = i*(barWidth+spaceBetweenBars);
|
||||||
if (i == bars.length - 1) {
|
|
||||||
barSpace -= 2;
|
|
||||||
}
|
|
||||||
if (flip) {
|
if (flip) {
|
||||||
bars[i].setRotation(rotation+180);
|
bars[i].setRotation(rotation+180);
|
||||||
} else {
|
} else {
|
||||||
bars[i].setRotation(rotation);
|
bars[i].setRotation(rotation);
|
||||||
}
|
}
|
||||||
|
if (i == bars.length-1 && width <= getActualWidth()) {
|
||||||
|
barSpace -= 2;
|
||||||
|
}
|
||||||
if (reverse) {
|
if (reverse) {
|
||||||
bars[bars.length-i-1].setPosition(xPos + barSpace*angleRot.x, yPos + barSpace*angleRot.y);
|
bars[bars.length-i-1].setPosition(xPos + barSpace*angleRot.x, yPos + barSpace*angleRot.y);
|
||||||
} else {
|
} else {
|
||||||
@ -147,10 +146,14 @@ public class BasicVisualizer extends VisualizerCore {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (int i = 0; i < mirrors.size; i++) {
|
for (int i = 0; i < mirrors.size; i++) {
|
||||||
mirrors.get(i).position(barWidth, spaceBetweenBars);
|
mirrors.get(i).position(barWidth, spaceBetweenBars, (width <= getActualWidth()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public float getActualWidth() {
|
||||||
|
return (barWidth+spaceBetweenBars)*(barCount - 1);
|
||||||
|
}
|
||||||
|
|
||||||
public void setColor(Color color) {
|
public void setColor(Color color) {
|
||||||
for (int i = 0; i < bars.length; i++) {
|
for (int i = 0; i < bars.length; i++) {
|
||||||
bars[i].setColor(color);
|
bars[i].setColor(color);
|
||||||
@ -184,6 +187,7 @@ public class BasicVisualizer extends VisualizerCore {
|
|||||||
public void addMirrorVisualizer(MirrorVisualizer mirror) {
|
public void addMirrorVisualizer(MirrorVisualizer mirror) {
|
||||||
mirror.setup(bars, xPos, yPos, rotation);
|
mirror.setup(bars, xPos, yPos, rotation);
|
||||||
mirrors.add(mirror);
|
mirrors.add(mirror);
|
||||||
|
updatePositionInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeMirrorVisualizer(MirrorVisualizer mirror) {
|
public void removeMirrorVisualizer(MirrorVisualizer mirror) {
|
||||||
@ -217,4 +221,9 @@ public class BasicVisualizer extends VisualizerCore {
|
|||||||
public float getMaxAvgHeight() {
|
public float getMaxAvgHeight() {
|
||||||
return maxAvgHeight;
|
return maxAvgHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getSpaceBetweenBars() {
|
||||||
|
System.out.println(spaceBetweenBars);
|
||||||
|
return spaceBetweenBars;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@ public class MirrorVisualizer {
|
|||||||
this.bars[renderID].draw(batch);
|
this.bars[renderID].draw(batch);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void position(int barWidth, int spaceBetweenBars) {
|
public void position(int barWidth, int spaceBetweenBars, boolean shrink) {
|
||||||
int barSpaceMultiplier = barWidth + spaceBetweenBars;
|
int barSpaceMultiplier = barWidth + spaceBetweenBars;
|
||||||
|
|
||||||
for (int i = 0; i < bars.length; i ++) {
|
for (int i = 0; i < bars.length; i ++) {
|
||||||
@ -44,7 +44,7 @@ public class MirrorVisualizer {
|
|||||||
bars[i].setRotation(rotation);
|
bars[i].setRotation(rotation);
|
||||||
}
|
}
|
||||||
int barSpace = i*(barWidth+spaceBetweenBars);
|
int barSpace = i*(barWidth+spaceBetweenBars);
|
||||||
if (i == bars.length - 1) {
|
if (i == bars.length-1 && shrink) {
|
||||||
barSpace -= 2;
|
barSpace -= 2;
|
||||||
}
|
}
|
||||||
bars[i].setPosition(xPos + barSpace*rectCoordRot.x, yPos + barSpace*rectCoordRot.y);
|
bars[i].setPosition(xPos + barSpace*rectCoordRot.x, yPos + barSpace*rectCoordRot.y);
|
||||||
|
@ -76,4 +76,18 @@ public class VisualizerCore implements Disposable {
|
|||||||
this.height = height;
|
this.height = height;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public float getxPos() {
|
||||||
|
return xPos;
|
||||||
|
}
|
||||||
|
public float getyPos() {
|
||||||
|
return yPos;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getWidth() {
|
||||||
|
return width;
|
||||||
|
}
|
||||||
|
public float getHeight() {
|
||||||
|
return height;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,8 @@ import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
|
|||||||
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
|
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
|
||||||
import com.badlogic.gdx.utils.Align;
|
import com.badlogic.gdx.utils.Align;
|
||||||
|
|
||||||
|
import zero1hd.rhythmbullet.screens.MainMenu;
|
||||||
|
|
||||||
public class GraphicsOptions extends Table {
|
public class GraphicsOptions extends Table {
|
||||||
private Label resolutions, shaders;
|
private Label resolutions, shaders;
|
||||||
private Preferences prefs;
|
private Preferences prefs;
|
||||||
@ -27,7 +29,7 @@ public class GraphicsOptions extends Table {
|
|||||||
_800x480;
|
_800x480;
|
||||||
|
|
||||||
|
|
||||||
public GraphicsOptions(Skin skin, final Preferences prefs) {
|
public GraphicsOptions(MainMenu mainMenu, Skin skin, Preferences prefs) {
|
||||||
align(Align.center);
|
align(Align.center);
|
||||||
defaults().space(10f);
|
defaults().space(10f);
|
||||||
this.prefs = prefs;
|
this.prefs = prefs;
|
||||||
@ -41,10 +43,10 @@ public class GraphicsOptions extends Table {
|
|||||||
@Override
|
@Override
|
||||||
public void changed(ChangeEvent event, Actor actor) {
|
public void changed(ChangeEvent event, Actor actor) {
|
||||||
save();
|
save();
|
||||||
if (prefs.getBoolean("fullscreen")) {
|
if (glowShader.isChecked()) {
|
||||||
Gdx.graphics.setFullscreenMode(Gdx.graphics.getDisplayMode());
|
mainMenu.loadShaders();
|
||||||
} else {
|
} else {
|
||||||
Gdx.graphics.setWindowedMode(prefs.getInteger("screen-width"), prefs.getInteger("screen-height"));
|
mainMenu.unloadShaders();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -57,10 +59,10 @@ public class GraphicsOptions extends Table {
|
|||||||
@Override
|
@Override
|
||||||
public void changed(ChangeEvent event, Actor actor) {
|
public void changed(ChangeEvent event, Actor actor) {
|
||||||
save();
|
save();
|
||||||
if (prefs.getBoolean("fullscreen")) {
|
if (enhancedGlow.isChecked()) {
|
||||||
Gdx.graphics.setFullscreenMode(Gdx.graphics.getDisplayMode());
|
mainMenu.setBlurlvl(6);
|
||||||
} else {
|
} else {
|
||||||
Gdx.graphics.setWindowedMode(prefs.getInteger("screen-width"), prefs.getInteger("screen-height"));
|
mainMenu.setBlurlvl(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -44,8 +44,10 @@ public class TitleBarVisualizer extends Group implements Disposable {
|
|||||||
visual.getVis().flip();
|
visual.getVis().flip();
|
||||||
visual.getVis().reverse();
|
visual.getVis().reverse();
|
||||||
visual2 = new MirrorVisualizer();
|
visual2 = new MirrorVisualizer();
|
||||||
|
visual.setUpdatePositioning(false);
|
||||||
visual.getVis().addMirrorVisualizer(visual2);
|
visual.getVis().addMirrorVisualizer(visual2);
|
||||||
visual2.setyPos(MathUtils.round(getHeight()));
|
visual2.setyPos(MathUtils.round(getHeight()));
|
||||||
|
visual.updateVisualPosition();
|
||||||
|
|
||||||
Pixmap pixmap = new Pixmap(MathUtils.round(getWidth()), MathUtils.round(getHeight()), Format.RGBA8888);
|
Pixmap pixmap = new Pixmap(MathUtils.round(getWidth()), MathUtils.round(getHeight()), Format.RGBA8888);
|
||||||
pixmap.setColor(Color.WHITE);
|
pixmap.setColor(Color.WHITE);
|
||||||
|
@ -41,6 +41,7 @@ public class Visualizer extends Widget {
|
|||||||
vis.setRotation(getRotation());
|
vis.setRotation(getRotation());
|
||||||
if (updatePositioning) {
|
if (updatePositioning) {
|
||||||
vis.updatePositionInfo();
|
vis.updatePositionInfo();
|
||||||
|
vis.setxPos((getWidth() - vis.getActualWidth())/2f);
|
||||||
}
|
}
|
||||||
vis.calculate();
|
vis.calculate();
|
||||||
super.act(delta);
|
super.act(delta);
|
||||||
@ -65,9 +66,16 @@ public class Visualizer extends Widget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setUpdatePositioning(boolean updatePositioning) {
|
public void setUpdatePositioning(boolean updatePositioning) {
|
||||||
|
vis.updatePositionInfo();
|
||||||
|
vis.setxPos(((vis.getWidth() - vis.getActualWidth())/2f));
|
||||||
|
vis.updatePositionInfo();
|
||||||
this.updatePositioning = updatePositioning;
|
this.updatePositioning = updatePositioning;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void updateVisualPosition() {
|
||||||
|
vis.updatePositionInfo();
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isUpdatePositioning() {
|
public boolean isUpdatePositioning() {
|
||||||
return updatePositioning;
|
return updatePositioning;
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,6 @@ public class MainPage extends Page implements OnDifferentSongListener {
|
|||||||
addActor(titleBar);
|
addActor(titleBar);
|
||||||
|
|
||||||
titleBar.getHvisual().setMM(sc.getCurrentSong());
|
titleBar.getHvisual().setMM(sc.getCurrentSong());
|
||||||
|
|
||||||
sc.addOnDifferentSongListener(this);
|
sc.addOnDifferentSongListener(this);
|
||||||
|
|
||||||
versionLabel = new Label("Version: " + RhythmBullet.VERSION, core.getDefaultSkin(), "sub-font",
|
versionLabel = new Label("Version: " + RhythmBullet.VERSION, core.getDefaultSkin(), "sub-font",
|
||||||
|
@ -11,12 +11,13 @@ import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane;
|
|||||||
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
|
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
|
||||||
|
|
||||||
import zero1hd.rhythmbullet.graphics.ui.components.GraphicsOptions;
|
import zero1hd.rhythmbullet.graphics.ui.components.GraphicsOptions;
|
||||||
|
import zero1hd.rhythmbullet.screens.MainMenu;
|
||||||
|
|
||||||
public class VideoOptionsPage extends Page {
|
public class VideoOptionsPage extends Page {
|
||||||
private ScrollPane scrollPane;
|
private ScrollPane scrollPane;
|
||||||
private GraphicsOptions graphicsTable;
|
private GraphicsOptions graphicsTable;
|
||||||
public VideoOptionsPage(Skin skin, Preferences prefs) {
|
public VideoOptionsPage(Skin skin, Preferences prefs, MainMenu menu) {
|
||||||
graphicsTable = new GraphicsOptions(skin, prefs);
|
graphicsTable = new GraphicsOptions(menu, skin, prefs);
|
||||||
scrollPane = new ScrollPane(graphicsTable, skin);
|
scrollPane = new ScrollPane(graphicsTable, skin);
|
||||||
scrollPane.setFadeScrollBars(false);
|
scrollPane.setFadeScrollBars(false);
|
||||||
scrollPane.setFillParent(true);
|
scrollPane.setFillParent(true);
|
||||||
|
@ -54,7 +54,7 @@ public class MainMenu extends ScreenAdapter implements TransitionAdapter {
|
|||||||
private Batch batch;
|
private Batch batch;
|
||||||
private ScreenViewport screenViewport;
|
private ScreenViewport screenViewport;
|
||||||
|
|
||||||
public MainMenu(final RhythmBullet core) {
|
public MainMenu(RhythmBullet core) {
|
||||||
this.core = core;
|
this.core = core;
|
||||||
stage = new Stage(new ScreenViewport());
|
stage = new Stage(new ScreenViewport());
|
||||||
targetPosition = new Vector3(stage.getCamera().position);
|
targetPosition = new Vector3(stage.getCamera().position);
|
||||||
@ -83,7 +83,7 @@ public class MainMenu extends ScreenAdapter implements TransitionAdapter {
|
|||||||
keybindPage.setPosition(1f*Gdx.graphics.getWidth(), -1f*Gdx.graphics.getHeight());
|
keybindPage.setPosition(1f*Gdx.graphics.getWidth(), -1f*Gdx.graphics.getHeight());
|
||||||
stage.addActor(keybindPage);
|
stage.addActor(keybindPage);
|
||||||
|
|
||||||
graphicsPage = new VideoOptionsPage(core.getDefaultSkin(), core.getPrefs());
|
graphicsPage = new VideoOptionsPage(core.getDefaultSkin(), core.getPrefs(), this);
|
||||||
|
|
||||||
graphicsPage.setPosition(1f*Gdx.graphics.getWidth(), 1f*Gdx.graphics.getHeight());
|
graphicsPage.setPosition(1f*Gdx.graphics.getWidth(), 1f*Gdx.graphics.getHeight());
|
||||||
stage.addActor(graphicsPage);
|
stage.addActor(graphicsPage);
|
||||||
@ -197,10 +197,10 @@ public class MainMenu extends ScreenAdapter implements TransitionAdapter {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(float delta) {
|
public void render(float delta) {
|
||||||
Gdx.gl.glClearColor(0.32f, 0f, 0f, 1f);
|
Gdx.gl.glClearColor(0.22f, 0f, 0f, 1f);
|
||||||
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
|
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
|
||||||
stage.act(delta);
|
stage.act(delta);
|
||||||
if (gaussianBlurShader != null) {
|
if (blurlvl > 0) {
|
||||||
//Begin drawing a normal version of screen
|
//Begin drawing a normal version of screen
|
||||||
normalBuffer.begin();
|
normalBuffer.begin();
|
||||||
stage.getViewport().apply();
|
stage.getViewport().apply();
|
||||||
@ -309,6 +309,7 @@ public class MainMenu extends ScreenAdapter implements TransitionAdapter {
|
|||||||
@Override
|
@Override
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
stage.dispose();
|
stage.dispose();
|
||||||
|
unloadShaders();
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -319,4 +320,28 @@ public class MainMenu extends ScreenAdapter implements TransitionAdapter {
|
|||||||
lerpAlpha = 0.15f;
|
lerpAlpha = 0.15f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void unloadShaders() {
|
||||||
|
brightFilterShader.dispose();
|
||||||
|
combineShader.dispose();
|
||||||
|
gaussianBlurShader.dispose();
|
||||||
|
normalBuffer.dispose();
|
||||||
|
lightFilterBuffer.dispose();
|
||||||
|
vBlur.dispose();
|
||||||
|
hBlur.dispose();
|
||||||
|
|
||||||
|
brightFilterShader = null;
|
||||||
|
combineShader = null;
|
||||||
|
gaussianBlurShader = null;
|
||||||
|
normalBuffer = null;
|
||||||
|
lightFilterBuffer = null;
|
||||||
|
vBlur = null;
|
||||||
|
hBlur = null;
|
||||||
|
|
||||||
|
setBlurlvl(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBlurlvl(int blurlvl) {
|
||||||
|
this.blurlvl = blurlvl;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user