options have been added back
This commit is contained in:
		@@ -130,9 +130,11 @@ public class BasicVisualizer extends VisualizerCore {
 | 
			
		||||
		
 | 
			
		||||
		barWidth = MathUtils.ceil((float) width/(float) barCount);
 | 
			
		||||
		barWidth -= spaceBetweenBars;
 | 
			
		||||
		
 | 
			
		||||
		for (int i = 0; i < bars.length; i++) {
 | 
			
		||||
			barSpace = i*(barWidth+spaceBetweenBars);
 | 
			
		||||
			if (i == bars.length - 1) {
 | 
			
		||||
				barSpace -= 2;
 | 
			
		||||
			}
 | 
			
		||||
			if (flip) {
 | 
			
		||||
				bars[i].setRotation(rotation+180);
 | 
			
		||||
			} else {
 | 
			
		||||
 
 | 
			
		||||
@@ -43,8 +43,11 @@ public class MirrorVisualizer {
 | 
			
		||||
			} else {
 | 
			
		||||
				bars[i].setRotation(rotation);
 | 
			
		||||
			}
 | 
			
		||||
			
 | 
			
		||||
			bars[i].setPosition(xPos + i*barSpaceMultiplier*rectCoordRot.x, yPos + i*barSpaceMultiplier*rectCoordRot.y);
 | 
			
		||||
			int barSpace = i*(barWidth+spaceBetweenBars);
 | 
			
		||||
			if (i == bars.length - 1) {
 | 
			
		||||
				barSpace -= 2;
 | 
			
		||||
			}
 | 
			
		||||
			bars[i].setPosition(xPos + barSpace*rectCoordRot.x, yPos + barSpace*rectCoordRot.y);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
 
 | 
			
		||||
@@ -77,7 +77,6 @@ public class MainPage extends Page implements OnDifferentSongListener {
 | 
			
		||||
			@Override
 | 
			
		||||
			public void changed(ChangeEvent event, Actor actor) {
 | 
			
		||||
				Gdx.app.exit();
 | 
			
		||||
				System.exit(0);
 | 
			
		||||
			}
 | 
			
		||||
		});
 | 
			
		||||
		table.add(quitButton).fillX();
 | 
			
		||||
 
 | 
			
		||||
@@ -15,6 +15,7 @@ import com.badlogic.gdx.scenes.scene2d.ui.Table;
 | 
			
		||||
import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
 | 
			
		||||
import com.badlogic.gdx.scenes.scene2d.ui.TextField;
 | 
			
		||||
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
 | 
			
		||||
import com.badlogic.gdx.utils.Align;
 | 
			
		||||
 | 
			
		||||
import zero1hd.rhythmbullet.RhythmBullet;
 | 
			
		||||
import zero1hd.rhythmbullet.audio.SongListController;
 | 
			
		||||
@@ -28,18 +29,31 @@ public class OptionsPage extends Page {
 | 
			
		||||
	private TextField directoryField;
 | 
			
		||||
	
 | 
			
		||||
	public OptionsPage(RhythmBullet core, Vector3 targetPosition, MoreOptionsPage moreOptionsPage, SongListController sc) {
 | 
			
		||||
		optionsTable.defaults().spaceLeft(40f).padTop(5f).padBottom(5f).left();
 | 
			
		||||
		super("General", core.getDefaultSkin());
 | 
			
		||||
		
 | 
			
		||||
		Label optionGeneralTitle = new Label("General", core.getDefaultSkin(), "large-font", core.getDefaultSkin().getColor("default"));
 | 
			
		||||
		optionsTable.add(optionGeneralTitle).left().spaceBottom(10f);
 | 
			
		||||
		//Back button
 | 
			
		||||
		TextButton backButton = new TextButton("Back", core.getDefaultSkin());
 | 
			
		||||
		backButton.addListener(new ChangeListener() {
 | 
			
		||||
			@Override
 | 
			
		||||
			public void changed(ChangeEvent event, Actor actor) {
 | 
			
		||||
				targetPosition.x = 0.5f*Gdx.graphics.getWidth();
 | 
			
		||||
			}
 | 
			
		||||
		});
 | 
			
		||||
		backButton.setPosition(10, getHeightBelowTitle() + 5);
 | 
			
		||||
		addActor(backButton);
 | 
			
		||||
		addSpaceToTitle(backButton.getWidth() + backButton.getX() + 20);
 | 
			
		||||
		
 | 
			
		||||
		optionsTable.row();
 | 
			
		||||
		optionsTable.align(Align.center);
 | 
			
		||||
		optionsTable.defaults().space(10f).expandY().padBottom(25f);
 | 
			
		||||
		optionsTable.setPosition(0, 0);
 | 
			
		||||
		optionsTable.setSize(getWidth(), getHeightBelowTitle() - 5);
 | 
			
		||||
		addActor(optionsTable);
 | 
			
		||||
		
 | 
			
		||||
		Label musicVolSliderLabel = new Label("Music Volume: ", core.getDefaultSkin());
 | 
			
		||||
		optionsTable.add(musicVolSliderLabel).padRight(12f).left();
 | 
			
		||||
		optionsTable.add(musicVolSliderLabel).left();
 | 
			
		||||
		musicVolSlider = new Slider(0, 100, 0.1f, false, core.getDefaultSkin());
 | 
			
		||||
		musicVolSlider.setValue(core.getPrefs().getFloat("music vol", 100f)*100f);
 | 
			
		||||
		optionsTable.add(musicVolSlider).prefWidth(790).left();
 | 
			
		||||
		optionsTable.add(musicVolSlider).spaceRight(15f).prefWidth(0.5f*getWidth()).fillX();
 | 
			
		||||
		final Label musicVolPercentage = new Label(MathUtils.round(musicVolSlider.getValue()) + "%", core.getDefaultSkin());
 | 
			
		||||
		musicVolSlider.addListener(new ChangeListener() {
 | 
			
		||||
			@Override
 | 
			
		||||
@@ -50,15 +64,15 @@ public class OptionsPage extends Page {
 | 
			
		||||
				core.getPrefs().putFloat("music vol", musicVolSlider.getPercent());
 | 
			
		||||
			}
 | 
			
		||||
		});
 | 
			
		||||
		optionsTable.add(musicVolPercentage).expandX();
 | 
			
		||||
		optionsTable.add(musicVolPercentage).center();
 | 
			
		||||
		
 | 
			
		||||
		optionsTable.row();
 | 
			
		||||
		
 | 
			
		||||
		Label fxVolSliderLabel = new Label("FX Volume: ", core.getDefaultSkin());
 | 
			
		||||
		optionsTable.add(fxVolSliderLabel).padRight(12f).left();
 | 
			
		||||
		fxVolSlider = new Slider(0, 100, 1, false, core.getDefaultSkin());
 | 
			
		||||
		optionsTable.add(fxVolSliderLabel).left();
 | 
			
		||||
		fxVolSlider = new Slider(0, 100, 0.1f, false, core.getDefaultSkin());
 | 
			
		||||
		fxVolSlider.setValue(core.getPrefs().getFloat("fx vol", 100f)*100f);
 | 
			
		||||
		optionsTable.add(fxVolSlider).prefWidth(790);
 | 
			
		||||
		optionsTable.add(fxVolSlider).spaceRight(15f).prefWidth(0.5f*getWidth()).fillX();
 | 
			
		||||
		final Label fxVolPercentage = new Label(MathUtils.round(fxVolSlider.getValue()) + "%", core.getDefaultSkin());
 | 
			
		||||
		fxVolSlider.addListener(new ChangeListener() {
 | 
			
		||||
			@Override
 | 
			
		||||
@@ -68,7 +82,7 @@ public class OptionsPage extends Page {
 | 
			
		||||
			}
 | 
			
		||||
		});
 | 
			
		||||
		
 | 
			
		||||
		optionsTable.add(fxVolPercentage);
 | 
			
		||||
		optionsTable.add(fxVolPercentage).center();
 | 
			
		||||
		
 | 
			
		||||
		optionsTable.row();
 | 
			
		||||
		
 | 
			
		||||
@@ -76,33 +90,18 @@ public class OptionsPage extends Page {
 | 
			
		||||
		optionsTable.add(musicDirectoryLabel).left();
 | 
			
		||||
		directoryField = new TextField(null, core.getDefaultSkin());
 | 
			
		||||
		directoryField.setText(core.getPrefs().getString("music dir", System.getProperty("user.home")+System.getProperty("file.separator")+"Music"));
 | 
			
		||||
		optionsTable.add(directoryField).prefWidth(810).left();
 | 
			
		||||
		optionsTable.add(directoryField).fillX();
 | 
			
		||||
		
 | 
			
		||||
		optionsTable.row();
 | 
			
		||||
		
 | 
			
		||||
		Label debugCodeLabel = new Label("Debug Code: ", core.getDefaultSkin());
 | 
			
		||||
		optionsTable.add(debugCodeLabel).left();
 | 
			
		||||
		final TextField debugCodeField = new TextField(null, core.getDefaultSkin());
 | 
			
		||||
		optionsTable.add(debugCodeField).prefWidth(810).left();
 | 
			
		||||
		optionsTable.add(debugCodeField).fillX();
 | 
			
		||||
		
 | 
			
		||||
		optionsTable.top();
 | 
			
		||||
		
 | 
			
		||||
		
 | 
			
		||||
		//Back button
 | 
			
		||||
		TextButton backButton = new TextButton("Back", core.getDefaultSkin());
 | 
			
		||||
		backButton.addListener(new ChangeListener() {
 | 
			
		||||
			@Override
 | 
			
		||||
			public void changed(ChangeEvent event, Actor actor) {
 | 
			
		||||
				targetPosition.x = 0.5f*Gdx.graphics.getWidth();
 | 
			
		||||
			}
 | 
			
		||||
		});
 | 
			
		||||
		backButton.setPosition(10, getHeight()-backButton.getHeight()-18);
 | 
			
		||||
		addActor(backButton);
 | 
			
		||||
		
 | 
			
		||||
		optionsTable.setPosition(backButton.getX()+ 20 + backButton.getWidth(), 0);
 | 
			
		||||
		optionsTable.setSize(getWidth()-backButton.getWidth()-10-20-10, getHeight());
 | 
			
		||||
		addActor(optionsTable);
 | 
			
		||||
		
 | 
			
		||||
		optionsTable.row();
 | 
			
		||||
		
 | 
			
		||||
		TextButton keybindSettings = new TextButton("Set Controls",  core.getDefaultSkin());
 | 
			
		||||
@@ -113,7 +112,7 @@ public class OptionsPage extends Page {
 | 
			
		||||
				targetPosition.y = -0.5f*Gdx.graphics.getHeight();
 | 
			
		||||
			}
 | 
			
		||||
		});
 | 
			
		||||
		optionsTable.add(keybindSettings).colspan(2).fill();
 | 
			
		||||
		optionsTable.add(keybindSettings).colspan(2).fillX();
 | 
			
		||||
		
 | 
			
		||||
		optionsTable.row();
 | 
			
		||||
		
 | 
			
		||||
@@ -125,7 +124,7 @@ public class OptionsPage extends Page {
 | 
			
		||||
				targetPosition.y = -0.5f*Gdx.graphics.getHeight();					
 | 
			
		||||
			}
 | 
			
		||||
		});
 | 
			
		||||
		optionsTable.add(graphicsSettings).colspan(2).fill();
 | 
			
		||||
		optionsTable.add(graphicsSettings).colspan(2).fillX();
 | 
			
		||||
		addListener(new InputListener() {
 | 
			
		||||
			@Override
 | 
			
		||||
			public boolean keyUp(InputEvent event, int keycode) {
 | 
			
		||||
 
 | 
			
		||||
@@ -33,6 +33,10 @@ public class Page extends Group implements Disposable {
 | 
			
		||||
		return pageTitle.getY();
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public void addSpaceToTitle(float space) {
 | 
			
		||||
		pageTitle.moveBy(space, 0);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public void dispose() {
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
@@ -6,12 +6,15 @@ import com.badlogic.gdx.Screen;
 | 
			
		||||
import com.badlogic.gdx.ScreenAdapter;
 | 
			
		||||
import com.badlogic.gdx.graphics.GL20;
 | 
			
		||||
import com.badlogic.gdx.graphics.Pixmap.Format;
 | 
			
		||||
import com.badlogic.gdx.graphics.g2d.Batch;
 | 
			
		||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
 | 
			
		||||
import com.badlogic.gdx.graphics.g2d.TextureRegion;
 | 
			
		||||
import com.badlogic.gdx.graphics.glutils.FrameBuffer;
 | 
			
		||||
import com.badlogic.gdx.graphics.glutils.ShaderProgram;
 | 
			
		||||
import com.badlogic.gdx.scenes.scene2d.Actor;
 | 
			
		||||
import com.badlogic.gdx.scenes.scene2d.ui.ImageButton;
 | 
			
		||||
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
 | 
			
		||||
import com.badlogic.gdx.utils.viewport.ScreenViewport;
 | 
			
		||||
 | 
			
		||||
import zero1hd.rhythmbullet.RhythmBullet;
 | 
			
		||||
import zero1hd.rhythmbullet.audio.MusicManager;
 | 
			
		||||
@@ -37,7 +40,8 @@ public class GameScreen extends ScreenAdapter {
 | 
			
		||||
	private FrameBuffer hBlur, vBlur;
 | 
			
		||||
	private TextureRegion fboRegion;
 | 
			
		||||
	private int fboSize;
 | 
			
		||||
	
 | 
			
		||||
	private Batch batch;
 | 
			
		||||
	private ScreenViewport screenViewport;
 | 
			
		||||
	private int blurlvl = 4;
 | 
			
		||||
	
 | 
			
		||||
	/**
 | 
			
		||||
@@ -88,6 +92,9 @@ public class GameScreen extends ScreenAdapter {
 | 
			
		||||
	*/
 | 
			
		||||
	public void loadShaders() {
 | 
			
		||||
		if (core.getPrefs().getBoolean("glow shader")) {
 | 
			
		||||
			batch = new SpriteBatch();
 | 
			
		||||
			screenViewport = new ScreenViewport();
 | 
			
		||||
			
 | 
			
		||||
			Gdx.app.debug("Shader", "using glow shader");
 | 
			
		||||
			brightFilterShader = new ShaderProgram(Gdx.files.internal("shaders/basic.vsh"), Gdx.files.internal("shaders/bright_filter.fsh"));
 | 
			
		||||
			if (!brightFilterShader.isCompiled()) {
 | 
			
		||||
@@ -125,12 +132,13 @@ public class GameScreen extends ScreenAdapter {
 | 
			
		||||
				fboSize = 4096;
 | 
			
		||||
			}
 | 
			
		||||
			
 | 
			
		||||
			lightFilterBuffer = new FrameBuffer(Format.RGBA8888, fboSize/4, fboSize/4, false);
 | 
			
		||||
			lightFilterBuffer = new FrameBuffer(Format.RGBA8888, fboSize/2, fboSize/2, false);
 | 
			
		||||
			normalBuffer = new FrameBuffer(Format.RGBA8888, fboSize, fboSize, false);
 | 
			
		||||
			hBlur = new FrameBuffer(Format.RGBA8888, fboSize, fboSize, false);
 | 
			
		||||
			vBlur = new FrameBuffer(Format.RGBA8888, fboSize, fboSize, false);
 | 
			
		||||
			hBlur = new FrameBuffer(Format.RGBA8888, fboSize/2, fboSize/2, false);
 | 
			
		||||
			vBlur = new FrameBuffer(Format.RGBA8888, fboSize/2, fboSize/2, false);
 | 
			
		||||
 | 
			
		||||
			fboRegion = new TextureRegion();
 | 
			
		||||
			fboRegion = new TextureRegion(normalBuffer.getColorBufferTexture());
 | 
			
		||||
			fboRegion.flip(false, true);
 | 
			
		||||
 | 
			
		||||
			combineShader.begin();
 | 
			
		||||
			combineShader.setUniformi("u_texture1", 1);
 | 
			
		||||
@@ -161,93 +169,78 @@ public class GameScreen extends ScreenAdapter {
 | 
			
		||||
		blurlvl = 4;
 | 
			
		||||
		if (gaussianBlurShader != null) {
 | 
			
		||||
			//Begin drawing a normal version of screen
 | 
			
		||||
			gameArea.getViewport().apply();
 | 
			
		||||
			normalBuffer.begin();
 | 
			
		||||
			Gdx.gl.glClearColor(0f, 0f, 0f, 0f);
 | 
			
		||||
			Gdx.gl.glClearColor(0.22f, 0f, 0f, 1f);
 | 
			
		||||
			Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
 | 
			
		||||
			gameArea.draw();
 | 
			
		||||
			gameArea.getCollisionDetector().renderParticles(gameArea.getBatch(), Gdx.graphics.getDeltaTime(), true);
 | 
			
		||||
			normalBuffer.end(
 | 
			
		||||
					gameArea.getViewport().getScreenX(), 
 | 
			
		||||
					gameArea.getViewport().getScreenY(), 
 | 
			
		||||
					gameArea.getViewport().getScreenWidth(), 
 | 
			
		||||
					gameArea.getViewport().getScreenHeight());
 | 
			
		||||
			//END
 | 
			
		||||
			normalBuffer.end();
 | 
			
		||||
			//END STAGE BATCH
 | 
			
		||||
			
 | 
			
		||||
			//BEGINNING NORMAL SCREEN RENDER
 | 
			
		||||
			screenViewport.apply();
 | 
			
		||||
			//Begin light filtering
 | 
			
		||||
			lightFilterBuffer.begin();
 | 
			
		||||
			Gdx.gl.glClearColor(0f, 0f, 0f, 0f);
 | 
			
		||||
			Gdx.gl.glClearColor(0f, 0f, 0f, 1f);
 | 
			
		||||
			Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
 | 
			
		||||
			gameArea.getBatch().setShader(brightFilterShader);
 | 
			
		||||
			gameArea.getBatch().begin(); //BATCH STARTS HERE
 | 
			
		||||
			gameArea.getRoot().draw(gameArea.getBatch(), 1f);
 | 
			
		||||
			gameArea.getBatch().flush();
 | 
			
		||||
			lightFilterBuffer.end(
 | 
			
		||||
					gameArea.getViewport().getScreenX(), 
 | 
			
		||||
					gameArea.getViewport().getScreenY(), 
 | 
			
		||||
					gameArea.getViewport().getScreenWidth(), 
 | 
			
		||||
					gameArea.getViewport().getScreenHeight());
 | 
			
		||||
			fboRegion.setTexture(normalBuffer.getColorBufferTexture());
 | 
			
		||||
			batch.setShader(brightFilterShader);
 | 
			
		||||
			batch.begin(); //BATCH STARTS HERE
 | 
			
		||||
			batch.draw(fboRegion, 0, 0, gameArea.getWidth(), gameArea.getHeight());
 | 
			
		||||
			batch.flush();
 | 
			
		||||
			lightFilterBuffer.end();
 | 
			
		||||
			
 | 
			
		||||
			//Horizontal gaussian blur
 | 
			
		||||
			hBlur.begin();
 | 
			
		||||
			fboRegion.setRegion(lightFilterBuffer.getColorBufferTexture());
 | 
			
		||||
			gameArea.getBatch().setShader(gaussianBlurShader);
 | 
			
		||||
			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);
 | 
			
		||||
			gameArea.getBatch().draw(fboRegion, 0f, 0f, RhythmBullet.GAME_AREA_WIDTH, RhythmBullet.GAME_AREA_HEIGHT);
 | 
			
		||||
			gameArea.getBatch().flush();
 | 
			
		||||
			hBlur.end(
 | 
			
		||||
					gameArea.getViewport().getScreenX(), 
 | 
			
		||||
					gameArea.getViewport().getScreenY(), 
 | 
			
		||||
					gameArea.getViewport().getScreenWidth(), 
 | 
			
		||||
					gameArea.getViewport().getScreenHeight());
 | 
			
		||||
			batch.draw(fboRegion, 0f, 0f, gameArea.getWidth(), gameArea.getHeight());
 | 
			
		||||
			batch.flush();
 | 
			
		||||
			hBlur.end();
 | 
			
		||||
			
 | 
			
		||||
			//Vertical gaussian blur
 | 
			
		||||
			vBlur.begin();
 | 
			
		||||
			fboRegion.setRegion(hBlur.getColorBufferTexture());
 | 
			
		||||
			gameArea.getBatch().setShader(gaussianBlurShader);
 | 
			
		||||
			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);
 | 
			
		||||
			gameArea.getBatch().draw(fboRegion, 0f, 0f, RhythmBullet.GAME_AREA_WIDTH, RhythmBullet.GAME_AREA_HEIGHT);
 | 
			
		||||
			gameArea.getBatch().flush();
 | 
			
		||||
			vBlur.end(
 | 
			
		||||
					gameArea.getViewport().getScreenX(), 
 | 
			
		||||
					gameArea.getViewport().getScreenY(), 
 | 
			
		||||
					gameArea.getViewport().getScreenWidth(), 
 | 
			
		||||
					gameArea.getViewport().getScreenHeight());
 | 
			
		||||
			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.setRegion(vBlur.getColorBufferTexture());
 | 
			
		||||
				gameArea.getBatch().setShader(gaussianBlurShader);
 | 
			
		||||
				fboRegion.setTexture(vBlur.getColorBufferTexture());
 | 
			
		||||
				batch.setShader(gaussianBlurShader);
 | 
			
		||||
				gaussianBlurShader.setUniformi("horizontal", 1);
 | 
			
		||||
				gameArea.getBatch().draw(fboRegion, 0f, 0f, RhythmBullet.GAME_AREA_WIDTH, RhythmBullet.GAME_AREA_HEIGHT);
 | 
			
		||||
				gameArea.getBatch().flush();
 | 
			
		||||
				hBlur.end(
 | 
			
		||||
						gameArea.getViewport().getScreenX(), 
 | 
			
		||||
						gameArea.getViewport().getScreenY(), 
 | 
			
		||||
						gameArea.getViewport().getScreenWidth(), 
 | 
			
		||||
						gameArea.getViewport().getScreenHeight());
 | 
			
		||||
				batch.draw(fboRegion, 0f, 0f, gameArea.getWidth(), gameArea.getHeight());
 | 
			
		||||
				batch.flush();
 | 
			
		||||
				hBlur.end();
 | 
			
		||||
				
 | 
			
		||||
				//Vertical gaussian blur
 | 
			
		||||
				vBlur.begin();
 | 
			
		||||
				fboRegion.setRegion(hBlur.getColorBufferTexture());
 | 
			
		||||
				gameArea.getBatch().setShader(gaussianBlurShader);
 | 
			
		||||
				fboRegion.setTexture(hBlur.getColorBufferTexture());
 | 
			
		||||
				batch.setShader(gaussianBlurShader);
 | 
			
		||||
				gaussianBlurShader.setUniformi("horizontal", 0);
 | 
			
		||||
				gameArea.getBatch().draw(fboRegion, 0f, 0f, RhythmBullet.GAME_AREA_WIDTH, RhythmBullet.GAME_AREA_HEIGHT);
 | 
			
		||||
				gameArea.getBatch().flush();
 | 
			
		||||
				vBlur.end(
 | 
			
		||||
						gameArea.getViewport().getScreenX(), 
 | 
			
		||||
						gameArea.getViewport().getScreenY(), 
 | 
			
		||||
						gameArea.getViewport().getScreenWidth(), 
 | 
			
		||||
						gameArea.getViewport().getScreenHeight());
 | 
			
		||||
				batch.draw(fboRegion, 0f, 0f, gameArea.getWidth(), gameArea.getHeight());
 | 
			
		||||
				batch.flush();
 | 
			
		||||
				vBlur.end();
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			//Draw everything to screen
 | 
			
		||||
			gameArea.getBatch().setShader(combineShader);
 | 
			
		||||
			fboRegion.setRegion(normalBuffer.getColorBufferTexture());
 | 
			
		||||
			fboRegion.flip(false, true);
 | 
			
		||||
			gameArea.getBatch().draw(fboRegion, 0f, 0f, RhythmBullet.GAME_AREA_WIDTH, RhythmBullet.GAME_AREA_HEIGHT);
 | 
			
		||||
			gameArea.getBatch().setShader(null);
 | 
			
		||||
			gameArea.getBatch().end(); //BATCH ENDS HERE
 | 
			
		||||
			//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);
 | 
			
		||||
			fboRegion.setTexture(normalBuffer.getColorBufferTexture());
 | 
			
		||||
			batch.draw(fboRegion, 0f, 0f, gameArea.getWidth(), gameArea.getHeight());
 | 
			
		||||
			batch.setShader(null);
 | 
			
		||||
			batch.end(); //STAGE BATCH ENDS HERE
 | 
			
		||||
 | 
			
		||||
		} else {
 | 
			
		||||
			gameArea.draw();
 | 
			
		||||
		}
 | 
			
		||||
 
 | 
			
		||||
@@ -4,8 +4,9 @@ import com.badlogic.gdx.Gdx;
 | 
			
		||||
import com.badlogic.gdx.Input.Keys;
 | 
			
		||||
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.g2d.Batch;
 | 
			
		||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
 | 
			
		||||
import com.badlogic.gdx.graphics.g2d.TextureRegion;
 | 
			
		||||
import com.badlogic.gdx.graphics.glutils.FrameBuffer;
 | 
			
		||||
import com.badlogic.gdx.graphics.glutils.ShaderProgram;
 | 
			
		||||
@@ -17,12 +18,12 @@ import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
 | 
			
		||||
import com.badlogic.gdx.utils.viewport.ScreenViewport;
 | 
			
		||||
 | 
			
		||||
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.MainPage;
 | 
			
		||||
import zero1hd.rhythmbullet.graphics.ui.pages.MoreOptionsPage;
 | 
			
		||||
import zero1hd.rhythmbullet.graphics.ui.pages.OptionsPage;
 | 
			
		||||
import zero1hd.rhythmbullet.audio.SongList;
 | 
			
		||||
import zero1hd.rhythmbullet.util.TransitionAdapter;
 | 
			
		||||
 | 
			
		||||
public class MainMenu extends ScreenAdapter implements TransitionAdapter {
 | 
			
		||||
@@ -47,8 +48,9 @@ public class MainMenu extends ScreenAdapter implements TransitionAdapter {
 | 
			
		||||
	private FrameBuffer hBlur, vBlur;
 | 
			
		||||
	private TextureRegion fboRegion;
 | 
			
		||||
	private int fboSize;
 | 
			
		||||
	
 | 
			
		||||
	private int blurlvl = 2;
 | 
			
		||||
	private Batch batch;
 | 
			
		||||
	private ScreenViewport screenViewport;
 | 
			
		||||
	
 | 
			
		||||
	public MainMenu(final RhythmBullet core) {
 | 
			
		||||
		this.core = core;
 | 
			
		||||
@@ -118,6 +120,9 @@ public class MainMenu extends ScreenAdapter implements TransitionAdapter {
 | 
			
		||||
	}
 | 
			
		||||
	public void loadShaders() {
 | 
			
		||||
		if (core.getPrefs().getBoolean("glow shader")) {
 | 
			
		||||
			batch = new SpriteBatch();
 | 
			
		||||
			screenViewport = new ScreenViewport();
 | 
			
		||||
			
 | 
			
		||||
			Gdx.app.debug("Shader", "using glow shader");
 | 
			
		||||
			brightFilterShader = new ShaderProgram(Gdx.files.internal("shaders/basic.vsh"), Gdx.files.internal("shaders/bright_filter.fsh"));
 | 
			
		||||
			if (!brightFilterShader.isCompiled()) {
 | 
			
		||||
@@ -160,7 +165,8 @@ public class MainMenu extends ScreenAdapter implements TransitionAdapter {
 | 
			
		||||
			hBlur = new FrameBuffer(Format.RGBA8888, fboSize/2, fboSize/2, false);
 | 
			
		||||
			vBlur = new FrameBuffer(Format.RGBA8888, fboSize/2, fboSize/2, false);
 | 
			
		||||
 | 
			
		||||
			fboRegion = new TextureRegion();
 | 
			
		||||
			fboRegion = new TextureRegion(normalBuffer.getColorBufferTexture());
 | 
			
		||||
			fboRegion.flip(false, true);
 | 
			
		||||
 | 
			
		||||
			combineShader.begin();
 | 
			
		||||
			combineShader.setUniformi("u_texture1", 1);
 | 
			
		||||
@@ -176,87 +182,95 @@ public class MainMenu extends ScreenAdapter implements TransitionAdapter {
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public void render(float delta) {
 | 
			
		||||
		Gdx.gl.glClearColor(0f, 0f, 0f, 1f);
 | 
			
		||||
		Gdx.gl.glClearColor(0.22f, 0f, 0f, 1f);
 | 
			
		||||
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
 | 
			
		||||
		stage.act(delta);
 | 
			
		||||
		blurlvl = 5;
 | 
			
		||||
		
 | 
			
		||||
		if (gaussianBlurShader != null) {
 | 
			
		||||
			
 | 
			
		||||
			//Begin drawing a normal version of screen
 | 
			
		||||
			stage.getViewport().apply();
 | 
			
		||||
			normalBuffer.begin();
 | 
			
		||||
			Gdx.gl.glClearColor(0.22f, 0f, 0f, 1f);
 | 
			
		||||
			Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
 | 
			
		||||
			stage.draw();
 | 
			
		||||
			normalBuffer.end();
 | 
			
		||||
			//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);
 | 
			
		||||
			stage.getBatch().setShader(brightFilterShader);
 | 
			
		||||
			stage.getBatch().begin(); //BATCH STARTS HERE
 | 
			
		||||
			stage.getRoot().draw(stage.getBatch(), 1f);
 | 
			
		||||
			stage.getBatch().flush();
 | 
			
		||||
			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();
 | 
			
		||||
			fboRegion.setRegion(lightFilterBuffer.getColorBufferTexture());
 | 
			
		||||
			stage.getBatch().setShader(gaussianBlurShader);
 | 
			
		||||
			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);
 | 
			
		||||
			stage.getBatch().draw(fboRegion, 0f, 0f, stage.getWidth(), stage.getHeight());
 | 
			
		||||
			stage.getBatch().flush();
 | 
			
		||||
			batch.draw(fboRegion, 0f, 0f, stage.getWidth(), stage.getHeight());
 | 
			
		||||
			batch.flush();
 | 
			
		||||
			hBlur.end();
 | 
			
		||||
			
 | 
			
		||||
			//Vertical gaussian blur
 | 
			
		||||
			vBlur.begin();
 | 
			
		||||
			fboRegion.setRegion(hBlur.getColorBufferTexture());
 | 
			
		||||
			stage.getBatch().setShader(gaussianBlurShader);
 | 
			
		||||
			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);
 | 
			
		||||
			stage.getBatch().draw(fboRegion, 0f, 0f, stage.getWidth(), stage.getHeight());
 | 
			
		||||
			stage.getBatch().flush();
 | 
			
		||||
			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.setRegion(vBlur.getColorBufferTexture());
 | 
			
		||||
				stage.getBatch().setShader(gaussianBlurShader);
 | 
			
		||||
				fboRegion.setTexture(vBlur.getColorBufferTexture());
 | 
			
		||||
				batch.setShader(gaussianBlurShader);
 | 
			
		||||
				gaussianBlurShader.setUniformi("horizontal", 1);
 | 
			
		||||
				stage.getBatch().draw(fboRegion, 0f, 0f, stage.getWidth(), stage.getHeight());
 | 
			
		||||
				stage.getBatch().flush();
 | 
			
		||||
				batch.draw(fboRegion, 0f, 0f, stage.getWidth(), stage.getHeight());
 | 
			
		||||
				batch.flush();
 | 
			
		||||
				hBlur.end();
 | 
			
		||||
				
 | 
			
		||||
				//Vertical gaussian blur
 | 
			
		||||
				vBlur.begin();
 | 
			
		||||
				fboRegion.setRegion(hBlur.getColorBufferTexture());
 | 
			
		||||
				stage.getBatch().setShader(gaussianBlurShader);
 | 
			
		||||
				fboRegion.setTexture(hBlur.getColorBufferTexture());
 | 
			
		||||
				batch.setShader(gaussianBlurShader);
 | 
			
		||||
				gaussianBlurShader.setUniformi("horizontal", 0);
 | 
			
		||||
				stage.getBatch().draw(fboRegion, 0f, 0f, stage.getWidth(), stage.getHeight());
 | 
			
		||||
				stage.getBatch().flush();
 | 
			
		||||
				batch.draw(fboRegion, 0f, 0f, stage.getWidth(), stage.getHeight());
 | 
			
		||||
				batch.flush();
 | 
			
		||||
				vBlur.end();
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			//Draw everything to screen
 | 
			
		||||
			stage.getBatch().setShader(combineShader);
 | 
			
		||||
			fboRegion.setRegion(normalBuffer.getColorBufferTexture());
 | 
			
		||||
			fboRegion.flip(false, true);
 | 
			
		||||
			stage.getBatch().draw(fboRegion, 0f, 0f, stage.getWidth(), stage.getHeight());
 | 
			
		||||
			stage.getBatch().setShader(null);
 | 
			
		||||
			stage.getBatch().end(); //BATCH ENDS HERE
 | 
			
		||||
			//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);
 | 
			
		||||
			fboRegion.setTexture(normalBuffer.getColorBufferTexture());
 | 
			
		||||
			batch.draw(fboRegion, 0f, 0f, stage.getWidth(), stage.getHeight());
 | 
			
		||||
			batch.setShader(null);
 | 
			
		||||
			batch.end(); //STAGE BATCH ENDS HERE
 | 
			
		||||
 | 
			
		||||
		} else {
 | 
			
		||||
			stage.draw();
 | 
			
		||||
		}
 | 
			
		||||
        
 | 
			
		||||
		if (stage.getCamera().position.x != targetPosition.x || stage.getCamera().position.y != targetPosition.y) {
 | 
			
		||||
			stage.getCamera().position.lerp(targetPosition, lerpAlpha);
 | 
			
		||||
			stage.getViewport().apply();
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		super.render(delta);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public void preTransition() {
 | 
			
		||||
		stage.clear();
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user