From 4c329e8d8f65cac8ea0f3ab05d88b2aabf9d6bc2 Mon Sep 17 00:00:00 2001 From: Recrown Date: Sun, 8 Oct 2017 01:41:25 -0500 Subject: [PATCH] added particles and improved main menu aesthetically --- android/assets/particles/beateffect.p | 159 ++++++++++++++++++ android/assets/particles/triangle.png | Bin 0 -> 929 bytes .../zero1hd/rhythmbullet/RhythmBullet.java | 1 + .../audio/visualizer/BasicVisualizer.java | 28 ++- .../audio/visualizer/MirrorVisualizer.java | 6 + .../audio/visualizer/VisualizerCore.java | 2 +- .../graphics/meshes/TitleBarMesh.java | 112 ------------ .../{SetControls.java => ControlOptions.java} | 20 +-- ...raphicsTable.java => GraphicsOptions.java} | 22 +-- .../{KeySetter.java => KeyBindButton.java} | 4 +- ...utionButton.java => ResolutionButton.java} | 4 +- .../ui/components/TitleBarVisualizer.java | 52 +++++- .../graphics/ui/components/Visualizer.java | 1 + .../graphics/ui/pages/MainPage.java | 2 +- .../graphics/ui/pages/MoreOptionsPage.java | 14 +- 15 files changed, 272 insertions(+), 155 deletions(-) create mode 100755 android/assets/particles/beateffect.p create mode 100755 android/assets/particles/triangle.png delete mode 100755 core/src/zero1hd/rhythmbullet/graphics/meshes/TitleBarMesh.java rename core/src/zero1hd/rhythmbullet/graphics/ui/components/{SetControls.java => ControlOptions.java} (76%) rename core/src/zero1hd/rhythmbullet/graphics/ui/components/{GraphicsTable.java => GraphicsOptions.java} (75%) rename core/src/zero1hd/rhythmbullet/graphics/ui/components/{KeySetter.java => KeyBindButton.java} (94%) rename core/src/zero1hd/rhythmbullet/graphics/ui/components/{SetResolutionButton.java => ResolutionButton.java} (82%) diff --git a/android/assets/particles/beateffect.p b/android/assets/particles/beateffect.p new file mode 100755 index 0000000..6678577 --- /dev/null +++ b/android/assets/particles/beateffect.p @@ -0,0 +1,159 @@ +beat +- Delay - +active: false +- Duration - +lowMin: 300.0 +lowMax: 300.0 +- Count - +min: 0 +max: 50 +- Emission - +lowMin: 0.0 +lowMax: 0.0 +highMin: 45.0 +highMax: 70.0 +relative: false +scalingCount: 3 +scaling0: 1.0 +scaling1: 0.0 +scaling2: 0.0 +timelineCount: 3 +timeline0: 0.0 +timeline1: 0.36301368 +timeline2: 1.0 +- Life - +lowMin: 0.0 +lowMax: 0.0 +highMin: 750.0 +highMax: 1500.0 +relative: false +scalingCount: 2 +scaling0: 1.0 +scaling1: 1.0 +timelineCount: 2 +timeline0: 0.0 +timeline1: 1.0 +- Life Offset - +active: false +- X Offset - +active: false +- Y Offset - +active: false +- Spawn Shape - +shape: line +- Spawn Width - +lowMin: 0.0 +lowMax: 0.0 +highMin: 64.0 +highMax: 64.0 +relative: false +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Spawn Height - +lowMin: 0.0 +lowMax: 0.0 +highMin: 0.0 +highMax: 0.0 +relative: false +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Scale - +lowMin: 0.0 +lowMax: 0.0 +highMin: 1.0 +highMax: 1.0 +relative: false +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Velocity - +active: true +lowMin: 0.0 +lowMax: 0.0 +highMin: 15.0 +highMax: 30.0 +relative: false +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Angle - +active: true +lowMin: 90.0 +lowMax: 90.0 +highMin: 45.0 +highMax: 135.0 +relative: false +scalingCount: 3 +scaling0: 1.0 +scaling1: 0.0 +scaling2: 0.0 +timelineCount: 3 +timeline0: 0.0 +timeline1: 0.5 +timeline2: 1.0 +- Rotation - +active: true +lowMin: 0.0 +lowMax: 0.0 +highMin: 0.0 +highMax: 360.0 +relative: false +scalingCount: 2 +scaling0: 0.0 +scaling1: 1.0 +timelineCount: 2 +timeline0: 0.0 +timeline1: 1.0 +- Wind - +active: true +lowMin: 0.0 +lowMax: 0.0 +highMin: 0.0 +highMax: 0.0 +relative: false +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Gravity - +active: false +- Tint - +colorsCount: 3 +colors0: 0.7411765 +colors1: 0.20392157 +colors2: 0.0 +timelineCount: 1 +timeline0: 0.0 +- Transparency - +lowMin: 0.0 +lowMax: 0.0 +highMin: 1.0 +highMax: 1.0 +relative: false +scalingCount: 5 +scaling0: 0.21052632 +scaling1: 0.5263158 +scaling2: 0.54385966 +scaling3: 0.45614034 +scaling4: 0.0 +timelineCount: 5 +timeline0: 0.0 +timeline1: 0.38356164 +timeline2: 0.67808217 +timeline3: 0.7671233 +timeline4: 1.0 +- Options - +attached: false +continuous: false +aligned: false +additive: true +behind: false +premultipliedAlpha: false +- Image Path - +triangle.png diff --git a/android/assets/particles/triangle.png b/android/assets/particles/triangle.png new file mode 100755 index 0000000000000000000000000000000000000000..ab997c010c682998365954acbefc6161a7a125f7 GIT binary patch literal 929 zcmV;S177@zP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D02y>eSaefwW^{L9 za%BK;VQFr3E^cLXAT%y8E-^PVZl7ZS00R+8L_t(&L(SO1t4v`S$ML(cu&}VO@CR5} zT3T9KT3A|GSXf&418gO+P)bRXC}Jg9NQxARP>Pc7f@DDRj4d1mIFr}w>c?|IHz(=@BH+0?4A#R@jb?e?d8eiU1*V4skK;+`MH7Atrr`| zcbjI{zYF0s-21cGVu7%PQ|U0%oa19 z67p1B!{Lz-e)ruv$!syhR{17`W?Zv@Q{Xf>6;8*km&6t`924?FT%+@z2;p?xdP!_C z(H8k4FW;^Lm%5ZBa@D?&J}>{-$l2OJQ>2fBt*y%)lF z!+lOKTO1Ih)Gcw%q~eqar5u7Of_gd`8ZwrIpC#po2HR4trZ48Tbv znJpUg18Z$r1F$X5*(t=0Qnhe;F#vNL!u2s_i*x!0*4mN>U|Z~nft8E*Rqb+Mw>eF+ zbO5%+ju@r5cy}LETMWRL#Pu^_i>;J_wYH=I*cMy-;U~|+@2sa18}$L z{X#xSjZvzWcR~)!Lenv@Zq!T%;Al7o){P#0=bE*@oOlh}AR%`~00000NkvXXu0mjf DJE*N0 literal 0 HcmV?d00001 diff --git a/core/src/zero1hd/rhythmbullet/RhythmBullet.java b/core/src/zero1hd/rhythmbullet/RhythmBullet.java index ee8e669..4acd9d3 100755 --- a/core/src/zero1hd/rhythmbullet/RhythmBullet.java +++ b/core/src/zero1hd/rhythmbullet/RhythmBullet.java @@ -180,6 +180,7 @@ public class RhythmBullet extends Game { assetManager.load("explosion.ogg", Sound.class); assetManager.load("disintegrate.ogg", Sound.class); assetManager.load("explosion-s.p", ParticleEffect.class); + assetManager.load("beateffect.p", ParticleEffect.class); assetManager.load("tpSelector.png", Texture.class); assetManager.load("magic1.png", Texture.class); } diff --git a/core/src/zero1hd/rhythmbullet/audio/visualizer/BasicVisualizer.java b/core/src/zero1hd/rhythmbullet/audio/visualizer/BasicVisualizer.java index 46326ba..16cc847 100755 --- a/core/src/zero1hd/rhythmbullet/audio/visualizer/BasicVisualizer.java +++ b/core/src/zero1hd/rhythmbullet/audio/visualizer/BasicVisualizer.java @@ -29,6 +29,8 @@ public class BasicVisualizer extends VisualizerCore { private boolean flip; private Array mirrors; private boolean reverse; + private float maxAvgHeight; + private float currentAvg; public BasicVisualizer() { super(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()/2, 0, 0); @@ -66,7 +68,6 @@ public class BasicVisualizer extends VisualizerCore { } public void modify(float delta) { - //Averaging bins together for (int i = 0; i < barCount; i++) { @@ -78,6 +79,7 @@ public class BasicVisualizer extends VisualizerCore { barHeight *= barHeightMultiplier; barHeights[i] = barHeight; } + currentAvg = 0; for (int i = 0; i < barCount; i++) { int avg = 0; //Averaging the bars @@ -91,21 +93,28 @@ public class BasicVisualizer extends VisualizerCore { } avg /= smoothRange*2; barHeights[i] = avg; - + currentAvg += barHeights[i]; if (bars[i].getHeight() > barHeights[i]) { bars[i].setSize(barWidth, bars[i].getHeight() - (20f*delta*(bars[i].getHeight()-barHeights[i]))); } else { bars[i].setSize(barWidth, bars[i].getHeight() + (27f*delta*(barHeights[i] - bars[i].getHeight()))); } } + currentAvg /= barHeights.length; + if (currentAvg > maxAvgHeight) { + maxAvgHeight = currentAvg; + } } @Override public void setMM(MusicManager mm) { super.setMM(mm); + maxAvgHeight = 0; + currentAvg = 0; float validBins = (5000/((mm.getSampleRate()/2)/((audioPCM.length/2)+1))); Gdx.app.debug("Visualizer", "valid frequency bins " + validBins); binsPerBar = MathUtils.round((validBins/barCount)); + barHeights = new float[barCount]; } @Override @@ -153,6 +162,9 @@ public class BasicVisualizer extends VisualizerCore { for (int i = 0; i < bars.length; i++) { bars[i].setColor(r, g, b, a); } + for (int i = 0; i < mirrors.size; i++) { + mirrors.get(i).setColor(r, g, b, a); + } } public void setRotation(float rotation) { @@ -191,4 +203,16 @@ public class BasicVisualizer extends VisualizerCore { public boolean isReversed() { return reverse; } + + public Sprite[] getBars() { + return bars; + } + + public float getCurrentAvg() { + return currentAvg; + } + + public float getMaxAvgHeight() { + return maxAvgHeight; + } } diff --git a/core/src/zero1hd/rhythmbullet/audio/visualizer/MirrorVisualizer.java b/core/src/zero1hd/rhythmbullet/audio/visualizer/MirrorVisualizer.java index b1f5cf9..6b6d1fd 100755 --- a/core/src/zero1hd/rhythmbullet/audio/visualizer/MirrorVisualizer.java +++ b/core/src/zero1hd/rhythmbullet/audio/visualizer/MirrorVisualizer.java @@ -54,6 +54,12 @@ public class MirrorVisualizer { } } + public void setColor(float r, float g, float b, float a) { + for (int i = 0; i < bars.length; i++) { + bars[i].setColor(r, g, b, a); + } + } + public float getRotation() { return rotation; } diff --git a/core/src/zero1hd/rhythmbullet/audio/visualizer/VisualizerCore.java b/core/src/zero1hd/rhythmbullet/audio/visualizer/VisualizerCore.java index 688ce91..dc822be 100755 --- a/core/src/zero1hd/rhythmbullet/audio/visualizer/VisualizerCore.java +++ b/core/src/zero1hd/rhythmbullet/audio/visualizer/VisualizerCore.java @@ -43,8 +43,8 @@ public class VisualizerCore implements Disposable { if (audioPCM == null || audioPCM.length != mm.getReadWindowSize()) { calc = false; fft = new FloatFFT_1D(mm.getReadWindowSize()); - audioPCM = new float[mm.getReadWindowSize()]; } + audioPCM = new float[mm.getReadWindowSize()]; this.mm = mm; calc = true; lock.unlock(); diff --git a/core/src/zero1hd/rhythmbullet/graphics/meshes/TitleBarMesh.java b/core/src/zero1hd/rhythmbullet/graphics/meshes/TitleBarMesh.java deleted file mode 100755 index 4884590..0000000 --- a/core/src/zero1hd/rhythmbullet/graphics/meshes/TitleBarMesh.java +++ /dev/null @@ -1,112 +0,0 @@ -package zero1hd.rhythmbullet.graphics.meshes; - -import com.badlogic.gdx.Gdx; -import com.badlogic.gdx.graphics.Color; -import com.badlogic.gdx.graphics.GL20; -import com.badlogic.gdx.graphics.Mesh; -import com.badlogic.gdx.graphics.OrthographicCamera; -import com.badlogic.gdx.graphics.VertexAttribute; -import com.badlogic.gdx.graphics.VertexAttributes.Usage; -import com.badlogic.gdx.graphics.glutils.ShaderProgram; -import com.badlogic.gdx.utils.Disposable; - -public class TitleBarMesh implements Disposable { - private Mesh mesh; - private OrthographicCamera cam; - private ShaderProgram shader; - private Color color; - private int height; - - public final int POSITION_VARS = 2; - public final int COLOR_VARS = 1; //Packed color data - public final int TOTAL_VARS = POSITION_VARS + COLOR_VARS; - public final int MAX_POLY = 1; - public final int MAX_VERTS = 4 * MAX_POLY; - - private float[] verts = new float[MAX_VERTS * TOTAL_VARS]; - -@Deprecated - public TitleBarMesh() { - shader = new ShaderProgram(Gdx.files.internal("shaders/mesh.vsh"), Gdx.files.internal("shaders/mesh.fsh")); - mesh = new Mesh(true, MAX_VERTS, 0, new VertexAttribute(Usage.Position, POSITION_VARS, "a_position"), - //still expects 4 color components - new VertexAttribute(Usage.ColorPacked, 4, "a_color")); - - color = new Color(Color.WHITE); - } - - public void setCam(OrthographicCamera cam) { - this.cam = cam; - } - - public void setColor(Color color) { - this.color = color; - } - - public void setHeight(int height) { - this.height = height; - } - - public int getHeight() { - return height; - } - - public Color getColor() { - return color; - } - - private int idx = 0; - - public void draw() { - if (idx == verts.length) { - flush(); - } - - float c = color.toFloatBits(); - - verts[idx++] = 0; - verts[idx++] = height; - verts[idx++] = c; - - verts[idx++] = Gdx.graphics.getWidth(); - verts[idx++] = Gdx.graphics.getHeight(); - verts[idx++] = c; - - verts[idx++] = Gdx.graphics.getWidth(); - verts[idx++] = Gdx.graphics.getHeight() - height; - verts[idx++] = c; - - verts[idx++] = 0; - verts[idx++] = 0; - verts[idx++] = c; - } - - public void flush() { - if (idx != 0) { - mesh.setVertices(verts); - - Gdx.gl.glDepthMask(false); - Gdx.gl.glEnable(GL20.GL_BLEND); - Gdx.gl.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA); - - int vertCount = idx/TOTAL_VARS; - - cam.setToOrtho(false, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); - - shader.begin(); - shader.setUniformMatrix("u_projTrans", cam.combined); - mesh.render(shader, GL20.GL_TRIANGLE_FAN, 0, vertCount); - shader.end(); - - Gdx.gl.glDepthMask(true); - - idx = 0; - } - } - - @Override - public void dispose() { - mesh.dispose(); - shader.dispose(); - } -} diff --git a/core/src/zero1hd/rhythmbullet/graphics/ui/components/SetControls.java b/core/src/zero1hd/rhythmbullet/graphics/ui/components/ControlOptions.java similarity index 76% rename from core/src/zero1hd/rhythmbullet/graphics/ui/components/SetControls.java rename to core/src/zero1hd/rhythmbullet/graphics/ui/components/ControlOptions.java index 94a5789..33e9c3e 100755 --- a/core/src/zero1hd/rhythmbullet/graphics/ui/components/SetControls.java +++ b/core/src/zero1hd/rhythmbullet/graphics/ui/components/ControlOptions.java @@ -11,20 +11,20 @@ import com.badlogic.gdx.utils.Array; import zero1hd.rhythmbullet.controls.KeyMap; -public class SetControls extends Table { - public SetControls(Skin skin, KeyMap keyMap) { +public class ControlOptions extends Table { + public ControlOptions(Skin skin, KeyMap keyMap) { super(skin); //first Label forwardKeyLabel = new Label("Forward: ",skin); forwardKeyLabel.setName(KeyMap.UP); add(forwardKeyLabel).left(); - KeySetter forwardKeySetter = new KeySetter(keyMap, KeyMap.UP); + KeyBindButton forwardKeySetter = new KeyBindButton(keyMap, KeyMap.UP); add(forwardKeySetter).spaceRight(45f); Label shootKeyLabel = new Label("Shoot: ", skin); shootKeyLabel.setName(KeyMap.SHOOT); add(shootKeyLabel).left(); - KeySetter shootKeySetter = new KeySetter(keyMap, KeyMap.SHOOT); + KeyBindButton shootKeySetter = new KeyBindButton(keyMap, KeyMap.SHOOT); add(shootKeySetter); row(); @@ -33,12 +33,12 @@ public class SetControls extends Table { Label backwardKeyLabel = new Label("Backward: ", skin); backwardKeyLabel.setName(KeyMap.DOWN); add(backwardKeyLabel).left(); - KeySetter backwardKeySetter = new KeySetter(keyMap, KeyMap.DOWN); + KeyBindButton backwardKeySetter = new KeyBindButton(keyMap, KeyMap.DOWN); add(backwardKeySetter).spaceRight(45f); Label sector1TPKeyLabel = new Label("Left Teleport", skin); sector1TPKeyLabel.setName(KeyMap.FIRSTTHIRDTELEPORT); add(sector1TPKeyLabel).left(); - KeySetter Sector1TPKeySetter = new KeySetter(keyMap, KeyMap.FIRSTTHIRDTELEPORT); + KeyBindButton Sector1TPKeySetter = new KeyBindButton(keyMap, KeyMap.FIRSTTHIRDTELEPORT); add(Sector1TPKeySetter); row(); @@ -46,12 +46,12 @@ public class SetControls extends Table { Label leftKeyLabel = new Label("Left: ", skin); leftKeyLabel.setName(KeyMap.LEFT); add(leftKeyLabel).left(); - KeySetter leftKeySetter = new KeySetter(keyMap, KeyMap.LEFT); + KeyBindButton leftKeySetter = new KeyBindButton(keyMap, KeyMap.LEFT); add(leftKeySetter).spaceRight(45f); Label sector2TPKeyLabel = new Label("Middle Teleport: ", skin); sector2TPKeyLabel.setName(KeyMap.SECONDTHIRDTELEPORT); add(sector2TPKeyLabel).left(); - KeySetter sector2TPKeySetter = new KeySetter(keyMap, KeyMap.SECONDTHIRDTELEPORT); + KeyBindButton sector2TPKeySetter = new KeyBindButton(keyMap, KeyMap.SECONDTHIRDTELEPORT); add(sector2TPKeySetter); row(); @@ -59,12 +59,12 @@ public class SetControls extends Table { Label rightKeyLabel = new Label("Right: ", skin); rightKeyLabel.setName(KeyMap.RIGHT); add(rightKeyLabel).left(); - KeySetter rightKeySetter = new KeySetter(keyMap, KeyMap.RIGHT); + KeyBindButton rightKeySetter = new KeyBindButton(keyMap, KeyMap.RIGHT); add(rightKeySetter).spaceRight(45f); Label sector3TPKeyLabel = new Label("Right Teleport: ", skin); sector3TPKeyLabel.setName(KeyMap.THIRDTHIRDTELEPORT); add(sector3TPKeyLabel).left(); - KeySetter sector3TPKeySetter = new KeySetter(keyMap, KeyMap.THIRDTHIRDTELEPORT); + KeyBindButton sector3TPKeySetter = new KeyBindButton(keyMap, KeyMap.THIRDTHIRDTELEPORT); add(sector3TPKeySetter); addListener(new ClickListener() { diff --git a/core/src/zero1hd/rhythmbullet/graphics/ui/components/GraphicsTable.java b/core/src/zero1hd/rhythmbullet/graphics/ui/components/GraphicsOptions.java similarity index 75% rename from core/src/zero1hd/rhythmbullet/graphics/ui/components/GraphicsTable.java rename to core/src/zero1hd/rhythmbullet/graphics/ui/components/GraphicsOptions.java index fd037bb..bb49ab7 100755 --- a/core/src/zero1hd/rhythmbullet/graphics/ui/components/GraphicsTable.java +++ b/core/src/zero1hd/rhythmbullet/graphics/ui/components/GraphicsOptions.java @@ -11,12 +11,12 @@ import com.badlogic.gdx.scenes.scene2d.ui.TextButton; import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener; import com.badlogic.gdx.utils.Align; -public class GraphicsTable extends Table { +public class GraphicsOptions extends Table { private Label resolutions, shaders; private CheckBox glowShader; - private SetResolutionButton + private ResolutionButton _3840x2160, _2560x1440, _1920x1200, @@ -27,7 +27,7 @@ public class GraphicsTable extends Table { _800x480; - public GraphicsTable(Skin skin, final Preferences pref) { + public GraphicsOptions(Skin skin, final Preferences pref) { align(Align.center); defaults().space(10f); @@ -60,35 +60,35 @@ public class GraphicsTable extends Table { add(fullscreen).fillX(); row(); - _3840x2160 = new SetResolutionButton(3840, 2160, skin, pref); + _3840x2160 = new ResolutionButton(3840, 2160, skin, pref); add(_3840x2160).fillX(); row(); - _2560x1440 = new SetResolutionButton(2560, 1440, skin, pref); + _2560x1440 = new ResolutionButton(2560, 1440, skin, pref); add(_2560x1440).fillX(); row(); - _1920x1200 = new SetResolutionButton(1920, 1200, skin, pref); + _1920x1200 = new ResolutionButton(1920, 1200, skin, pref); add(_1920x1200).fillX(); row(); - _1920x1080 = new SetResolutionButton(1920, 1080, skin, pref); + _1920x1080 = new ResolutionButton(1920, 1080, skin, pref); add(_1920x1080).fillX(); row(); - _1280x800 = new SetResolutionButton(1280, 800, skin, pref); + _1280x800 = new ResolutionButton(1280, 800, skin, pref); add(_1280x800).fillX(); row(); - _1280x720 = new SetResolutionButton(1280, 720, skin, pref); + _1280x720 = new ResolutionButton(1280, 720, skin, pref); add(_1280x720).fillX(); row(); - _1366x768 = new SetResolutionButton(1366, 768, skin, pref); + _1366x768 = new ResolutionButton(1366, 768, skin, pref); add(_1366x768).fillX(); row(); - _800x480 = new SetResolutionButton(800, 480, skin, pref); + _800x480 = new ResolutionButton(800, 480, skin, pref); add(_800x480).fillX(); row(); } diff --git a/core/src/zero1hd/rhythmbullet/graphics/ui/components/KeySetter.java b/core/src/zero1hd/rhythmbullet/graphics/ui/components/KeyBindButton.java similarity index 94% rename from core/src/zero1hd/rhythmbullet/graphics/ui/components/KeySetter.java rename to core/src/zero1hd/rhythmbullet/graphics/ui/components/KeyBindButton.java index 1a30a7f..aa21e3f 100755 --- a/core/src/zero1hd/rhythmbullet/graphics/ui/components/KeySetter.java +++ b/core/src/zero1hd/rhythmbullet/graphics/ui/components/KeyBindButton.java @@ -12,11 +12,11 @@ import com.badlogic.gdx.scenes.scene2d.actions.Actions; import zero1hd.rhythmbullet.controls.KeyMap; -public class KeySetter extends Actor { +public class KeyBindButton extends Actor { TextureRegion keyIcon; KeyMap keyMap; - public KeySetter(final KeyMap keyMap, final String control) { + public KeyBindButton(final KeyMap keyMap, final String control) { this.keyMap = keyMap; keyIcon = keyMap.getIcon(keyMap.stringToID(control)); setSize(keyIcon.getRegionWidth(), keyIcon.getRegionHeight()); diff --git a/core/src/zero1hd/rhythmbullet/graphics/ui/components/SetResolutionButton.java b/core/src/zero1hd/rhythmbullet/graphics/ui/components/ResolutionButton.java similarity index 82% rename from core/src/zero1hd/rhythmbullet/graphics/ui/components/SetResolutionButton.java rename to core/src/zero1hd/rhythmbullet/graphics/ui/components/ResolutionButton.java index f321791..a2ca5e6 100755 --- a/core/src/zero1hd/rhythmbullet/graphics/ui/components/SetResolutionButton.java +++ b/core/src/zero1hd/rhythmbullet/graphics/ui/components/ResolutionButton.java @@ -10,9 +10,9 @@ import com.badlogic.gdx.scenes.scene2d.ui.Skin; import com.badlogic.gdx.scenes.scene2d.ui.TextButton; import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener; -public class SetResolutionButton extends TextButton { +public class ResolutionButton extends TextButton { - public SetResolutionButton(final int width, final int height, Skin skin, final Preferences prefs) { + public ResolutionButton(final int width, final int height, Skin skin, final Preferences prefs) { super(width + "x" + height, skin); Dimension screenDim = Toolkit.getDefaultToolkit().getScreenSize(); diff --git a/core/src/zero1hd/rhythmbullet/graphics/ui/components/TitleBarVisualizer.java b/core/src/zero1hd/rhythmbullet/graphics/ui/components/TitleBarVisualizer.java index 37da043..de1789a 100755 --- a/core/src/zero1hd/rhythmbullet/graphics/ui/components/TitleBarVisualizer.java +++ b/core/src/zero1hd/rhythmbullet/graphics/ui/components/TitleBarVisualizer.java @@ -3,14 +3,17 @@ package zero1hd.rhythmbullet.graphics.ui.components; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.assets.AssetManager; import com.badlogic.gdx.graphics.Color; -import com.badlogic.gdx.graphics.OrthographicCamera; 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.graphics.g2d.ParticleEffect; +import com.badlogic.gdx.graphics.g2d.ParticleEffectPool; +import com.badlogic.gdx.graphics.g2d.ParticleEffectPool.PooledEffect; import com.badlogic.gdx.math.MathUtils; import com.badlogic.gdx.scenes.scene2d.Group; import com.badlogic.gdx.scenes.scene2d.ui.Image; +import com.badlogic.gdx.utils.Array; import com.badlogic.gdx.utils.Disposable; import zero1hd.rhythmbullet.audio.visualizer.MirrorVisualizer; @@ -20,7 +23,13 @@ public class TitleBarVisualizer extends Group implements Disposable { private MirrorVisualizer visual2; private Texture bgTexture; private Image bg; - public TitleBarVisualizer(AssetManager assets, OrthographicCamera camera) { + private Image titleImage; + + //Particle pools; + ParticleEffectPool beatEffectPool; + Array effects = new Array<>(); + + public TitleBarVisualizer(AssetManager assets) { if (assets == null) throw new NullPointerException("TitleBarVisualizer requires assets manager... ITS NULL YOU FOOL"); visual = new Visualizer(); visual.getVis().setSpaceBetweenBars(visual.getVis().getBarWidth()-1); @@ -37,24 +46,55 @@ public class TitleBarVisualizer extends Group implements Disposable { visual.getVis().addMirrorVisualizer(visual2); visual2.setyPos(MathUtils.round(getHeight())); - Pixmap pixmap = new Pixmap(2, 2, Format.RGBA8888); + Pixmap pixmap = new Pixmap(MathUtils.round(getWidth()), MathUtils.round(getHeight()), Format.RGBA8888); pixmap.setColor(Color.WHITE); - pixmap.fill(); + pixmap.drawLine(0, 0, pixmap.getWidth(), 0); + pixmap.drawLine(0, pixmap.getHeight()-1, pixmap.getWidth(), pixmap.getHeight()-1); bgTexture = new Texture(pixmap); pixmap.dispose(); - setColor(0.451f, 0, 0, 1f); bg = new Image(bgTexture); bg.setSize(getWidth(), getHeight()); addActor(bg); + + titleImage = new Image(assets.get("title.png", Texture.class)); + titleImage.setScale((bg.getHeight()-(0.1f*Gdx.graphics.getHeight()))/titleImage.getHeight()); + + if (titleImage.getWidth() > 0.8f*getWidth()) { + titleImage.setScale((bg.getWidth()-(0.2f*Gdx.graphics.getWidth()))/titleImage.getWidth()); + } + titleImage.setPosition((getWidth() - titleImage.getWidth())/2f, (getHeight() - titleImage.getHeight())/2f -10); + titleImage.setColor(Color.WHITE); + addActor(titleImage); + + beatEffectPool = new ParticleEffectPool(assets.get("beateffect.p", ParticleEffect.class), 0, 5) { + @Override + protected PooledEffect newObject() { + PooledEffect effect = super.newObject(); + effect.scaleEffect(Gdx.graphics.getWidth()/64f); + return effect; + } + }; } @Override public void act(float delta) { + if (visual.getVis().getCurrentAvg() > visual.getVis().getMaxAvgHeight()*0.55f) { + PooledEffect effect = beatEffectPool.obtain(); + effect.setPosition(0, 0); + effects.add(effect); + } super.act(delta); } @Override public void draw(Batch batch, float parentAlpha) { + for (int i = 0; i < effects.size; i++) { + effects.get(i).draw(batch, Gdx.graphics.getDeltaTime()); + if (effects.get(i).isComplete()) { + effects.get(i).free(); + effects.removeIndex(i); + } + } super.draw(batch, parentAlpha); } @@ -69,8 +109,6 @@ public class TitleBarVisualizer extends Group implements Disposable { @Override public void setColor(Color color) { - bg.setColor(getColor()); - visual.setColor(getColor()); super.setColor(color); } diff --git a/core/src/zero1hd/rhythmbullet/graphics/ui/components/Visualizer.java b/core/src/zero1hd/rhythmbullet/graphics/ui/components/Visualizer.java index 0ac6f60..9af205c 100755 --- a/core/src/zero1hd/rhythmbullet/graphics/ui/components/Visualizer.java +++ b/core/src/zero1hd/rhythmbullet/graphics/ui/components/Visualizer.java @@ -75,4 +75,5 @@ public class Visualizer extends Widget { public BasicVisualizer getVis() { return vis; } + } diff --git a/core/src/zero1hd/rhythmbullet/graphics/ui/pages/MainPage.java b/core/src/zero1hd/rhythmbullet/graphics/ui/pages/MainPage.java index 90f3cc0..dae68e5 100755 --- a/core/src/zero1hd/rhythmbullet/graphics/ui/pages/MainPage.java +++ b/core/src/zero1hd/rhythmbullet/graphics/ui/pages/MainPage.java @@ -19,7 +19,7 @@ public class MainPage extends Page implements OnDifferentSongListener { public MainPage(RhythmBullet core, Vector3 targetPosition, SongListController sc, OrthographicCamera camera) { this.sc = sc; - titleBar = new TitleBarVisualizer(core.getAssetManager(), camera); + titleBar = new TitleBarVisualizer(core.getAssetManager()); addActor(titleBar); titleBar.getHvisual().setMM(sc.getCurrentSong()); diff --git a/core/src/zero1hd/rhythmbullet/graphics/ui/pages/MoreOptionsPage.java b/core/src/zero1hd/rhythmbullet/graphics/ui/pages/MoreOptionsPage.java index 5bfc877..3069986 100755 --- a/core/src/zero1hd/rhythmbullet/graphics/ui/pages/MoreOptionsPage.java +++ b/core/src/zero1hd/rhythmbullet/graphics/ui/pages/MoreOptionsPage.java @@ -9,16 +9,16 @@ import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener; import zero1hd.rhythmbullet.RhythmBullet; import zero1hd.rhythmbullet.controls.KeyMap; -import zero1hd.rhythmbullet.graphics.ui.components.GraphicsTable; -import zero1hd.rhythmbullet.graphics.ui.components.SetControls; +import zero1hd.rhythmbullet.graphics.ui.components.GraphicsOptions; +import zero1hd.rhythmbullet.graphics.ui.components.ControlOptions; public class MoreOptionsPage extends Page { private KeyMap keymap; private ScrollPane controlsScroller; - private SetControls controlSetter; + private ControlOptions controlSetter; private ScrollPane graphicsScroller; - private GraphicsTable graphicsSettings; + private GraphicsOptions graphicsSettings; public MoreOptionsPage(RhythmBullet core, final Vector3 targetLocation) { @@ -34,7 +34,7 @@ public class MoreOptionsPage extends Page { }); addActor(backArrow); - controlSetter = new SetControls(core.getDefaultSkin(), keymap); + controlSetter = new ControlOptions(core.getDefaultSkin(), keymap); controlsScroller = new ScrollPane(controlSetter, core.getDefaultSkin()); controlsScroller.setFadeScrollBars(false); controlsScroller.setSize(getWidth()-backArrow.getWidth()-backArrow.getX()-10, getHeight()); @@ -42,7 +42,7 @@ public class MoreOptionsPage extends Page { addActor(controlsScroller); controlsScroller.setVisible(false); - graphicsSettings = new GraphicsTable(core.getDefaultSkin(), core.getPrefs()); + graphicsSettings = new GraphicsOptions(core.getDefaultSkin(), core.getPrefs()); graphicsScroller = new ScrollPane(graphicsSettings, core.getDefaultSkin()); graphicsScroller.setFadeScrollBars(false); graphicsScroller.setSize(getWidth()-backArrow.getWidth()-backArrow.getX()-10, getHeight()); @@ -68,7 +68,7 @@ public class MoreOptionsPage extends Page { } } - public GraphicsTable getGraphicsSettings() { + public GraphicsOptions getGraphicsSettings() { return graphicsSettings; } }