change all logging to the gdx system; removed unused debug outputs

This commit is contained in:
Harrison Deng 2018-01-15 18:12:07 -06:00
parent 2c9fd2ecfd
commit 7ca69899b3
10 changed files with 93 additions and 92 deletions

View File

@ -61,7 +61,6 @@ public class RhythmBullet extends Game {
@Override @Override
public void create() { public void create() {
Gdx.app.setLogLevel(Application.LOG_DEBUG); Gdx.app.setLogLevel(Application.LOG_DEBUG);
prefs = Gdx.app.getPreferences("PolyJet_Preferences"); prefs = Gdx.app.getPreferences("PolyJet_Preferences");
if (getPrefs().getBoolean("fullscreen", true)) { if (getPrefs().getBoolean("fullscreen", true)) {

View File

@ -180,9 +180,10 @@ public class BasicVisualizer extends VisualizerCore {
} }
public void addMirrorVisualizer(MirrorVisualizer mirror) { public void addMirrorVisualizer(MirrorVisualizer mirror) {
updatePositionInfo();
mirror.setup(bars, xPos, yPos, rotation); mirror.setup(bars, xPos, yPos, rotation);
mirrors.add(mirror); mirrors.add(mirror);
updatePositionInfo(); setxPos(((getWidth() - getActualWidth())/2f));
} }
public void removeMirrorVisualizer(MirrorVisualizer mirror) { public void removeMirrorVisualizer(MirrorVisualizer mirror) {
@ -218,7 +219,6 @@ public class BasicVisualizer extends VisualizerCore {
} }
public int getSpaceBetweenBars() { public int getSpaceBetweenBars() {
System.out.println(spaceBetweenBars);
return spaceBetweenBars; return spaceBetweenBars;
} }
} }

View File

@ -163,7 +163,7 @@ public class Mp3Manager implements MusicManager {
try { try {
decoder.decodeFrame(header, bitstream); decoder.decodeFrame(header, bitstream);
} catch (ArrayIndexOutOfBoundsException | DecoderException e) { } catch (ArrayIndexOutOfBoundsException | DecoderException e) {
System.out.println(e); Gdx.app.error("Shader Error", e.toString());
} }
bitstream.closeFrame(); bitstream.closeFrame();
bytesRead = sampleBuffer.reset(); bytesRead = sampleBuffer.reset();
@ -187,13 +187,11 @@ public class Mp3Manager implements MusicManager {
@Override @Override
public void pause() { public void pause() {
Gdx.app.debug("MP3Manager", "Pausing...");
playbackMusic.pause(); playbackMusic.pause();
} }
@Override @Override
public void play() { public void play() {
Gdx.app.debug("Mp3Manager", "MP3 Playing...");
playbackMusic.play(); playbackMusic.play();
} }

View File

@ -42,6 +42,12 @@ public class MusicListController extends Observable implements OnCompletionListe
} }
} }
public void pause() {
if (mm != null) {
mm.pause();
}
}
public void setMusicByIndex(int index) { public void setMusicByIndex(int index) {
this.currentPlaybackID = index; this.currentPlaybackID = index;
loadMusic(); loadMusic();

View File

@ -56,12 +56,13 @@ public class Visualizer extends Widget implements Disposable {
@Override @Override
public void act(float delta) { public void act(float delta) {
if (mm != null && mm.isFinishedLoading() && !mmSet) { if (mm != null && mm.isFinishedLoading() && !mmSet) {
Gdx.app.debug("Visualizer", "\nsample count: " + mm.getSampleCount()
+ "\nDuration in seconds: " + mm.getDuration() +
"\nSample rate: " + mm.getSampleRate());
vis.setMM(mm); vis.setMM(mm);
visRefreshRate = mm.getReadWindowSize()/mm.getSampleRate(); visRefreshRate = mm.getReadWindowSize()/mm.getSampleRate();
mmSet = true; mmSet = true;
Gdx.app.debug("Visualizer", "\nsample count: " + mm.getSampleCount()
+ "\nDuration in seconds: " + mm.getDuration() +
"\nSample rate: " + mm.getSampleRate() +
"\nRefresh rate: " + visRefreshRate);
} }
vis.update(delta); vis.update(delta);
@ -154,7 +155,6 @@ public class Visualizer extends Widget implements Disposable {
} }
int originalPos = buffer.position(); int originalPos = buffer.position();
System.out.println(visRefreshRate);
playingBuffer = ShortBuffer.allocate(buffer.capacity()); playingBuffer = ShortBuffer.allocate(buffer.capacity());
buffer.rewind(); buffer.rewind();
playingBuffer.put(buffer); playingBuffer.put(buffer);

View File

@ -53,7 +53,6 @@ public class MainPage extends Page implements Observer {
table.align(Align.center); table.align(Align.center);
table.defaults().space(10f); table.defaults().space(10f);
addActor(table); addActor(table);
playButton = new TextButton("Start!", core.getDefaultSkin()); playButton = new TextButton("Start!", core.getDefaultSkin());
playButton.addListener(new ChangeListener() { playButton.addListener(new ChangeListener() {
@Override @Override

View File

@ -162,7 +162,7 @@ public class OptionsPage extends Page {
} }
public void saveOptions(Preferences prefs) { public void saveOptions(Preferences prefs) {
Gdx.app.debug("Preferences", "Saved all basic options page values.");
prefs.putString("music dir", directoryField.getText()); prefs.putString("music dir", directoryField.getText());
Gdx.app.debug("Preferences", "Saved all basic options page values.");
} }
} }

View File

@ -24,7 +24,6 @@ public class LoadingWindow extends Window implements Disposable {
Image loading = new Image(skin, "loading"); Image loading = new Image(skin, "loading");
loading.addAction(Actions.forever(Actions.rotateBy(-360f, 2f))); loading.addAction(Actions.forever(Actions.rotateBy(-360f, 2f)));
add(loading).left(); add(loading).left();
System.out.println(loading.getHeight());
setSize(loading.getWidth()+20f, loading.getHeight()+40f); setSize(loading.getWidth()+20f, loading.getHeight()+40f);

View File

@ -98,29 +98,29 @@ public class GameScreen extends ScreenAdapter {
Gdx.app.debug("Shader", "using glow shader"); Gdx.app.debug("Shader", "using glow shader");
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()) {
System.err.println(brightFilterShader.getLog()); Gdx.app.error("Shader Error", brightFilterShader.getLog());
System.exit(0); System.exit(0);
} }
if (brightFilterShader.getLog().length() != 0) { if (brightFilterShader.getLog().length() != 0) {
System.out.println(brightFilterShader.getLog()); Gdx.app.error("Shader Error", brightFilterShader.getLog());
} }
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()) {
System.err.println(gaussianBlurShader.getLog()); Gdx.app.error("Shader Error", gaussianBlurShader.getLog());
System.exit(0); System.exit(0);
} }
if (gaussianBlurShader.getLog().length() != 0) { if (gaussianBlurShader.getLog().length() != 0) {
System.out.println(gaussianBlurShader.getLog()); Gdx.app.error("Shader Error", gaussianBlurShader.getLog());
} }
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()) {
System.err.println(combineShader.getLog()); Gdx.app.error("Shader Error", combineShader.getLog());
System.exit(0); System.exit(0);
} }
if (combineShader.getLog().length() != 0) { if (combineShader.getLog().length() != 0) {
System.out.println(combineShader.getLog()); Gdx.app.error("Shader Error", combineShader.getLog());
} }

View File

@ -131,80 +131,11 @@ public class MainMenu extends ScreenAdapter implements AdvancedResizeScreen {
} }
}); });
mlc.getMusicList().deleteObservers(); mlc.getMusicList().deleteObservers();
mlc.deleteObservers();; mlc.deleteObservers();
mlc.addObserver(musicSelectionPage); mlc.addObserver(musicSelectionPage);
mlc.addObserver(mainPage); mlc.addObserver(mainPage);
mlc.getMusicList().addObserver(mainPage); mlc.getMusicList().addObserver(mainPage);
}
public void attemptLoadShaders() {
if (core.getPrefs().getBoolean("glow shader", true)) {
if (core.getPrefs().getBoolean("enhanced glow", false)) {
blurlvl = 5;
} else {
blurlvl = 1;
}
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());
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()) {
System.err.println(brightFilterShader.getLog());
System.exit(0);
}
if (brightFilterShader.getLog().length() != 0) {
System.out.println(brightFilterShader.getLog());
}
gaussianBlurShader = new ShaderProgram(Gdx.files.internal("shaders/basic.vsh"), Gdx.files.internal("shaders/gaussian_blur.fsh"));
if (!gaussianBlurShader.isCompiled()) {
System.err.println(gaussianBlurShader.getLog());
System.exit(0);
}
if (gaussianBlurShader.getLog().length() != 0) {
System.out.println(gaussianBlurShader.getLog());
}
combineShader = new ShaderProgram(Gdx.files.internal("shaders/basic.vsh"), Gdx.files.internal("shaders/combine.fsh"));
if (!combineShader.isCompiled()) {
System.err.println(combineShader.getLog());
System.exit(0);
}
if (combineShader.getLog().length() != 0) {
System.out.println(combineShader.getLog());
}
if (Gdx.graphics.getWidth() < 1024) {
fboSize = 1024;
} else if (Gdx.graphics.getWidth() < 2048) {
fboSize = 2048;
} else {
fboSize = 4096;
}
lightFilterBuffer = new FrameBuffer(Format.RGBA8888, fboSize/2, fboSize/2, false);
normalBuffer = 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(normalBuffer.getColorBufferTexture());
fboRegion.flip(false, true);
combineShader.begin();
combineShader.setUniformi("u_texture1", 1);
combineShader.end();
vBlur.getColorBufferTexture().bind(1);
Gdx.gl.glActiveTexture(GL20.GL_TEXTURE0);
}
ShaderProgram.pedantic = false;
} }
@Override @Override
@ -333,7 +264,7 @@ public class MainMenu extends ScreenAdapter implements AdvancedResizeScreen {
} }
public void unloadShaders() { public void unloadShaders() {
try { if (core.getPrefs().getBoolean("glow shader")) {
brightFilterShader.dispose(); brightFilterShader.dispose();
combineShader.dispose(); combineShader.dispose();
gaussianBlurShader.dispose(); gaussianBlurShader.dispose();
@ -341,8 +272,6 @@ public class MainMenu extends ScreenAdapter implements AdvancedResizeScreen {
lightFilterBuffer.dispose(); lightFilterBuffer.dispose();
vBlur.dispose(); vBlur.dispose();
hBlur.dispose(); hBlur.dispose();
} catch (NullPointerException e) {
saveAll();
} }
brightFilterShader = null; brightFilterShader = null;
@ -387,4 +316,75 @@ public class MainMenu extends ScreenAdapter implements AdvancedResizeScreen {
public OptionsPage getOptionsPage() { public OptionsPage getOptionsPage() {
return optionsPage; return optionsPage;
} }
public void attemptLoadShaders() {
if (core.getPrefs().getBoolean("glow shader", true)) {
if (core.getPrefs().getBoolean("enhanced glow", false)) {
blurlvl = 5;
} else {
blurlvl = 1;
}
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());
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()) {
Gdx.app.error("Shader Error", brightFilterShader.getLog());
System.exit(0);
}
if (brightFilterShader.getLog().length() != 0) {
Gdx.app.error("Shader Error", brightFilterShader.getLog());
}
gaussianBlurShader = new ShaderProgram(Gdx.files.internal("shaders/basic.vsh"), Gdx.files.internal("shaders/gaussian_blur.fsh"));
if (!gaussianBlurShader.isCompiled()) {
Gdx.app.error("Shader Error", gaussianBlurShader.getLog());
System.exit(0);
}
if (gaussianBlurShader.getLog().length() != 0) {
Gdx.app.error("Shader Error", gaussianBlurShader.getLog());
}
combineShader = new ShaderProgram(Gdx.files.internal("shaders/basic.vsh"), Gdx.files.internal("shaders/combine.fsh"));
if (!combineShader.isCompiled()) {
Gdx.app.error("Shader Error", combineShader.getLog());
System.exit(0);
}
if (combineShader.getLog().length() != 0) {
Gdx.app.error("Shader Error", combineShader.getLog());
}
if (Gdx.graphics.getWidth() < 1024) {
fboSize = 1024;
} else if (Gdx.graphics.getWidth() < 2048) {
fboSize = 2048;
} else {
fboSize = 4096;
}
lightFilterBuffer = new FrameBuffer(Format.RGBA8888, fboSize/2, fboSize/2, false);
normalBuffer = 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(normalBuffer.getColorBufferTexture());
fboRegion.flip(false, true);
combineShader.begin();
combineShader.setUniformi("u_texture1", 1);
combineShader.end();
vBlur.getColorBufferTexture().bind(1);
Gdx.gl.glActiveTexture(GL20.GL_TEXTURE0);
}
ShaderProgram.pedantic = false;
}
} }