From 36e121fef01c028c681d645683744bce62b842ba Mon Sep 17 00:00:00 2001 From: Recrown Date: Fri, 13 Oct 2017 10:58:27 -0500 Subject: [PATCH] added enhanced glow option --- .../ui/components/GraphicsOptions.java | 20 +++++++++++++++++-- .../rhythmbullet/screens/MainMenu.java | 11 +++++++--- 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/core/src/zero1hd/rhythmbullet/graphics/ui/components/GraphicsOptions.java b/core/src/zero1hd/rhythmbullet/graphics/ui/components/GraphicsOptions.java index 1ce36cd..cec90c6 100755 --- a/core/src/zero1hd/rhythmbullet/graphics/ui/components/GraphicsOptions.java +++ b/core/src/zero1hd/rhythmbullet/graphics/ui/components/GraphicsOptions.java @@ -9,13 +9,12 @@ import com.badlogic.gdx.scenes.scene2d.ui.Skin; import com.badlogic.gdx.scenes.scene2d.ui.Table; import com.badlogic.gdx.scenes.scene2d.ui.TextButton; import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener; -import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener.ChangeEvent; import com.badlogic.gdx.utils.Align; public class GraphicsOptions extends Table { private Label resolutions, shaders; private Preferences prefs; - private CheckBox glowShader; + private CheckBox glowShader, enhancedGlow; private ResolutionButton _3840x2160, @@ -52,6 +51,22 @@ public class GraphicsOptions extends Table { add(glowShader).minHeight(shaders.getHeight()); row(); + enhancedGlow = new CheckBox(" Enhanced Glow", skin); + enhancedGlow.setChecked(prefs.getBoolean("enhanced glow", false)); + enhancedGlow.addListener(new ChangeListener() { + @Override + public void changed(ChangeEvent event, Actor actor) { + save(); + if (prefs.getBoolean("fullscreen")) { + Gdx.graphics.setFullscreenMode(Gdx.graphics.getDisplayMode()); + } else { + Gdx.graphics.setWindowedMode(prefs.getInteger("screen-width"), prefs.getInteger("screen-height")); + } + } + }); + add(enhancedGlow).minHeight(shaders.getHeight()); + row(); + resolutions = new Label("Resolutions: ", skin); add(resolutions).left(); row(); @@ -109,5 +124,6 @@ public class GraphicsOptions extends Table { public void save() { Gdx.app.debug("Preferences", "Saved shading values values."); prefs.putBoolean("glow shader", glowShader.isChecked()); + prefs.putBoolean("enhanced glow", enhancedGlow.isChecked()); } } diff --git a/core/src/zero1hd/rhythmbullet/screens/MainMenu.java b/core/src/zero1hd/rhythmbullet/screens/MainMenu.java index 8101299..262a03d 100755 --- a/core/src/zero1hd/rhythmbullet/screens/MainMenu.java +++ b/core/src/zero1hd/rhythmbullet/screens/MainMenu.java @@ -50,7 +50,7 @@ public class MainMenu extends ScreenAdapter implements TransitionAdapter { private FrameBuffer hBlur, vBlur; private TextureRegion fboRegion; private int fboSize; - private int blurlvl = 2; + private int blurlvl; private Batch batch; private ScreenViewport screenViewport; @@ -127,6 +127,12 @@ public class MainMenu extends ScreenAdapter implements TransitionAdapter { } public void loadShaders() { if (core.getPrefs().getBoolean("glow shader")) { + if (core.getPrefs().getBoolean("enhanced glow", false)) { + blurlvl = 6; + } else { + blurlvl = 1; + } + batch = new SpriteBatch(); screenViewport = new ScreenViewport(); screenViewport.update(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); @@ -191,10 +197,9 @@ public class MainMenu extends ScreenAdapter implements TransitionAdapter { @Override public void render(float delta) { - Gdx.gl.glClearColor(0.1f, 0.1f, 0f, 1f); + Gdx.gl.glClearColor(0.32f, 0f, 0f, 1f); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); stage.act(delta); - blurlvl = 5; if (gaussianBlurShader != null) { //Begin drawing a normal version of screen normalBuffer.begin();