From 3454f8041371cc12bdb588d100753a949920ee67 Mon Sep 17 00:00:00 2001 From: Recrown Date: Sat, 14 Oct 2017 00:33:24 -0500 Subject: [PATCH] minor changes to beat particle effect, added proper music directory update, added song count, visualizer better centered, other minor value changes --- android/assets/particles/beateffect.p | 8 ++--- .../zero1hd/rhythmbullet/audio/SongList.java | 16 +++++---- .../audio/visualizer/BasicVisualizer.java | 2 +- .../ui/components/ControlOptions.java | 10 ++++-- .../ui/components/GraphicsOptions.java | 2 +- .../graphics/ui/pages/KeybindOptionsPage.java | 21 ++++++++++-- .../graphics/ui/pages/OptionsPage.java | 29 ++++++++++++++-- .../graphics/ui/pages/VideoOptionsPage.java | 23 ++++++++++--- .../rhythmbullet/screens/MainMenu.java | 34 +++++++++++-------- 9 files changed, 107 insertions(+), 38 deletions(-) diff --git a/android/assets/particles/beateffect.p b/android/assets/particles/beateffect.p index fe137d2..a6494c1 100755 --- a/android/assets/particles/beateffect.p +++ b/android/assets/particles/beateffect.p @@ -9,17 +9,17 @@ min: 0 max: 50 - Emission - lowMin: 0.0 -lowMax: 0.0 -highMin: 45.0 +lowMax: 3.0 +highMin: 50.0 highMax: 60.0 relative: false scalingCount: 3 scaling0: 1.0 -scaling1: 0.0 +scaling1: 0.09803922 scaling2: 0.0 timelineCount: 3 timeline0: 0.0 -timeline1: 0.36301368 +timeline1: 0.30821916 timeline2: 1.0 - Life - lowMin: 0.0 diff --git a/core/src/zero1hd/rhythmbullet/audio/SongList.java b/core/src/zero1hd/rhythmbullet/audio/SongList.java index 7b4e7c4..469ac20 100755 --- a/core/src/zero1hd/rhythmbullet/audio/SongList.java +++ b/core/src/zero1hd/rhythmbullet/audio/SongList.java @@ -14,12 +14,16 @@ public class SongList { public void refresh() { searched = true; - songList.addAll(Gdx.files.absolute(searchPath).list((dir, name) -> { - if (name.endsWith("mp3") || name.endsWith("wav")) { - return true; - } - return false; - })); + songList.clear(); + Gdx.app.debug("SongController", "Searching path: " + searchPath); + if (Gdx.files.absolute(searchPath).exists() && Gdx.files.absolute(searchPath).isDirectory()) { + songList.addAll(Gdx.files.absolute(searchPath).list((dir, name) -> { + if (name.endsWith("mp3") || name.endsWith("wav")) { + return true; + } + return false; + })); + } } public void setSearchPath(String searchPath) { diff --git a/core/src/zero1hd/rhythmbullet/audio/visualizer/BasicVisualizer.java b/core/src/zero1hd/rhythmbullet/audio/visualizer/BasicVisualizer.java index 7c0af99..298e868 100755 --- a/core/src/zero1hd/rhythmbullet/audio/visualizer/BasicVisualizer.java +++ b/core/src/zero1hd/rhythmbullet/audio/visualizer/BasicVisualizer.java @@ -123,7 +123,7 @@ public class BasicVisualizer extends VisualizerCore { } public void updatePositionInfo() { - barHeightMultiplier = height*0.05f; + barHeightMultiplier = height*0.032f; int barSpace = 0; angleRot.set(MathUtils.cosDeg(rotation), MathUtils.sinDeg(rotation)); diff --git a/core/src/zero1hd/rhythmbullet/graphics/ui/components/ControlOptions.java b/core/src/zero1hd/rhythmbullet/graphics/ui/components/ControlOptions.java index 56a5179..8d59386 100755 --- a/core/src/zero1hd/rhythmbullet/graphics/ui/components/ControlOptions.java +++ b/core/src/zero1hd/rhythmbullet/graphics/ui/components/ControlOptions.java @@ -2,10 +2,12 @@ package zero1hd.rhythmbullet.graphics.ui.components; import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.scenes.scene2d.Actor; +import com.badlogic.gdx.scenes.scene2d.Group; import com.badlogic.gdx.scenes.scene2d.InputEvent; import com.badlogic.gdx.scenes.scene2d.ui.Label; import com.badlogic.gdx.scenes.scene2d.ui.Skin; import com.badlogic.gdx.scenes.scene2d.ui.Table; +import com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup; import com.badlogic.gdx.scenes.scene2d.utils.ClickListener; import com.badlogic.gdx.utils.Align; import com.badlogic.gdx.utils.Array; @@ -73,8 +75,12 @@ public class ControlOptions extends Table { @Override public void clicked(InputEvent event, float x, float y) { unselect(); - getStage().setKeyboardFocus(event.getTarget()); - event.getTarget().setColor(Color.ORANGE); + if (event.getTarget() instanceof KeyBindButton) { + getStage().setKeyboardFocus(event.getTarget()); + event.getTarget().setColor(Color.ORANGE); + } else { + unselect(); + } super.clicked(event, x, y); } }); diff --git a/core/src/zero1hd/rhythmbullet/graphics/ui/components/GraphicsOptions.java b/core/src/zero1hd/rhythmbullet/graphics/ui/components/GraphicsOptions.java index cd75367..0ad3db3 100755 --- a/core/src/zero1hd/rhythmbullet/graphics/ui/components/GraphicsOptions.java +++ b/core/src/zero1hd/rhythmbullet/graphics/ui/components/GraphicsOptions.java @@ -60,7 +60,7 @@ public class GraphicsOptions extends Table { public void changed(ChangeEvent event, Actor actor) { save(); if (enhancedGlow.isChecked()) { - mainMenu.setBlurlvl(6); + mainMenu.setBlurlvl(5); } else { mainMenu.setBlurlvl(1); } diff --git a/core/src/zero1hd/rhythmbullet/graphics/ui/pages/KeybindOptionsPage.java b/core/src/zero1hd/rhythmbullet/graphics/ui/pages/KeybindOptionsPage.java index 8e6c810..15801a5 100755 --- a/core/src/zero1hd/rhythmbullet/graphics/ui/pages/KeybindOptionsPage.java +++ b/core/src/zero1hd/rhythmbullet/graphics/ui/pages/KeybindOptionsPage.java @@ -1,7 +1,11 @@ package zero1hd.rhythmbullet.graphics.ui.pages; import com.badlogic.gdx.assets.AssetManager; +import com.badlogic.gdx.math.Vector3; +import com.badlogic.gdx.scenes.scene2d.Actor; import com.badlogic.gdx.scenes.scene2d.ui.Skin; +import com.badlogic.gdx.scenes.scene2d.ui.TextButton; +import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener; import zero1hd.rhythmbullet.controls.KeyMap; import zero1hd.rhythmbullet.graphics.ui.components.ControlOptions; @@ -9,12 +13,25 @@ import zero1hd.rhythmbullet.graphics.ui.components.ControlOptions; public class KeybindOptionsPage extends Page { private ControlOptions controlTable; private KeyMap keyMap; - - public KeybindOptionsPage(Skin skin, AssetManager assets) { + private TextButton backButton; + public KeybindOptionsPage(Skin skin, AssetManager assets, Vector3 cameraPosition) { keyMap = new KeyMap(assets); controlTable = new ControlOptions(skin, keyMap); addActor(controlTable); + + backButton = new TextButton("Back", skin); + backButton.setPosition(10, getHeight() - 10 - backButton.getHeight()); + backButton.setWidth(backButton.getWidth() + 20); + backButton.addListener(new ChangeListener() { + + @Override + public void changed(ChangeEvent event, Actor actor) { + cameraPosition.y = 0.5f*getHeight(); + } + }); + + addActor(backButton); } public void unselect() { diff --git a/core/src/zero1hd/rhythmbullet/graphics/ui/pages/OptionsPage.java b/core/src/zero1hd/rhythmbullet/graphics/ui/pages/OptionsPage.java index 068ff83..ad19e0a 100755 --- a/core/src/zero1hd/rhythmbullet/graphics/ui/pages/OptionsPage.java +++ b/core/src/zero1hd/rhythmbullet/graphics/ui/pages/OptionsPage.java @@ -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.scenes.scene2d.utils.ChangeListener.ChangeEvent; import com.badlogic.gdx.utils.Align; import zero1hd.rhythmbullet.RhythmBullet; @@ -28,6 +29,7 @@ public class OptionsPage extends Page { private ProgressBar fxVolSlider; private TextField directoryField; + private float musicSearchTimer; public OptionsPage(RhythmBullet core, Vector3 targetPosition, KeybindOptionsPage moreOptionsPage, SongListController sc) { super("General", core.getDefaultSkin()); @@ -41,10 +43,11 @@ public class OptionsPage extends Page { }); backButton.setPosition(10, getHeightBelowTitle() + 5); addActor(backButton); + backButton.setWidth(backButton.getWidth() + 20); addSpaceToTitle(backButton.getWidth() + backButton.getX() + 20); optionsTable.align(Align.center); - optionsTable.defaults().space(10f).expandY().padBottom(25f); + optionsTable.defaults().space(10f).padBottom(25f).expandY(); optionsTable.setPosition(0, 0); optionsTable.setSize(getWidth(), getHeightBelowTitle() - 5); addActor(optionsTable); @@ -88,9 +91,31 @@ public class OptionsPage extends Page { Label musicDirectoryLabel = new Label("Music Directory: ", core.getDefaultSkin()); optionsTable.add(musicDirectoryLabel).left(); - directoryField = new TextField(null, core.getDefaultSkin()); + Label songCount = new Label(": " + sc.getSongList().getAmountOfSongs(), core.getDefaultSkin(), "sub-font", core.getDefaultSkin().getColor("default")); + directoryField = new TextField(null, core.getDefaultSkin() ) { + @Override + public void act(float delta) { + if (musicSearchTimer > 0) { + musicSearchTimer -= delta; + if (musicSearchTimer <= 0) { + sc.getSongList().setSearchPath(directoryField.getText()); + sc.getSongList().refresh(); + songCount.setText(": " + sc.getSongList().getAmountOfSongs()); + } + } + super.act(delta); + } + }; directoryField.setText(core.getPrefs().getString("music dir", System.getProperty("user.home")+System.getProperty("file.separator")+"Music")); + directoryField.addListener(new ChangeListener() { + @Override + public void changed(ChangeEvent event, Actor actor) { + musicSearchTimer = 2; + songCount.setText("..."); + } + }); optionsTable.add(directoryField).fillX(); + optionsTable.add(songCount); optionsTable.row(); diff --git a/core/src/zero1hd/rhythmbullet/graphics/ui/pages/VideoOptionsPage.java b/core/src/zero1hd/rhythmbullet/graphics/ui/pages/VideoOptionsPage.java index 83eff78..bf29fcc 100755 --- a/core/src/zero1hd/rhythmbullet/graphics/ui/pages/VideoOptionsPage.java +++ b/core/src/zero1hd/rhythmbullet/graphics/ui/pages/VideoOptionsPage.java @@ -1,14 +1,12 @@ package zero1hd.rhythmbullet.graphics.ui.pages; import com.badlogic.gdx.Preferences; -import com.badlogic.gdx.graphics.Color; -import com.badlogic.gdx.graphics.Pixmap; -import com.badlogic.gdx.graphics.Pixmap.Format; -import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.g2d.Batch; -import com.badlogic.gdx.scenes.scene2d.ui.Image; +import com.badlogic.gdx.scenes.scene2d.Actor; import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane; import com.badlogic.gdx.scenes.scene2d.ui.Skin; +import com.badlogic.gdx.scenes.scene2d.ui.TextButton; +import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener; import zero1hd.rhythmbullet.graphics.ui.components.GraphicsOptions; import zero1hd.rhythmbullet.screens.MainMenu; @@ -16,12 +14,27 @@ import zero1hd.rhythmbullet.screens.MainMenu; public class VideoOptionsPage extends Page { private ScrollPane scrollPane; private GraphicsOptions graphicsTable; + private TextButton backButton; + public VideoOptionsPage(Skin skin, Preferences prefs, MainMenu menu) { graphicsTable = new GraphicsOptions(menu, skin, prefs); scrollPane = new ScrollPane(graphicsTable, skin); scrollPane.setFadeScrollBars(false); scrollPane.setFillParent(true); addActor(scrollPane); + + backButton = new TextButton("Back", skin); + backButton.setPosition(10, getHeight() - 10 - backButton.getHeight()); + backButton.setWidth(backButton.getWidth() + 20); + backButton.addListener(new ChangeListener() { + + @Override + public void changed(ChangeEvent event, Actor actor) { + menu.getCameraPosition().y = 0.5f*getHeight(); + } + }); + + addActor(backButton); } @Override diff --git a/core/src/zero1hd/rhythmbullet/screens/MainMenu.java b/core/src/zero1hd/rhythmbullet/screens/MainMenu.java index 9addc6f..1e7e9f3 100755 --- a/core/src/zero1hd/rhythmbullet/screens/MainMenu.java +++ b/core/src/zero1hd/rhythmbullet/screens/MainMenu.java @@ -30,7 +30,7 @@ import zero1hd.rhythmbullet.util.TransitionAdapter; public class MainMenu extends ScreenAdapter implements TransitionAdapter { public Stage stage; - private Vector3 targetPosition; + private Vector3 cameraPosition; private MainPage mainPage; private OptionsPage optionsPage; @@ -57,7 +57,7 @@ public class MainMenu extends ScreenAdapter implements TransitionAdapter { public MainMenu(RhythmBullet core) { this.core = core; stage = new Stage(new ScreenViewport()); - targetPosition = new Vector3(stage.getCamera().position); + cameraPosition = new Vector3(stage.getCamera().position); SongList songList = new SongList(); songList.setSearchPath(core.getPrefs().getString("music dir")); @@ -74,12 +74,12 @@ public class MainMenu extends ScreenAdapter implements TransitionAdapter { public void postTransition() { loadShaders(); - mainPage = new MainPage(core, targetPosition, sc); + mainPage = new MainPage(core, cameraPosition, sc); mainPage.setPosition(0, 0); stage.addActor(mainPage); //End main menu - keybindPage = new KeybindOptionsPage(core.getDefaultSkin(), core.getAssetManager()); + keybindPage = new KeybindOptionsPage(core.getDefaultSkin(), core.getAssetManager(), cameraPosition); keybindPage.setPosition(1f*Gdx.graphics.getWidth(), -1f*Gdx.graphics.getHeight()); stage.addActor(keybindPage); @@ -88,7 +88,7 @@ public class MainMenu extends ScreenAdapter implements TransitionAdapter { graphicsPage.setPosition(1f*Gdx.graphics.getWidth(), 1f*Gdx.graphics.getHeight()); stage.addActor(graphicsPage); - optionsPage = new OptionsPage(core, targetPosition, keybindPage, sc); + optionsPage = new OptionsPage(core, cameraPosition, keybindPage, sc); optionsPage.setPosition(Gdx.graphics.getWidth(), 0); stage.addActor(optionsPage); @@ -102,9 +102,9 @@ public class MainMenu extends ScreenAdapter implements TransitionAdapter { public boolean keyUp(InputEvent event, int keycode) { if (keycode == Keys.ESCAPE) { stage.unfocusAll(); - if (targetPosition.x != 0.5f*Gdx.graphics.getWidth() || targetPosition.y != 0.5f*Gdx.graphics.getHeight()) { - targetPosition.x = 0.5f*Gdx.graphics.getWidth(); - targetPosition.y = 0.5f*Gdx.graphics.getHeight(); + if (cameraPosition.x != 0.5f*Gdx.graphics.getWidth() || cameraPosition.y != 0.5f*Gdx.graphics.getHeight()) { + cameraPosition.x = 0.5f*Gdx.graphics.getWidth(); + cameraPosition.y = 0.5f*Gdx.graphics.getHeight(); } keybindPage.unselect(); } @@ -128,7 +128,7 @@ public class MainMenu extends ScreenAdapter implements TransitionAdapter { public void loadShaders() { if (core.getPrefs().getBoolean("glow shader")) { if (core.getPrefs().getBoolean("enhanced glow", false)) { - blurlvl = 6; + blurlvl = 5; } else { blurlvl = 1; } @@ -197,14 +197,14 @@ public class MainMenu extends ScreenAdapter implements TransitionAdapter { @Override public void render(float delta) { - Gdx.gl.glClearColor(0.22f, 0f, 0f, 1f); + Gdx.gl.glClearColor(0.2f, 0f, 0f, 1f); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); stage.act(delta); if (blurlvl > 0) { //Begin drawing a normal version of screen normalBuffer.begin(); stage.getViewport().apply(); - Gdx.gl.glClearColor(0.22f, 0f, 0f, 1f); + Gdx.gl.glClearColor(0.2f, 0f, 0f, 1f); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); stage.draw(); normalBuffer.end(); @@ -260,8 +260,8 @@ public class MainMenu extends ScreenAdapter implements TransitionAdapter { stage.draw(); } - if (stage.getCamera().position.x != targetPosition.x || stage.getCamera().position.y != targetPosition.y) { - stage.getCamera().position.lerp(targetPosition, lerpAlpha); + if (stage.getCamera().position.x != cameraPosition.x || stage.getCamera().position.y != cameraPosition.y) { + stage.getCamera().position.lerp(cameraPosition, lerpAlpha); stage.getViewport().apply(); } @@ -300,8 +300,8 @@ public class MainMenu extends ScreenAdapter implements TransitionAdapter { @Override public void resize(int width, int height) { stage.getViewport().update(width, height, false); - targetPosition.x = width/2; - targetPosition.y = height/2; + cameraPosition.x = width/2; + cameraPosition.y = height/2; calcLerpAlpha(width); super.resize(width, height); } @@ -344,4 +344,8 @@ public class MainMenu extends ScreenAdapter implements TransitionAdapter { public void setBlurlvl(int blurlvl) { this.blurlvl = blurlvl; } + + public Vector3 getCameraPosition() { + return cameraPosition; + } }