shader progress
This commit is contained in:
parent
d0cf02e19a
commit
d036900399
@ -240,6 +240,10 @@ public class Polyjet extends Game {
|
||||
CheckBoxStyle defaultCheckBox = new CheckBoxStyle(getDefaultSkin().getDrawable("check-off"), getDefaultSkin().getDrawable("check-on"), getDefaultSkin().getFont("window-font"), getDefaultSkin().getColor("default"));
|
||||
getDefaultSkin().add("default", defaultCheckBox);
|
||||
|
||||
CheckBoxStyle expandableCheckBox = new CheckBoxStyle(defaultCheckBox);
|
||||
expandableCheckBox.font = getDefaultSkin().getFont("sub-font");
|
||||
getDefaultSkin().add("expandable", expandableCheckBox);
|
||||
|
||||
SelectBoxStyle defaultSelectBox = new SelectBoxStyle(getDefaultSkin().getFont("default-font"), getDefaultSkin().getColor("default"), getDefaultSkin().getDrawable("default-select"), defaultScrollPane, defaultList);
|
||||
getDefaultSkin().add("default", defaultSelectBox);
|
||||
|
||||
|
@ -99,6 +99,7 @@ public class MainMenu extends ScreenAdapter implements TransitionAdapter {
|
||||
public void hide() {
|
||||
if (optionsPage != null) {
|
||||
optionsPage.saveOptions(core.getPrefs());
|
||||
moreOptionsPage.getGraphicsSettings().save(core.getPrefs());
|
||||
}
|
||||
super.hide();
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package zero1hd.polyjet.ui.builders;
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.Preferences;
|
||||
import com.badlogic.gdx.scenes.scene2d.Actor;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.CheckBox;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Label;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Table;
|
||||
@ -11,7 +12,9 @@ import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
|
||||
import com.badlogic.gdx.utils.Align;
|
||||
|
||||
public class GraphicsTable extends Table {
|
||||
private Label title;
|
||||
private Label resolutions, shaders;
|
||||
|
||||
private CheckBox glowShader, bgShader, invertShader;
|
||||
|
||||
private SetResolutionButton
|
||||
_3840x2160,
|
||||
@ -28,8 +31,27 @@ public class GraphicsTable extends Table {
|
||||
align(Align.center);
|
||||
defaults().space(10f);
|
||||
|
||||
title = new Label("Optimized Resolutions", skin);
|
||||
add(title).left();
|
||||
shaders = new Label("OpenGL Shaders", skin);
|
||||
add(shaders).fillX();
|
||||
row();
|
||||
|
||||
invertShader = new CheckBox(" Invert Shader", skin, "expandable");
|
||||
invertShader.setChecked(pref.getBoolean("invert_shader", false));
|
||||
add(invertShader).minHeight(shaders.getHeight());
|
||||
row();
|
||||
|
||||
glowShader = new CheckBox(" Glow Shader", skin, "expandable");
|
||||
glowShader.setChecked(pref.getBoolean("glow_shader", true));
|
||||
add(glowShader).minHeight(shaders.getHeight());
|
||||
row();
|
||||
|
||||
bgShader = new CheckBox(" Background Shader", skin, "expandable");
|
||||
bgShader.setChecked(pref.getBoolean("bg_shader", true));
|
||||
add(bgShader).minHeight(shaders.getHeight());
|
||||
row();
|
||||
|
||||
resolutions = new Label("Optimized Resolutions", skin);
|
||||
add(resolutions).left();
|
||||
row();
|
||||
|
||||
|
||||
@ -80,4 +102,11 @@ public class GraphicsTable extends Table {
|
||||
add(_800x480).fillX();
|
||||
row();
|
||||
}
|
||||
|
||||
public void save(Preferences prefs) {
|
||||
prefs.putBoolean("bg_shader", bgShader.isChecked());
|
||||
prefs.putBoolean("glow_shader", glowShader.isChecked());
|
||||
prefs.putBoolean("invert_shader", invertShader.isChecked());
|
||||
prefs.flush();
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
package zero1hd.polyjet.ui.pages;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.graphics.Texture;
|
||||
import com.badlogic.gdx.math.Vector3;
|
||||
import com.badlogic.gdx.scenes.scene2d.Actor;
|
||||
|
@ -67,4 +67,8 @@ public class MoreOptionsPage extends Page {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public GraphicsTable getGraphicsSettings() {
|
||||
return graphicsSettings;
|
||||
}
|
||||
}
|
||||
|
@ -3,8 +3,10 @@ package zero1hd.polyjet.ui.stages;
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.Preferences;
|
||||
import com.badlogic.gdx.assets.AssetManager;
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.graphics.glutils.ShaderProgram;
|
||||
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
|
||||
import com.badlogic.gdx.graphics.glutils.ShapeRenderer.ShapeType;
|
||||
import com.badlogic.gdx.scenes.scene2d.Stage;
|
||||
import com.badlogic.gdx.utils.viewport.FitViewport;
|
||||
|
||||
@ -30,7 +32,9 @@ public class GamePlayArea extends Stage {
|
||||
private int score;
|
||||
|
||||
private ShaderProgram invert;
|
||||
private ShaderProgram bgShader;
|
||||
|
||||
private ShapeRenderer bg;
|
||||
public GamePlayArea(AssetManager assetManager, Preferences prefs) {
|
||||
super(new FitViewport(Polyjet.GAME_AREA_WIDTH, Polyjet.GAME_AREA_HEIGHT));
|
||||
|
||||
@ -45,13 +49,33 @@ public class GamePlayArea extends Stage {
|
||||
System.err.println(invert.getLog());
|
||||
System.exit(0);
|
||||
}
|
||||
if (invert.getLog().length()!=0)
|
||||
if (invert.getLog().length()!=0) {
|
||||
System.out.println(invert.getLog());
|
||||
|
||||
}
|
||||
getBatch().setShader(invert);
|
||||
|
||||
}
|
||||
|
||||
if (prefs.getBoolean("bg_shader")) {
|
||||
bgShader = new ShaderProgram(Gdx.files.internal("shaders/invert_vert.glsl").readString(), Gdx.files.internal("shaders/star_frag.glsl").readString());
|
||||
if (!invert.isCompiled()) {
|
||||
System.err.println(invert.getLog());
|
||||
System.exit(0);
|
||||
}
|
||||
if (invert.getLog().length()!=0) {
|
||||
System.out.println(invert.getLog());
|
||||
}
|
||||
|
||||
bg = new ShapeRenderer(8, bgShader);
|
||||
bg.setColor(Color.BLACK);
|
||||
} else {
|
||||
bg = new ShapeRenderer();
|
||||
bg.setTransformMatrix(getCamera().combined);
|
||||
bg.setColor(Color.WHITE);
|
||||
}
|
||||
|
||||
ShaderProgram.pedantic = false;
|
||||
|
||||
shapes = new ShapeRenderer(64, getBatch().getShader());
|
||||
shapes.setProjectionMatrix(getCamera().combined);
|
||||
ec = new EntityController(assetManager, shapes);
|
||||
@ -59,6 +83,14 @@ public class GamePlayArea extends Stage {
|
||||
ec.activeAllies.add(polyjet);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw() {
|
||||
bg.begin(ShapeType.Filled);
|
||||
bg.rect(0, 0, Polyjet.GAME_AREA_WIDTH, Polyjet.GAME_AREA_HEIGHT);
|
||||
bg.end();
|
||||
super.draw();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void act(float delta) {
|
||||
collisionDetector.collisionCheck();
|
||||
|
@ -20,7 +20,7 @@ public class BeatViewer extends Window {
|
||||
private AudioAnalyzer data;
|
||||
|
||||
public BeatViewer(String title, Skin skin) {
|
||||
super(title, skin);
|
||||
super(title, skin, "tinted");
|
||||
defaults().space(5f);
|
||||
setSize(64, 100);
|
||||
|
||||
|
@ -8,7 +8,7 @@ import com.badlogic.gdx.scenes.scene2d.ui.Window;
|
||||
public class FPSWindow extends Window {
|
||||
|
||||
public FPSWindow(String title, Skin skin) {
|
||||
super(title, skin);
|
||||
super(title, skin, "tinted");
|
||||
Label FPS = new Label("FPS: ", skin, "window-font", skin.getColor("default")) {
|
||||
@Override
|
||||
public void act(float delta) {
|
||||
|
@ -12,7 +12,7 @@ public class GraphWindow extends Window {
|
||||
AudioData audioData;
|
||||
|
||||
public GraphWindow(String title, Skin skin) {
|
||||
super(title, skin);
|
||||
super(title, skin, "tinted");
|
||||
graph = new AudioGraph(300, 150);
|
||||
add(graph);
|
||||
setSize(305, 155);
|
||||
|
@ -16,7 +16,7 @@ public class LoadingWindow extends Window implements Disposable {
|
||||
private Sound openSound;
|
||||
private float vol;
|
||||
public LoadingWindow(Skin skin, boolean progress, AssetManager assets, float vol) {
|
||||
super("loading...", skin);
|
||||
super("loading...", skin, "tinted");
|
||||
|
||||
this.openSound = assets.get("pop_open.ogg", Sound.class);
|
||||
this.closeSound = assets.get("pop_close.ogg", Sound.class);
|
||||
|
@ -22,7 +22,7 @@ public class MusicController extends Window {
|
||||
private AudioData audiofile;
|
||||
|
||||
public MusicController(final Skin skin) {
|
||||
super("Playback Controller", skin);
|
||||
super("Playback Controller", skin, "tinted");
|
||||
|
||||
defaults().space(5f);
|
||||
|
||||
|
@ -27,7 +27,7 @@ public class MusicSelector extends Window {
|
||||
public MiniSender miniSender;
|
||||
|
||||
public MusicSelector(String title, Skin skin, final String path, String listStyle) {
|
||||
super(title, skin);
|
||||
super(title, skin, "tinted");
|
||||
this.path = path;
|
||||
padTop(25f);
|
||||
padLeft(5f);
|
||||
|
@ -11,7 +11,7 @@ public class NoticeWindow extends Window {
|
||||
private Label noticeText;
|
||||
private Skin skin;
|
||||
public NoticeWindow(Skin skin, String styleName, String text) {
|
||||
super("Notice", skin);
|
||||
super("Notice", skin, "tinted");
|
||||
this.skin = skin;
|
||||
|
||||
noticeText = new Label(text, skin, "sub-font", skin.getColor("default"));
|
||||
|
@ -8,7 +8,7 @@ import com.badlogic.gdx.scenes.scene2d.ui.Window;
|
||||
public class Spawnables extends Window {
|
||||
|
||||
public Spawnables(String title, Skin skin) {
|
||||
super(title, skin);
|
||||
super(title, skin, "tinted");
|
||||
|
||||
Table spawnButtons = new Table(skin);
|
||||
|
||||
|
@ -33,7 +33,7 @@ public class SpawnerWindow extends Window {
|
||||
private Slider mod4;
|
||||
|
||||
public SpawnerWindow(String title, Skin skin, EntityController ec, Stage stageForEntities) {
|
||||
super(title, skin);
|
||||
super(title, skin, "tinted");
|
||||
this.ec = ec;
|
||||
stage = stageForEntities;
|
||||
|
||||
|
@ -19,7 +19,7 @@ public class VolumeWindow extends Window {
|
||||
|
||||
private AudioData music;
|
||||
public VolumeWindow(String title, Skin skin, Preferences prefs) {
|
||||
super(title, skin);
|
||||
super(title, skin, "tinted");
|
||||
this.prefs = prefs;
|
||||
setSize(360f, 100f);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user