added enhanced glow option
This commit is contained in:
parent
6595c0fdb1
commit
36e121fef0
@ -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.Table;
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
|
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.scenes.scene2d.utils.ChangeListener.ChangeEvent;
|
|
||||||
import com.badlogic.gdx.utils.Align;
|
import com.badlogic.gdx.utils.Align;
|
||||||
|
|
||||||
public class GraphicsOptions extends Table {
|
public class GraphicsOptions extends Table {
|
||||||
private Label resolutions, shaders;
|
private Label resolutions, shaders;
|
||||||
private Preferences prefs;
|
private Preferences prefs;
|
||||||
private CheckBox glowShader;
|
private CheckBox glowShader, enhancedGlow;
|
||||||
|
|
||||||
private ResolutionButton
|
private ResolutionButton
|
||||||
_3840x2160,
|
_3840x2160,
|
||||||
@ -52,6 +51,22 @@ public class GraphicsOptions extends Table {
|
|||||||
add(glowShader).minHeight(shaders.getHeight());
|
add(glowShader).minHeight(shaders.getHeight());
|
||||||
row();
|
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);
|
resolutions = new Label("Resolutions: ", skin);
|
||||||
add(resolutions).left();
|
add(resolutions).left();
|
||||||
row();
|
row();
|
||||||
@ -109,5 +124,6 @@ public class GraphicsOptions extends Table {
|
|||||||
public void save() {
|
public void save() {
|
||||||
Gdx.app.debug("Preferences", "Saved shading values values.");
|
Gdx.app.debug("Preferences", "Saved shading values values.");
|
||||||
prefs.putBoolean("glow shader", glowShader.isChecked());
|
prefs.putBoolean("glow shader", glowShader.isChecked());
|
||||||
|
prefs.putBoolean("enhanced glow", enhancedGlow.isChecked());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,7 @@ public class MainMenu extends ScreenAdapter implements TransitionAdapter {
|
|||||||
private FrameBuffer hBlur, vBlur;
|
private FrameBuffer hBlur, vBlur;
|
||||||
private TextureRegion fboRegion;
|
private TextureRegion fboRegion;
|
||||||
private int fboSize;
|
private int fboSize;
|
||||||
private int blurlvl = 2;
|
private int blurlvl;
|
||||||
private Batch batch;
|
private Batch batch;
|
||||||
private ScreenViewport screenViewport;
|
private ScreenViewport screenViewport;
|
||||||
|
|
||||||
@ -127,6 +127,12 @@ public class MainMenu extends ScreenAdapter implements TransitionAdapter {
|
|||||||
}
|
}
|
||||||
public void loadShaders() {
|
public void loadShaders() {
|
||||||
if (core.getPrefs().getBoolean("glow shader")) {
|
if (core.getPrefs().getBoolean("glow shader")) {
|
||||||
|
if (core.getPrefs().getBoolean("enhanced glow", false)) {
|
||||||
|
blurlvl = 6;
|
||||||
|
} else {
|
||||||
|
blurlvl = 1;
|
||||||
|
}
|
||||||
|
|
||||||
batch = new SpriteBatch();
|
batch = new SpriteBatch();
|
||||||
screenViewport = new ScreenViewport();
|
screenViewport = new ScreenViewport();
|
||||||
screenViewport.update(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
|
screenViewport.update(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
|
||||||
@ -191,10 +197,9 @@ public class MainMenu extends ScreenAdapter implements TransitionAdapter {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(float delta) {
|
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);
|
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
|
||||||
stage.act(delta);
|
stage.act(delta);
|
||||||
blurlvl = 5;
|
|
||||||
if (gaussianBlurShader != null) {
|
if (gaussianBlurShader != null) {
|
||||||
//Begin drawing a normal version of screen
|
//Begin drawing a normal version of screen
|
||||||
normalBuffer.begin();
|
normalBuffer.begin();
|
||||||
|
Loading…
Reference in New Issue
Block a user