minor cleanup and fixing

This commit is contained in:
Harrison Deng 2018-02-14 22:28:10 -06:00
parent da9e657564
commit 188608d40d

View File

@ -7,7 +7,6 @@ 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.Texture;
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;
import com.badlogic.gdx.graphics.glutils.FrameBuffer; import com.badlogic.gdx.graphics.glutils.FrameBuffer;
@ -61,7 +60,7 @@ public class MainMenuScreen extends ScreenAdapter implements AdvancedResizeScree
private TextureRegion fboRegion; private TextureRegion fboRegion;
private int fboSize; private int fboSize;
private int blurlvl; private int blurlvl;
private Batch screenBatch; private SpriteBatch screenBatch;
private ScreenViewport screenViewport; private ScreenViewport screenViewport;
private boolean shaderLoaded; private boolean shaderLoaded;
@ -92,6 +91,7 @@ public class MainMenuScreen extends ScreenAdapter implements AdvancedResizeScree
background = core.getAssetManager().get("backgrounds/mainBG.png", Texture.class); background = core.getAssetManager().get("backgrounds/mainBG.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);
@ -162,9 +162,6 @@ public class MainMenuScreen extends ScreenAdapter implements AdvancedResizeScree
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, 1f);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
screenBatch.begin();
screenBatch.draw(background, 0, 0);
screenBatch.end();
draw(); draw();
normalBuffer.end(); normalBuffer.end();
@ -179,7 +176,6 @@ public class MainMenuScreen extends ScreenAdapter implements AdvancedResizeScree
screenBatch.setShader(brightFilterShader); screenBatch.setShader(brightFilterShader);
screenBatch.setProjectionMatrix(screenViewport.getCamera().combined); screenBatch.setProjectionMatrix(screenViewport.getCamera().combined);
screenBatch.begin(); //BATCH STARTS HERE screenBatch.begin(); //BATCH STARTS HERE
//TODO Do shader version of background for main menu. //TODO Do shader version of background for main menu.
screenBatch.draw(fboRegion, 0, 0, stage.getWidth(), stage.getHeight()); screenBatch.draw(fboRegion, 0, 0, stage.getWidth(), stage.getHeight());
@ -219,9 +215,6 @@ public class MainMenuScreen extends ScreenAdapter implements AdvancedResizeScree
screenBatch.end(); //BATCH ENDS HERE screenBatch.end(); //BATCH ENDS HERE
} else { } else {
screenBatch.begin();
screenBatch.draw(background, 0, 0);
screenBatch.end();
draw(); draw();
} }
@ -235,6 +228,9 @@ public class MainMenuScreen extends ScreenAdapter implements AdvancedResizeScree
} }
private void draw() { private void draw() {
screenBatch.begin();
screenBatch.draw(background, 0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
screenBatch.end();
stage.draw(); stage.draw();
} }