main menu background progress

This commit is contained in:
Harrison Deng 2018-01-29 14:33:20 -06:00
parent 8c10e94246
commit c3a13d20fa
20 changed files with 45 additions and 50 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 738 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 947 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 891 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 452 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 MiB

View File

@ -1,19 +0,0 @@
gradients.png
size: 128,128
format: RGBA8888
filter: Linear,Linear
repeat: none
round-grad
rotate: false
xy: 2, 2
size: 5, 5
orig: 5, 5
offset: 0, 0
index: -1
linear-up-grad
rotate: false
xy: 10, 2
size: 5, 5
orig: 5, 5
offset: 0, 0
index: -1

Binary file not shown.

Before

Width:  |  Height:  |  Size: 581 B

View File

@ -230,7 +230,6 @@ public class RhythmBullet extends Game {
assetManager.load("shard.png", Texture.class); assetManager.load("shard.png", Texture.class);
assetManager.load("bar.png", Texture.class); assetManager.load("bar.png", Texture.class);
assetManager.load("flake.png", Texture.class); assetManager.load("flake.png", Texture.class);
assetManager.load("star_bg.png", Texture.class);
assetManager.load("void_circle.png", Texture.class); assetManager.load("void_circle.png", Texture.class);
assetManager.load("laser.ogg", Sound.class); assetManager.load("laser.ogg", Sound.class);
assetManager.load("explosion.ogg", Sound.class); assetManager.load("explosion.ogg", Sound.class);
@ -239,7 +238,7 @@ public class RhythmBullet extends Game {
assetManager.load("beateffect.p", ParticleEffect.class); assetManager.load("beateffect.p", ParticleEffect.class);
assetManager.load("tpSelector.png", Texture.class); assetManager.load("tpSelector.png", Texture.class);
assetManager.load("magic1.png", Texture.class); assetManager.load("magic1.png", Texture.class);
assetManager.load("gradients.atlas", TextureAtlas.class); assetManager.load("RhythmBulletBG.png", Texture.class);
} }
public void generateFonts(final int height) { public void generateFonts(final int height) {

View File

@ -43,12 +43,10 @@ public class GraphicsOptions extends Table {
public void changed(ChangeEvent event, Actor actor) { public void changed(ChangeEvent event, Actor actor) {
save(); save();
if (glowShader.isChecked()) { if (glowShader.isChecked()) {
mainMenu.attemptLoadShaders();
enhancedGlow.setDisabled(false); enhancedGlow.setDisabled(false);
} else { } else {
enhancedGlow.setChecked(false); enhancedGlow.setChecked(false);
enhancedGlow.setDisabled(true); enhancedGlow.setDisabled(true);
mainMenu.unloadShaders();
} }
} }
}); });

View File

