working on scissorstack issue, before breaking everything
This commit is contained in:
parent
29e4b7e901
commit
9da3670d04
@ -20,7 +20,6 @@ import com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator;
|
||||
import com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator.FreeTypeFontParameter;
|
||||
import com.badlogic.gdx.math.MathUtils;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.CheckBox.CheckBoxStyle;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.ImageButton.ImageButtonStyle;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Label.LabelStyle;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.List.ListStyle;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane.ScrollPaneStyle;
|
||||
|
@ -3,11 +3,10 @@ package zero1hd.rhythmbullet.controls;
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.Input.Keys;
|
||||
import com.badlogic.gdx.Preferences;
|
||||
import com.badlogic.gdx.assets.AssetManager;
|
||||
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
|
||||
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
||||
|
||||
import zero1hd.rhythmbullet.RhythmBullet;
|
||||
|
||||
public class KeyMap {
|
||||
TextureAtlas keyTextures;
|
||||
private Preferences keyBindPrefs;
|
||||
@ -61,8 +60,8 @@ public class KeyMap {
|
||||
public static int accelerate;
|
||||
|
||||
|
||||
public KeyMap(RhythmBullet core) {
|
||||
keyTextures = core.getAssetManager().get("keyboard.atlas", TextureAtlas.class);
|
||||
public KeyMap(AssetManager assets) {
|
||||
keyTextures = assets.get("keyboard.atlas", TextureAtlas.class);
|
||||
|
||||
setKeys(Gdx.app.getPreferences("PolyJet_Controls"));
|
||||
updateKeys();
|
||||
|
@ -7,6 +7,7 @@ import com.badlogic.gdx.scenes.scene2d.ui.Label;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Table;
|
||||
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
|
||||
import com.badlogic.gdx.utils.Align;
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
|
||||
import zero1hd.rhythmbullet.controls.KeyMap;
|
||||
@ -14,6 +15,7 @@ import zero1hd.rhythmbullet.controls.KeyMap;
|
||||
public class ControlOptions extends Table {
|
||||
public ControlOptions(Skin skin, KeyMap keyMap) {
|
||||
super(skin);
|
||||
align(Align.center);
|
||||
|
||||
//first
|
||||
Label forwardKeyLabel = new Label("Forward: ",skin);
|
||||
@ -76,6 +78,8 @@ public class ControlOptions extends Table {
|
||||
super.clicked(event, x, y);
|
||||
}
|
||||
});
|
||||
|
||||
setFillParent(true);
|
||||
}
|
||||
|
||||
public void unselect() {
|
||||
|
@ -9,11 +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 ResolutionButton
|
||||
@ -27,16 +28,27 @@ public class GraphicsOptions extends Table {
|
||||
_800x480;
|
||||
|
||||
|
||||
public GraphicsOptions(Skin skin, final Preferences pref) {
|
||||
public GraphicsOptions(Skin skin, final Preferences prefs) {
|
||||
align(Align.center);
|
||||
defaults().space(10f);
|
||||
|
||||
this.prefs = prefs;
|
||||
shaders = new Label("OpenGL Shaders", skin);
|
||||
add(shaders).fillX();
|
||||
row();
|
||||
|
||||
glowShader = new CheckBox(" Glow Shader", skin, "expandable");
|
||||
glowShader.setChecked(pref.getBoolean("glow shader", true));
|
||||
glowShader.setChecked(prefs.getBoolean("glow shader", true));
|
||||
glowShader.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(glowShader).minHeight(shaders.getHeight());
|
||||
row();
|
||||
|
||||
@ -52,50 +64,50 @@ public class GraphicsOptions extends Table {
|
||||
public void changed(ChangeEvent event, Actor actor) {
|
||||
if (!Gdx.graphics.isFullscreen()) {
|
||||
Gdx.graphics.setFullscreenMode(Gdx.graphics.getDisplayMode());
|
||||
pref.putBoolean("fullscreen", true);
|
||||
pref.flush();
|
||||
prefs.putBoolean("fullscreen", true);
|
||||
prefs.flush();
|
||||
}
|
||||
}
|
||||
});
|
||||
add(fullscreen).fillX();
|
||||
row();
|
||||
|
||||
_3840x2160 = new ResolutionButton(3840, 2160, skin, pref);
|
||||
_3840x2160 = new ResolutionButton(3840, 2160, skin, prefs);
|
||||
add(_3840x2160).fillX();
|
||||
row();
|
||||
|
||||
_2560x1440 = new ResolutionButton(2560, 1440, skin, pref);
|
||||
_2560x1440 = new ResolutionButton(2560, 1440, skin, prefs);
|
||||
add(_2560x1440).fillX();
|
||||
row();
|
||||
|
||||
_1920x1200 = new ResolutionButton(1920, 1200, skin, pref);
|
||||
_1920x1200 = new ResolutionButton(1920, 1200, skin, prefs);
|
||||
add(_1920x1200).fillX();
|
||||
row();
|
||||
|
||||
_1920x1080 = new ResolutionButton(1920, 1080, skin, pref);
|
||||
_1920x1080 = new ResolutionButton(1920, 1080, skin, prefs);
|
||||
add(_1920x1080).fillX();
|
||||
row();
|
||||
|
||||
_1280x800 = new ResolutionButton(1280, 800, skin, pref);
|
||||
_1280x800 = new ResolutionButton(1280, 800, skin, prefs);
|
||||
add(_1280x800).fillX();
|
||||
row();
|
||||
|
||||
_1280x720 = new ResolutionButton(1280, 720, skin, pref);
|
||||
_1280x720 = new ResolutionButton(1280, 720, skin, prefs);
|
||||
add(_1280x720).fillX();
|
||||
row();
|
||||
|
||||
_1366x768 = new ResolutionButton(1366, 768, skin, pref);
|
||||
_1366x768 = new ResolutionButton(1366, 768, skin, prefs);
|
||||
add(_1366x768).fillX();
|
||||
row();
|
||||
|
||||
_800x480 = new ResolutionButton(800, 480, skin, pref);
|
||||
_800x480 = new ResolutionButton(800, 480, skin, prefs);
|
||||
add(_800x480).fillX();
|
||||
row();
|
||||
pack();
|
||||
}
|
||||
|
||||
public void save(Preferences prefs) {
|
||||
public void save() {
|
||||
Gdx.app.debug("Preferences", "Saved shading values values.");
|
||||
|
||||
prefs.putBoolean("glow shader", glowShader.isChecked());
|
||||
}
|
||||
}
|
||||
|
23
core/src/zero1hd/rhythmbullet/graphics/ui/pages/KeybindOptionsPage.java
Executable file
23
core/src/zero1hd/rhythmbullet/graphics/ui/pages/KeybindOptionsPage.java
Executable file
@ -0,0 +1,23 @@
|
||||
package zero1hd.rhythmbullet.graphics.ui.pages;
|
||||
|
||||
import com.badlogic.gdx.assets.AssetManager;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
|
||||
|
||||
import zero1hd.rhythmbullet.controls.KeyMap;
|
||||
import zero1hd.rhythmbullet.graphics.ui.components.ControlOptions;
|
||||
|
||||
public class KeybindOptionsPage extends Page {
|
||||
private ControlOptions controlTable;
|
||||
private KeyMap keyMap;
|
||||
|
||||
public KeybindOptionsPage(Skin skin, AssetManager assets) {
|
||||
keyMap = new KeyMap(assets);
|
||||
controlTable = new ControlOptions(skin, keyMap);
|
||||
|
||||
addActor(controlTable);
|
||||
}
|
||||
|
||||
public void unselect() {
|
||||
controlTable.unselect();
|
||||
}
|
||||
}
|
@ -4,14 +4,10 @@ import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.graphics.g2d.Batch;
|
||||
import com.badlogic.gdx.math.Vector3;
|
||||
import com.badlogic.gdx.scenes.scene2d.Actor;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.ImageButton;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Label;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Table;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.ImageButton.ImageButtonStyle;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.TextButton.TextButtonStyle;
|
||||
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
|
||||
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener.ChangeEvent;
|
||||
import com.badlogic.gdx.utils.Align;
|
||||
|
||||
import zero1hd.rhythmbullet.RhythmBullet;
|
||||
|
@ -1,74 +0,0 @@
|
||||
package zero1hd.rhythmbullet.graphics.ui.pages;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.math.Vector3;
|
||||
import com.badlogic.gdx.scenes.scene2d.Actor;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
|
||||
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
|
||||
|
||||
import zero1hd.rhythmbullet.RhythmBullet;
|
||||
import zero1hd.rhythmbullet.controls.KeyMap;
|
||||
import zero1hd.rhythmbullet.graphics.ui.components.GraphicsOptions;
|
||||
import zero1hd.rhythmbullet.graphics.ui.components.ControlOptions;
|
||||
|
||||
public class MoreOptionsPage extends Page {
|
||||
private KeyMap keymap;
|
||||
private ScrollPane controlsScroller;
|
||||
private ControlOptions controlSetter;
|
||||
|
||||
private ScrollPane graphicsScroller;
|
||||
private GraphicsOptions graphicsSettings;
|
||||
|
||||
|
||||
public MoreOptionsPage(RhythmBullet core, final Vector3 targetLocation) {
|
||||
keymap = new KeyMap(core);
|
||||
|
||||
TextButton backArrow = new TextButton("Back", core.getDefaultSkin());
|
||||
backArrow.setPosition(15, getHeight()-backArrow.getHeight()-10);
|
||||
backArrow.addListener(new ChangeListener() {
|
||||
@Override
|
||||
public void changed(ChangeEvent event, Actor actor) {
|
||||
targetLocation.y = 0.5f*Gdx.graphics.getHeight();
|
||||
}
|
||||
});
|
||||
addActor(backArrow);
|
||||
|
||||
controlSetter = new ControlOptions(core.getDefaultSkin(), keymap);
|
||||
controlsScroller = new ScrollPane(controlSetter, core.getDefaultSkin());
|
||||
controlsScroller.setFadeScrollBars(false);
|
||||
controlsScroller.setSize(getWidth()-backArrow.getWidth()-backArrow.getX()-10, getHeight());
|
||||
controlsScroller.setX(backArrow.getWidth()+10+backArrow.getX());
|
||||
addActor(controlsScroller);
|
||||
controlsScroller.setVisible(false);
|
||||
|
||||
graphicsSettings = new GraphicsOptions(core.getDefaultSkin(), core.getPrefs());
|
||||
graphicsScroller = new ScrollPane(graphicsSettings, core.getDefaultSkin());
|
||||
graphicsScroller.setFadeScrollBars(false);
|
||||
graphicsScroller.setSize(getWidth()-backArrow.getWidth()-backArrow.getX()-10, getHeight());
|
||||
graphicsScroller.setX(backArrow.getWidth()+10+backArrow.getX());
|
||||
addActor(graphicsScroller);
|
||||
graphicsScroller.setVisible(false);
|
||||
}
|
||||
|
||||
public void controlUnselect() {
|
||||
controlSetter.unselect();
|
||||
}
|
||||
|
||||
public void setControlType(byte type) {
|
||||
switch (type) {
|
||||
case 0:
|
||||
controlsScroller.setVisible(true);
|
||||
graphicsScroller.setVisible(false);
|
||||
break;
|
||||
case 1:
|
||||
controlsScroller.setVisible(false);
|
||||
graphicsScroller.setVisible(true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public GraphicsOptions getGraphicsSettings() {
|
||||
return graphicsSettings;
|
||||
}
|
||||
}
|
@ -28,7 +28,7 @@ public class OptionsPage extends Page {
|
||||
private ProgressBar fxVolSlider;
|
||||
private TextField directoryField;
|
||||
|
||||
public OptionsPage(RhythmBullet core, Vector3 targetPosition, MoreOptionsPage moreOptionsPage, SongListController sc) {
|
||||
public OptionsPage(RhythmBullet core, Vector3 targetPosition, KeybindOptionsPage moreOptionsPage, SongListController sc) {
|
||||
super("General", core.getDefaultSkin());
|
||||
|
||||
//Back button
|
||||
@ -101,14 +101,12 @@ public class OptionsPage extends Page {
|
||||
|
||||
optionsTable.top();
|
||||
|
||||
|
||||
optionsTable.row();
|
||||
|
||||
TextButton keybindSettings = new TextButton("Set Controls", core.getDefaultSkin());
|
||||
keybindSettings.addListener(new ChangeListener() {
|
||||
@Override
|
||||
public void changed(ChangeEvent event, Actor actor) {
|
||||
moreOptionsPage.setControlType((byte) 0);
|
||||
targetPosition.y = -0.5f*Gdx.graphics.getHeight();
|
||||
}
|
||||
});
|
||||
@ -120,8 +118,7 @@ public class OptionsPage extends Page {
|
||||
graphicsSettings.addListener(new ChangeListener() {
|
||||
@Override
|
||||
public void changed(ChangeEvent event, Actor actor) {
|
||||
moreOptionsPage.setControlType((byte) 1);
|
||||
targetPosition.y = -0.5f*Gdx.graphics.getHeight();
|
||||
targetPosition.y = 1.5f*Gdx.graphics.getHeight();
|
||||
}
|
||||
});
|
||||
optionsTable.add(graphicsSettings).colspan(2).fillX();
|
||||
|
46
core/src/zero1hd/rhythmbullet/graphics/ui/pages/VideoOptionsPage.java
Executable file
46
core/src/zero1hd/rhythmbullet/graphics/ui/pages/VideoOptionsPage.java
Executable file
@ -0,0 +1,46 @@
|
||||
package zero1hd.rhythmbullet.graphics.ui.pages;
|
||||
|
||||
import com.badlogic.gdx.Preferences;
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.graphics.Pixmap;
|
||||
import com.badlogic.gdx.graphics.Pixmap.Format;
|
||||
import com.badlogic.gdx.graphics.Texture;
|
||||
import com.badlogic.gdx.graphics.g2d.Batch;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Image;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
|
||||
|
||||
import zero1hd.rhythmbullet.graphics.ui.components.GraphicsOptions;
|
||||
|
||||
public class VideoOptionsPage extends Page {
|
||||
private ScrollPane scrollPane;
|
||||
private GraphicsOptions graphicsTable;
|
||||
public VideoOptionsPage(Skin skin, Preferences prefs) {
|
||||
graphicsTable = new GraphicsOptions(skin, prefs);
|
||||
graphicsTable.clear();
|
||||
Pixmap pix = new Pixmap(4, 4, Format.RGBA8888);
|
||||
pix.setColor(Color.WHITE);
|
||||
pix.fill();
|
||||
Texture texture = new Texture(pix);
|
||||
Image image = new Image(texture);
|
||||
graphicsTable.add(image).minHeight(4000).minWidth(2000);
|
||||
scrollPane = new ScrollPane(graphicsTable, skin);
|
||||
scrollPane.setFadeScrollBars(false);
|
||||
scrollPane.setFillParent(true);
|
||||
addActor(scrollPane);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Batch batch, float parentAlpha) {
|
||||
super.draw(batch, parentAlpha);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void act(float delta) {
|
||||
super.act(delta);
|
||||
}
|
||||
|
||||
public void save() {
|
||||
graphicsTable.save();
|
||||
}
|
||||
}
|
@ -190,33 +190,14 @@ public class GameScreen extends ScreenAdapter {
|
||||
batch.flush();
|
||||
lightFilterBuffer.end();
|
||||
|
||||
//Horizontal gaussian blur
|
||||
hBlur.begin();
|
||||
Gdx.gl.glClearColor(0f, 0f, 0f, 1f);
|
||||
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
|
||||
fboRegion.setTexture(lightFilterBuffer.getColorBufferTexture());
|
||||
batch.setShader(gaussianBlurShader);
|
||||
gaussianBlurShader.setUniformi("horizontal", 1);
|
||||
batch.draw(fboRegion, 0f, 0f, gameArea.getWidth(), gameArea.getHeight());
|
||||
batch.flush();
|
||||
hBlur.end();
|
||||
|
||||
//Vertical gaussian blur
|
||||
vBlur.begin();
|
||||
Gdx.gl.glClearColor(0f, 0f, 0f, 1f);
|
||||
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
|
||||
fboRegion.setTexture(hBlur.getColorBufferTexture());
|
||||
batch.setShader(gaussianBlurShader);
|
||||
gaussianBlurShader.setUniformi("horizontal", 0);
|
||||
batch.draw(fboRegion, 0f, 0f, gameArea.getWidth(), gameArea.getHeight());
|
||||
batch.flush();
|
||||
vBlur.end();
|
||||
|
||||
for (int i = 0; i < blurlvl; i++) {
|
||||
//Horizontal gaussian blur
|
||||
hBlur.begin();
|
||||
fboRegion.setTexture(vBlur.getColorBufferTexture());
|
||||
batch.setShader(gaussianBlurShader);
|
||||
if (i > 0) {
|
||||
fboRegion.setTexture(vBlur.getColorBufferTexture());
|
||||
} else {
|
||||
fboRegion.setTexture(lightFilterBuffer.getColorBufferTexture());
|
||||
} batch.setShader(gaussianBlurShader);
|
||||
gaussianBlurShader.setUniformi("horizontal", 1);
|
||||
batch.draw(fboRegion, 0f, 0f, gameArea.getWidth(), gameArea.getHeight());
|
||||
batch.flush();
|
||||
|
@ -21,9 +21,10 @@ import zero1hd.rhythmbullet.RhythmBullet;
|
||||
import zero1hd.rhythmbullet.audio.SongList;
|
||||
import zero1hd.rhythmbullet.audio.SongListController;
|
||||
import zero1hd.rhythmbullet.graphics.ui.pages.CreditsPage;
|
||||
import zero1hd.rhythmbullet.graphics.ui.pages.KeybindOptionsPage;
|
||||
import zero1hd.rhythmbullet.graphics.ui.pages.MainPage;
|
||||
import zero1hd.rhythmbullet.graphics.ui.pages.MoreOptionsPage;
|
||||
import zero1hd.rhythmbullet.graphics.ui.pages.OptionsPage;
|
||||
import zero1hd.rhythmbullet.graphics.ui.pages.VideoOptionsPage;
|
||||
import zero1hd.rhythmbullet.util.TransitionAdapter;
|
||||
|
||||
public class MainMenu extends ScreenAdapter implements TransitionAdapter {
|
||||
@ -33,8 +34,8 @@ public class MainMenu extends ScreenAdapter implements TransitionAdapter {
|
||||
private MainPage mainPage;
|
||||
private OptionsPage optionsPage;
|
||||
private CreditsPage creditsPage;
|
||||
private MoreOptionsPage moreOptionsPage;
|
||||
|
||||
private KeybindOptionsPage keybindPage;
|
||||
private VideoOptionsPage graphicsPage;
|
||||
private RhythmBullet core;
|
||||
|
||||
private SongListController sc;
|
||||
@ -65,21 +66,28 @@ public class MainMenu extends ScreenAdapter implements TransitionAdapter {
|
||||
sc.setAutoPlay(true);
|
||||
sc.setShuffle(true);
|
||||
|
||||
loadShaders();
|
||||
|
||||
postTransition();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postTransition() {
|
||||
loadShaders();
|
||||
|
||||
mainPage = new MainPage(core, targetPosition, sc);
|
||||
mainPage.setPosition(0, 0);
|
||||
stage.addActor(mainPage);
|
||||
//End main menu
|
||||
|
||||
moreOptionsPage = new MoreOptionsPage(core, targetPosition);
|
||||
keybindPage = new KeybindOptionsPage(core.getDefaultSkin(), core.getAssetManager());
|
||||
keybindPage.setPosition(1f*Gdx.graphics.getWidth(), -1f*Gdx.graphics.getHeight());
|
||||
stage.addActor(keybindPage);
|
||||
|
||||
optionsPage = new OptionsPage(core, targetPosition, moreOptionsPage, sc);
|
||||
graphicsPage = new VideoOptionsPage(core.getDefaultSkin(), core.getPrefs());
|
||||
|
||||
graphicsPage.setPosition(1f*Gdx.graphics.getWidth(), 1f*Gdx.graphics.getHeight());
|
||||
stage.addActor(graphicsPage);
|
||||
|
||||
optionsPage = new OptionsPage(core, targetPosition, keybindPage, sc);
|
||||
optionsPage.setPosition(Gdx.graphics.getWidth(), 0);
|
||||
stage.addActor(optionsPage);
|
||||
|
||||
@ -87,8 +95,6 @@ public class MainMenu extends ScreenAdapter implements TransitionAdapter {
|
||||
creditsPage.setPosition(0, Gdx.graphics.getHeight());
|
||||
stage.addActor(creditsPage);
|
||||
|
||||
moreOptionsPage.setPosition(1f*Gdx.graphics.getWidth(), -1f*Gdx.graphics.getHeight());
|
||||
stage.addActor(moreOptionsPage);
|
||||
|
||||
stage.addListener(new InputListener() {
|
||||
@Override
|
||||
@ -99,7 +105,7 @@ public class MainMenu extends ScreenAdapter implements TransitionAdapter {
|
||||
targetPosition.x = 0.5f*Gdx.graphics.getWidth();
|
||||
targetPosition.y = 0.5f*Gdx.graphics.getHeight();
|
||||
}
|
||||
moreOptionsPage.controlUnselect();
|
||||
keybindPage.unselect();
|
||||
}
|
||||
return super.keyUp(event, keycode);
|
||||
}
|
||||
@ -110,7 +116,7 @@ public class MainMenu extends ScreenAdapter implements TransitionAdapter {
|
||||
public void clicked(InputEvent event, float x, float y) {
|
||||
if (stage.hit(x, y, true) == null) {
|
||||
stage.unfocusAll();
|
||||
moreOptionsPage.controlUnselect();
|
||||
keybindPage.unselect();
|
||||
}
|
||||
super.clicked(event, x, y);
|
||||
}
|
||||
@ -122,6 +128,7 @@ public class MainMenu extends ScreenAdapter implements TransitionAdapter {
|
||||
if (core.getPrefs().getBoolean("glow shader")) {
|
||||
batch = new SpriteBatch();
|
||||
screenViewport = new ScreenViewport();
|
||||
screenViewport.update(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
|
||||
|
||||
Gdx.app.debug("Shader", "using glow shader");
|
||||
brightFilterShader = new ShaderProgram(Gdx.files.internal("shaders/basic.vsh"), Gdx.files.internal("shaders/bright_filter.fsh"));
|
||||
@ -182,7 +189,7 @@ public class MainMenu extends ScreenAdapter implements TransitionAdapter {
|
||||
|
||||
@Override
|
||||
public void render(float delta) {
|
||||
Gdx.gl.glClearColor(0.22f, 0f, 0f, 1f);
|
||||
Gdx.gl.glClearColor(0.1f, 0.1f, 0f, 1f);
|
||||
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
|
||||
stage.act(delta);
|
||||
blurlvl = 5;
|
||||
@ -190,73 +197,58 @@ public class MainMenu extends ScreenAdapter implements TransitionAdapter {
|
||||
//Begin drawing a normal version of screen
|
||||
stage.getViewport().apply();
|
||||
normalBuffer.begin();
|
||||
Gdx.gl.glClearColor(0.22f, 0f, 0f, 1f);
|
||||
Gdx.gl.glClearColor(0.1f, 0.1f, 0f, 1f);
|
||||
// Gdx.gl.glClearColor(0.22f, 0f, 0f, 1f);
|
||||
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
|
||||
stage.draw();
|
||||
normalBuffer.end();
|
||||
//END STAGE BATCH
|
||||
|
||||
|
||||
//BEGINNING NORMAL SCREEN RENDER
|
||||
screenViewport.apply();
|
||||
//Begin light filtering
|
||||
lightFilterBuffer.begin();
|
||||
Gdx.gl.glClearColor(0f, 0f, 0f, 1f);
|
||||
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
|
||||
fboRegion.setTexture(normalBuffer.getColorBufferTexture());
|
||||
batch.setShader(brightFilterShader);
|
||||
// lightFilterBuffer.begin();
|
||||
// Gdx.gl.glClearColor(0f, 0f, 0f, 1f);
|
||||
// Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
|
||||
// fboRegion.setTexture(normalBuffer.getColorBufferTexture());
|
||||
// batch.setShader(brightFilterShader);
|
||||
batch.begin(); //BATCH STARTS HERE
|
||||
batch.draw(fboRegion, 0, 0, stage.getWidth(), stage.getHeight());
|
||||
batch.flush();
|
||||
lightFilterBuffer.end();
|
||||
|
||||
//Horizontal gaussian blur
|
||||
hBlur.begin();
|
||||
Gdx.gl.glClearColor(0f, 0f, 0f, 1f);
|
||||
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
|
||||
fboRegion.setTexture(lightFilterBuffer.getColorBufferTexture());
|
||||
batch.setShader(gaussianBlurShader);
|
||||
gaussianBlurShader.setUniformi("horizontal", 1);
|
||||
batch.draw(fboRegion, 0f, 0f, stage.getWidth(), stage.getHeight());
|
||||
batch.flush();
|
||||
hBlur.end();
|
||||
|
||||
//Vertical gaussian blur
|
||||
vBlur.begin();
|
||||
Gdx.gl.glClearColor(0f, 0f, 0f, 1f);
|
||||
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
|
||||
fboRegion.setTexture(hBlur.getColorBufferTexture());
|
||||
batch.setShader(gaussianBlurShader);
|
||||
gaussianBlurShader.setUniformi("horizontal", 0);
|
||||
batch.draw(fboRegion, 0f, 0f, stage.getWidth(), stage.getHeight());
|
||||
batch.flush();
|
||||
vBlur.end();
|
||||
|
||||
for (int i = 0; i < blurlvl; i++) {
|
||||
//Horizontal gaussian blur
|
||||
hBlur.begin();
|
||||
fboRegion.setTexture(vBlur.getColorBufferTexture());
|
||||
batch.setShader(gaussianBlurShader);
|
||||
gaussianBlurShader.setUniformi("horizontal", 1);
|
||||
batch.draw(fboRegion, 0f, 0f, stage.getWidth(), stage.getHeight());
|
||||
batch.flush();
|
||||
hBlur.end();
|
||||
|
||||
//Vertical gaussian blur
|
||||
vBlur.begin();
|
||||
fboRegion.setTexture(hBlur.getColorBufferTexture());
|
||||
batch.setShader(gaussianBlurShader);
|
||||
gaussianBlurShader.setUniformi("horizontal", 0);
|
||||
batch.draw(fboRegion, 0f, 0f, stage.getWidth(), stage.getHeight());
|
||||
batch.flush();
|
||||
vBlur.end();
|
||||
}
|
||||
// batch.setProjectionMatrix(stage.getCamera().combined);
|
||||
// batch.draw(fboRegion, 0, 0, stage.getWidth(), stage.getHeight());
|
||||
// batch.flush();
|
||||
// lightFilterBuffer.end();
|
||||
//
|
||||
// for (int i = 0; i < blurlvl; i++) {
|
||||
// //Horizontal gaussian blur
|
||||
// hBlur.begin();
|
||||
// if (i > 0) {
|
||||
// fboRegion.setTexture(vBlur.getColorBufferTexture());
|
||||
// } else {
|
||||
// fboRegion.setTexture(lightFilterBuffer.getColorBufferTexture());
|
||||
// }
|
||||
// batch.setShader(gaussianBlurShader);
|
||||
// gaussianBlurShader.setUniformi("horizontal", 1);
|
||||
// batch.draw(fboRegion, 0f, 0f, stage.getWidth(), stage.getHeight());
|
||||
// batch.flush();
|
||||
// hBlur.end();
|
||||
//
|
||||
// //Vertical gaussian blur
|
||||
// vBlur.begin();
|
||||
// fboRegion.setTexture(hBlur.getColorBufferTexture());
|
||||
// batch.setShader(gaussianBlurShader);
|
||||
// gaussianBlurShader.setUniformi("horizontal", 0);
|
||||
// batch.draw(fboRegion, 0f, 0f, stage.getWidth(), stage.getHeight());
|
||||
// batch.flush();
|
||||
// vBlur.end();
|
||||
// }
|
||||
|
||||
//draw a final copy to a fbo
|
||||
Gdx.gl.glClearColor(0f, 0f, 0f, 0f);
|
||||
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
|
||||
batch.setShader(combineShader);
|
||||
// batch.setShader(combineShader);
|
||||
fboRegion.setTexture(normalBuffer.getColorBufferTexture());
|
||||
batch.draw(fboRegion, 0f, 0f, stage.getWidth(), stage.getHeight());
|
||||
// System.out.println(stage.getWidth() + "x" + stage.getHeight());
|
||||
// System.out.println(screenViewport.getScreenWidth() + "x" + screenViewport.getScreenHeight());
|
||||
// System.err.println(screenViewport.getWorldWidth() + "x" + screenViewport.getWorldHeight());
|
||||
batch.setShader(null);
|
||||
batch.end(); //STAGE BATCH ENDS HERE
|
||||
|
||||
@ -277,7 +269,7 @@ public class MainMenu extends ScreenAdapter implements TransitionAdapter {
|
||||
mainPage.dispose();
|
||||
optionsPage.dispose();
|
||||
creditsPage.dispose();
|
||||
moreOptionsPage.dispose();
|
||||
keybindPage.dispose();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -297,7 +289,6 @@ public class MainMenu extends ScreenAdapter implements TransitionAdapter {
|
||||
public void saveAll() {
|
||||
if (optionsPage != null) {
|
||||
optionsPage.saveOptions(core.getPrefs());
|
||||
moreOptionsPage.getGraphicsSettings().save(core.getPrefs());
|
||||
core.getPrefs().flush();
|
||||
}
|
||||
}
|
||||
@ -318,10 +309,10 @@ public class MainMenu extends ScreenAdapter implements TransitionAdapter {
|
||||
}
|
||||
|
||||
private void calcLerpAlpha(int width) {
|
||||
if (width >= 3835) {
|
||||
lerpAlpha = 0.005f;
|
||||
if (width <= 3835) {
|
||||
lerpAlpha = 0.15f;
|
||||
} else {
|
||||
lerpAlpha = 0.25f;
|
||||
lerpAlpha = 0.15f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,6 @@ package zero1hd.rhythmbullet.stages;
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.Input.Keys;
|
||||
import com.badlogic.gdx.Screen;
|
||||
import com.badlogic.gdx.audio.Music;
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.graphics.Pixmap;
|
||||
import com.badlogic.gdx.graphics.Pixmap.Format;
|
||||
|
Loading…
Reference in New Issue
Block a user