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("bar.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("laser.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("tpSelector.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) {

View File

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