@ -6,6 +6,7 @@ import com.badlogic.gdx.ScreenAdapter;
import com.badlogic.gdx.graphics.GL20; import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.OrthographicCamera; import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.Pixmap.Format; import com.badlogic.gdx.graphics.Pixmap.Format;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.Batch; import com.badlogic.gdx.graphics.g2d.Batch;
import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.g2d.TextureRegion; import com.badlogic.gdx.graphics.g2d.TextureRegion;
@ -34,6 +35,7 @@ import zero1hd.rhythmbullet.util.MusicManager;
public class MainMenu extends ScreenAdapter implements AdvancedResizeScreen { public class MainMenu extends ScreenAdapter implements AdvancedResizeScreen {
public Stage stage; public Stage stage;
private Texture background;
private Vector3 cameraPosition; private Vector3 cameraPosition;
private MainPage mainPage; private MainPage mainPage;
@ -59,8 +61,9 @@ public class MainMenu extends ScreenAdapter implements AdvancedResizeScreen {
private TextureRegion fboRegion; private TextureRegion fboRegion;
private int fboSize; private int fboSize;
private int blurlvl; private int blurlvl;
private Batch batch; private Batch screenBatch;
private ScreenViewport screenViewport; private ScreenViewport screenViewport;
private boolean shaderLoaded;
public MainMenu(RhythmBullet core) { public MainMenu(RhythmBullet core) {
this.core = core; this.core = core;
@ -75,6 +78,8 @@ public class MainMenu extends ScreenAdapter implements AdvancedResizeScreen {
mlc.setShuffle(true); mlc.setShuffle(true);
mic = new MusicInfoController(musicList); mic = new MusicInfoController(musicList);
screenBatch = new SpriteBatch();
} }
@Override @Override
@ -85,6 +90,8 @@ public class MainMenu extends ScreenAdapter implements AdvancedResizeScreen {
stage.addActor(mainPage); stage.addActor(mainPage);
//End main menu //End main menu
background = core.getAssetManager().get("RhythmBulletBG.png", Texture.class);
keybindPage = new KeybindOptionsPage(core.getDefaultSkin(), core.getAssetManager(), cameraPosition); keybindPage = new KeybindOptionsPage(core.getDefaultSkin(), core.getAssetManager(), cameraPosition);
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);
@ -153,7 +160,7 @@ public class MainMenu extends ScreenAdapter implements AdvancedResizeScreen {
// Begin drawing a normal version of screen // Begin drawing a normal version of screen
normalBuffer.begin(); normalBuffer.begin();
stage.getViewport().apply(); stage.getViewport().apply();
Gdx.gl.glClearColor(0.2f, 0.2f, 0.2f, 1f); Gdx.gl.glClearColor(0.2f, 0.2f, 0.2f, 0f);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
draw(); draw();
normalBuffer.end(); normalBuffer.end();
@ -163,14 +170,17 @@ public class MainMenu extends ScreenAdapter implements AdvancedResizeScreen {
// Begin light filtering // Begin light filtering
lightFilterBuffer.begin(); lightFilterBuffer.begin();
Gdx.gl.glClearColor(0f, 0f, 0f, 1f); Gdx.gl.glClearColor(0f, 0f, 0f, 0f);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
fboRegion.setTexture(normalBuffer.getColorBufferTexture()); fboRegion.setTexture(normalBuffer.getColorBufferTexture());
batch.setShader(brightFilterShader); screenBatch.setShader(brightFilterShader);
batch.setProjectionMatrix(screenViewport.getCamera().combined); screenBatch.setProjectionMatrix(screenViewport.getCamera().combined);
batch.begin(); //BATCH STARTS HERE screenBatch.begin(); //BATCH STARTS HERE
batch.draw(fboRegion, 0, 0, stage.getWidth(), stage.getHeight());
batch.flush(); //TODO Do shader version of background for main menu.
screenBatch.draw(fboRegion, 0, 0, stage.getWidth(), stage.getHeight());
screenBatch.flush();
lightFilterBuffer.end(); lightFilterBuffer.end();
// //
for (int i = 0; i < blurlvl; i++) { for (int i = 0; i < blurlvl; i++) {
@ -181,31 +191,34 @@ public class MainMenu extends ScreenAdapter implements AdvancedResizeScreen {
} else { } else {
fboRegion.setTexture(lightFilterBuffer.getColorBufferTexture()); fboRegion.setTexture(lightFilterBuffer.getColorBufferTexture());
} }
batch.setShader(gaussianBlurShader); screenBatch.setShader(gaussianBlurShader);
gaussianBlurShader.setUniformi("horizontal", 1); gaussianBlurShader.setUniformi("horizontal", 1);
batch.draw(fboRegion, 0f, 0f, stage.getWidth(), stage.getHeight()); screenBatch.draw(fboRegion, 0f, 0f, stage.getWidth(), stage.getHeight());
batch.flush(); screenBatch.flush();
hBlur.end(); hBlur.end();
// //Vertical gaussian blur // //Vertical gaussian blur
vBlur.begin(); vBlur.begin();
fboRegion.setTexture(hBlur.getColorBufferTexture()); fboRegion.setTexture(hBlur.getColorBufferTexture());
batch.setShader(gaussianBlurShader); screenBatch.setShader(gaussianBlurShader);
gaussianBlurShader.setUniformi("horizontal", 0); gaussianBlurShader.setUniformi("horizontal", 0);
batch.draw(fboRegion, 0f, 0f, stage.getWidth(), stage.getHeight()); screenBatch.draw(fboRegion, 0f, 0f, stage.getWidth(), stage.getHeight());
batch.flush(); screenBatch.flush();
vBlur.end(); vBlur.end();
} }
Gdx.gl.glClearColor(0f, 0f, 0f, 0f); Gdx.gl.glClearColor(0f, 0f, 0f, 0f);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
batch.setShader(combineShader); screenBatch.setShader(combineShader);
fboRegion.setTexture(normalBuffer.getColorBufferTexture()); fboRegion.setTexture(normalBuffer.getColorBufferTexture());
batch.draw(fboRegion, 0f, 0f, fboSize, fboSize); screenBatch.draw(fboRegion, 0f, 0f, fboSize, fboSize);
batch.setShader(null); screenBatch.setShader(null);
batch.end(); //STAGE BATCH ENDS HERE screenBatch.end(); //BATCH ENDS HERE
} else { } else {
screenBatch.begin();
screenBatch.draw(background, 0, 0);
screenBatch.end();
draw(); draw();
} }
@ -219,7 +232,6 @@ public class MainMenu extends ScreenAdapter implements AdvancedResizeScreen {
} }
private void draw() { private void draw() {
//TODO draw background
stage.draw(); stage.draw();
} }
@ -227,6 +239,7 @@ public class MainMenu extends ScreenAdapter implements AdvancedResizeScreen {
public void preAssetLoad() { public void preAssetLoad() {
stage.clear(); stage.clear();
mainPage.dispose(); mainPage.dispose();
screenBatch.dispose();
optionsPage.dispose(); optionsPage.dispose();
creditsPage.dispose(); creditsPage.dispose();
keybindPage.dispose(); keybindPage.dispose();
@ -297,11 +310,16 @@ public class MainMenu extends ScreenAdapter implements AdvancedResizeScreen {
vBlur = null; vBlur = null;
hBlur = null; hBlur = null;
setBlurlvl(0); shaderLoaded = false;
} }
public void setBlurlvl(int blurlvl) { public void setBlurlvl(int blurlvl) {
this.blurlvl = blurlvl; this.blurlvl = blurlvl;
if (blurlvl > 0) {
attemptLoadShaders();
} else {
unloadShaders();
}
} }
public Vector3 getCameraPosition() { public Vector3 getCameraPosition() {
@ -329,14 +347,13 @@ public class MainMenu extends ScreenAdapter implements AdvancedResizeScreen {
} }
public void attemptLoadShaders() { public void attemptLoadShaders() {
if (core.getPrefs().getBoolean("glow shader", true)) { if (core.getPrefs().getBoolean("glow shader", true) && !shaderLoaded) {
if (core.getPrefs().getBoolean("enhanced glow", false)) { if (core.getPrefs().getBoolean("enhanced glow", false)) {
blurlvl = 5; blurlvl = 5;
} else { } else {
blurlvl = 1; blurlvl = 1;
} }
Gdx.app.debug("Shader", "Loading glow shaders."); Gdx.app.debug("Shader", "Loading glow shaders.");
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());
((OrthographicCamera) screenViewport.getCamera()).setToOrtho(false, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); ((OrthographicCamera) screenViewport.getCamera()).setToOrtho(false, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
@ -345,7 +362,7 @@ public class MainMenu extends ScreenAdapter implements AdvancedResizeScreen {
brightFilterShader = new ShaderProgram(Gdx.files.internal("shaders/basic.vsh"), Gdx.files.internal("shaders/bright_filter.fsh")); brightFilterShader = new ShaderProgram(Gdx.files.internal("shaders/basic.vsh"), Gdx.files.internal("shaders/bright_filter.fsh"));
if (!brightFilterShader.isCompiled()) { if (!brightFilterShader.isCompiled()) {
Gdx.app.error("Shader failed to compile", brightFilterShader.getLog()); Gdx.app.error("Shader failed to compile", brightFilterShader.getLog());
System.exit(0); setBlurlvl(0);
} }
if (brightFilterShader.getLog().length() != 0) { if (brightFilterShader.getLog().length() != 0) {
Gdx.app.error("Shader", brightFilterShader.getLog()); Gdx.app.error("Shader", brightFilterShader.getLog());
@ -354,7 +371,7 @@ public class MainMenu extends ScreenAdapter implements AdvancedResizeScreen {
gaussianBlurShader = new ShaderProgram(Gdx.files.internal("shaders/basic.vsh"), Gdx.files.internal("shaders/gaussian_blur.fsh")); gaussianBlurShader = new ShaderProgram(Gdx.files.internal("shaders/basic.vsh"), Gdx.files.internal("shaders/gaussian_blur.fsh"));
if (!gaussianBlurShader.isCompiled()) { if (!gaussianBlurShader.isCompiled()) {
Gdx.app.error("Shader failed to compile", gaussianBlurShader.getLog()); Gdx.app.error("Shader failed to compile", gaussianBlurShader.getLog());
System.exit(0); setBlurlvl(0);
} }
if (gaussianBlurShader.getLog().length() != 0) { if (gaussianBlurShader.getLog().length() != 0) {
Gdx.app.error("Shader", gaussianBlurShader.getLog()); Gdx.app.error("Shader", gaussianBlurShader.getLog());
@ -363,7 +380,7 @@ public class MainMenu extends ScreenAdapter implements AdvancedResizeScreen {
combineShader = new ShaderProgram(Gdx.files.internal("shaders/basic.vsh"), Gdx.files.internal("shaders/combine.fsh")); combineShader = new ShaderProgram(Gdx.files.internal("shaders/basic.vsh"), Gdx.files.internal("shaders/combine.fsh"));
if (!combineShader.isCompiled()) { if (!combineShader.isCompiled()) {
Gdx.app.error("Shader failed to compile", combineShader.getLog()); Gdx.app.error("Shader failed to compile", combineShader.getLog());
System.exit(0); setBlurlvl(0);
} }
if (combineShader.getLog().length() != 0) { if (combineShader.getLog().length() != 0) {
Gdx.app.error("Shader", combineShader.getLog()); Gdx.app.error("Shader", combineShader.getLog());
@ -393,9 +410,9 @@ public class MainMenu extends ScreenAdapter implements AdvancedResizeScreen {
vBlur.getColorBufferTexture().bind(1); vBlur.getColorBufferTexture().bind(1);
Gdx.gl.glActiveTexture(GL20.GL_TEXTURE0); Gdx.gl.glActiveTexture(GL20.GL_TEXTURE0);
}
ShaderProgram.pedantic = false; ShaderProgram.pedantic = false;
shaderLoaded = true;
}
} }
} }