added particles and improved main menu aesthetically

This commit is contained in:
Harrison Deng 2017-10-08 01:41:25 -05:00
parent 67f9105922
commit 4c329e8d8f
15 changed files with 272 additions and 155 deletions

View File

@ -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

Binary file not shown.

After

Width:  |  Height:  |  Size: 929 B

View File

@ -180,6 +180,7 @@ public class RhythmBullet extends Game {
assetManager.load("explosion.ogg", Sound.class); assetManager.load("explosion.ogg", Sound.class);
assetManager.load("disintegrate.ogg", Sound.class); assetManager.load("disintegrate.ogg", Sound.class);
assetManager.load("explosion-s.p", ParticleEffect.class); assetManager.load("explosion-s.p", ParticleEffect.class);
assetManager.load("beateffect.p", ParticleEffect.class);
assetManager.load("tpSelector.png", Texture.class); assetManager.load("tpSelector.png", Texture.class);
assetManager.load("magic1.png", Texture.class); assetManager.load("magic1.png", Texture.class);
} }

View File

@ -29,6 +29,8 @@ public class BasicVisualizer extends VisualizerCore {
private boolean flip; private boolean flip;
private Array<MirrorVisualizer> mirrors; private Array<MirrorVisualizer> mirrors;
private boolean reverse; private boolean reverse;
private float maxAvgHeight;
private float currentAvg;
public BasicVisualizer() { public BasicVisualizer() {
super(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()/2, 0, 0); super(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()/2, 0, 0);
@ -66,7 +68,6 @@ public class BasicVisualizer extends VisualizerCore {
} }
public void modify(float delta) { public void modify(float delta) {
//Averaging bins together //Averaging bins together
for (int i = 0; i < barCount; i++) { for (int i = 0; i < barCount; i++) {
@ -78,6 +79,7 @@ public class BasicVisualizer extends VisualizerCore {
barHeight *= barHeightMultiplier; barHeight *= barHeightMultiplier;
barHeights[i] = barHeight; barHeights[i] = barHeight;
} }
currentAvg = 0;
for (int i = 0; i < barCount; i++) { for (int i = 0; i < barCount; i++) {
int avg = 0; int avg = 0;
//Averaging the bars //Averaging the bars
@ -91,21 +93,28 @@ public class BasicVisualizer extends VisualizerCore {
} }
avg /= smoothRange*2; avg /= smoothRange*2;
barHeights[i] = avg; barHeights[i] = avg;
currentAvg += barHeights[i];
if (bars[i].getHeight() > barHeights[i]) { if (bars[i].getHeight() > barHeights[i]) {
bars[i].setSize(barWidth, bars[i].getHeight() - (20f*delta*(bars[i].getHeight()-barHeights[i]))); bars[i].setSize(barWidth, bars[i].getHeight() - (20f*delta*(bars[i].getHeight()-barHeights[i])));
} else { } else {
bars[i].setSize(barWidth, bars[i].getHeight() + (27f*delta*(barHeights[i] - bars[i].getHeight()))); bars[i].setSize(barWidth, bars[i].getHeight() + (27f*delta*(barHeights[i] - bars[i].getHeight())));
} }
} }
currentAvg /= barHeights.length;
if (currentAvg > maxAvgHeight) {
maxAvgHeight = currentAvg;
}
} }
@Override @Override
public void setMM(MusicManager mm) { public void setMM(MusicManager mm) {
super.setMM(mm); super.setMM(mm);
maxAvgHeight = 0;
currentAvg = 0;
float validBins = (5000/((mm.getSampleRate()/2)/((audioPCM.length/2)+1))); float validBins = (5000/((mm.getSampleRate()/2)/((audioPCM.length/2)+1)));
Gdx.app.debug("Visualizer", "valid frequency bins " + validBins); Gdx.app.debug("Visualizer", "valid frequency bins " + validBins);
binsPerBar = MathUtils.round((validBins/barCount)); binsPerBar = MathUtils.round((validBins/barCount));
barHeights = new float[barCount];
} }
@Override @Override
@ -153,6 +162,9 @@ public class BasicVisualizer extends VisualizerCore {
for (int i = 0; i < bars.length; i++) { for (int i = 0; i < bars.length; i++) {
bars[i].setColor(r, g, b, a); 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) { public void setRotation(float rotation) {
@ -191,4 +203,16 @@ public class BasicVisualizer extends VisualizerCore {
public boolean isReversed() { public boolean isReversed() {
return reverse; return reverse;
} }
public Sprite[] getBars() {
return bars;
}
public float getCurrentAvg() {
return currentAvg;
}
public float getMaxAvgHeight() {
return maxAvgHeight;
}
} }

View File

@ -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() { public float getRotation() {
return rotation; return rotation;
} }

View File

@ -43,8 +43,8 @@ public class VisualizerCore implements Disposable {
if (audioPCM == null || audioPCM.length != mm.getReadWindowSize()) { if (audioPCM == null || audioPCM.length != mm.getReadWindowSize()) {
calc = false; calc = false;
fft = new FloatFFT_1D(mm.getReadWindowSize()); fft = new FloatFFT_1D(mm.getReadWindowSize());
audioPCM = new float[mm.getReadWindowSize()];
} }
audioPCM = new float[mm.getReadWindowSize()];
this.mm = mm; this.mm = mm;
calc = true; calc = true;
lock.unlock(); lock.unlock();

View File

@ -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();
}
}

View File

@ -11,20 +11,20 @@ import com.badlogic.gdx.utils.Array;
import zero1hd.rhythmbullet.controls.KeyMap; import zero1hd.rhythmbullet.controls.KeyMap;
public class SetControls extends Table { public class ControlOptions extends Table {
public SetControls(Skin skin, KeyMap keyMap) { public ControlOptions(Skin skin, KeyMap keyMap) {
super(skin); super(skin);
//first //first
Label forwardKeyLabel = new Label("Forward: ",skin); Label forwardKeyLabel = new Label("Forward: ",skin);
forwardKeyLabel.setName(KeyMap.UP); forwardKeyLabel.setName(KeyMap.UP);
add(forwardKeyLabel).left(); add(forwardKeyLabel).left();
KeySetter forwardKeySetter = new KeySetter(keyMap, KeyMap.UP); KeyBindButton forwardKeySetter = new KeyBindButton(keyMap, KeyMap.UP);
add(forwardKeySetter).spaceRight(45f); add(forwardKeySetter).spaceRight(45f);
Label shootKeyLabel = new Label("Shoot: ", skin); Label shootKeyLabel = new Label("Shoot: ", skin);
shootKeyLabel.setName(KeyMap.SHOOT); shootKeyLabel.setName(KeyMap.SHOOT);
add(shootKeyLabel).left(); add(shootKeyLabel).left();
KeySetter shootKeySetter = new KeySetter(keyMap, KeyMap.SHOOT); KeyBindButton shootKeySetter = new KeyBindButton(keyMap, KeyMap.SHOOT);
add(shootKeySetter); add(shootKeySetter);
row(); row();
@ -33,12 +33,12 @@ public class SetControls extends Table {
Label backwardKeyLabel = new Label("Backward: ", skin); Label backwardKeyLabel = new Label("Backward: ", skin);
backwardKeyLabel.setName(KeyMap.DOWN); backwardKeyLabel.setName(KeyMap.DOWN);
add(backwardKeyLabel).left(); add(backwardKeyLabel).left();
KeySetter backwardKeySetter = new KeySetter(keyMap, KeyMap.DOWN); KeyBindButton backwardKeySetter = new KeyBindButton(keyMap, KeyMap.DOWN);
add(backwardKeySetter).spaceRight(45f); add(backwardKeySetter).spaceRight(45f);
Label sector1TPKeyLabel = new Label("Left Teleport", skin); Label sector1TPKeyLabel = new Label("Left Teleport", skin);
sector1TPKeyLabel.setName(KeyMap.FIRSTTHIRDTELEPORT); sector1TPKeyLabel.setName(KeyMap.FIRSTTHIRDTELEPORT);
add(sector1TPKeyLabel).left(); add(sector1TPKeyLabel).left();
KeySetter Sector1TPKeySetter = new KeySetter(keyMap, KeyMap.FIRSTTHIRDTELEPORT); KeyBindButton Sector1TPKeySetter = new KeyBindButton(keyMap, KeyMap.FIRSTTHIRDTELEPORT);
add(Sector1TPKeySetter); add(Sector1TPKeySetter);
row(); row();
@ -46,12 +46,12 @@ public class SetControls extends Table {
Label leftKeyLabel = new Label("Left: ", skin); Label leftKeyLabel = new Label("Left: ", skin);
leftKeyLabel.setName(KeyMap.LEFT); leftKeyLabel.setName(KeyMap.LEFT);
add(leftKeyLabel).left(); add(leftKeyLabel).left();
KeySetter leftKeySetter = new KeySetter(keyMap, KeyMap.LEFT); KeyBindButton leftKeySetter = new KeyBindButton(keyMap, KeyMap.LEFT);
add(leftKeySetter).spaceRight(45f); add(leftKeySetter).spaceRight(45f);
Label sector2TPKeyLabel = new Label("Middle Teleport: ", skin); Label sector2TPKeyLabel = new Label("Middle Teleport: ", skin);
sector2TPKeyLabel.setName(KeyMap.SECONDTHIRDTELEPORT); sector2TPKeyLabel.setName(KeyMap.SECONDTHIRDTELEPORT);
add(sector2TPKeyLabel).left(); add(sector2TPKeyLabel).left();
KeySetter sector2TPKeySetter = new KeySetter(keyMap, KeyMap.SECONDTHIRDTELEPORT); KeyBindButton sector2TPKeySetter = new KeyBindButton(keyMap, KeyMap.SECONDTHIRDTELEPORT);
add(sector2TPKeySetter); add(sector2TPKeySetter);
row(); row();
@ -59,12 +59,12 @@ public class SetControls extends Table {
Label rightKeyLabel = new Label("Right: ", skin); Label rightKeyLabel = new Label("Right: ", skin);
rightKeyLabel.setName(KeyMap.RIGHT); rightKeyLabel.setName(KeyMap.RIGHT);
add(rightKeyLabel).left(); add(rightKeyLabel).left();
KeySetter rightKeySetter = new KeySetter(keyMap, KeyMap.RIGHT); KeyBindButton rightKeySetter = new KeyBindButton(keyMap, KeyMap.RIGHT);
add(rightKeySetter).spaceRight(45f); add(rightKeySetter).spaceRight(45f);
Label sector3TPKeyLabel = new Label("Right Teleport: ", skin); Label sector3TPKeyLabel = new Label("Right Teleport: ", skin);
sector3TPKeyLabel.setName(KeyMap.THIRDTHIRDTELEPORT); sector3TPKeyLabel.setName(KeyMap.THIRDTHIRDTELEPORT);
add(sector3TPKeyLabel).left(); add(sector3TPKeyLabel).left();
KeySetter sector3TPKeySetter = new KeySetter(keyMap, KeyMap.THIRDTHIRDTELEPORT); KeyBindButton sector3TPKeySetter = new KeyBindButton(keyMap, KeyMap.THIRDTHIRDTELEPORT);
add(sector3TPKeySetter); add(sector3TPKeySetter);
addListener(new ClickListener() { addListener(new ClickListener() {

View File

@ -11,12 +11,12 @@ import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener; import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
import com.badlogic.gdx.utils.Align; import com.badlogic.gdx.utils.Align;
public class GraphicsTable extends Table { public class GraphicsOptions extends Table {
private Label resolutions, shaders; private Label resolutions, shaders;
private CheckBox glowShader; private CheckBox glowShader;
private SetResolutionButton private ResolutionButton
_3840x2160, _3840x2160,
_2560x1440, _2560x1440,
_1920x1200, _1920x1200,
@ -27,7 +27,7 @@ public class GraphicsTable extends Table {
_800x480; _800x480;
public GraphicsTable(Skin skin, final Preferences pref) { public GraphicsOptions(Skin skin, final Preferences pref) {
align(Align.center); align(Align.center);
defaults().space(10f); defaults().space(10f);
@ -60,35 +60,35 @@ public class GraphicsTable extends Table {
add(fullscreen).fillX(); add(fullscreen).fillX();
row(); row();
_3840x2160 = new SetResolutionButton(3840, 2160, skin, pref); _3840x2160 = new ResolutionButton(3840, 2160, skin, pref);
add(_3840x2160).fillX(); add(_3840x2160).fillX();
row(); row();
_2560x1440 = new SetResolutionButton(2560, 1440, skin, pref); _2560x1440 = new ResolutionButton(2560, 1440, skin, pref);
add(_2560x1440).fillX(); add(_2560x1440).fillX();
row(); row();
_1920x1200 = new SetResolutionButton(1920, 1200, skin, pref); _1920x1200 = new ResolutionButton(1920, 1200, skin, pref);
add(_1920x1200).fillX(); add(_1920x1200).fillX();
row(); row();
_1920x1080 = new SetResolutionButton(1920, 1080, skin, pref); _1920x1080 = new ResolutionButton(1920, 1080, skin, pref);
add(_1920x1080).fillX(); add(_1920x1080).fillX();
row(); row();
_1280x800 = new SetResolutionButton(1280, 800, skin, pref); _1280x800 = new ResolutionButton(1280, 800, skin, pref);
add(_1280x800).fillX(); add(_1280x800).fillX();
row(); row();
_1280x720 = new SetResolutionButton(1280, 720, skin, pref); _1280x720 = new ResolutionButton(1280, 720, skin, pref);
add(_1280x720).fillX(); add(_1280x720).fillX();
row(); row();
_1366x768 = new SetResolutionButton(1366, 768, skin, pref); _1366x768 = new ResolutionButton(1366, 768, skin, pref);
add(_1366x768).fillX(); add(_1366x768).fillX();
row(); row();
_800x480 = new SetResolutionButton(800, 480, skin, pref); _800x480 = new ResolutionButton(800, 480, skin, pref);
add(_800x480).fillX(); add(_800x480).fillX();
row(); row();
} }

View File

@ -12,11 +12,11 @@ import com.badlogic.gdx.scenes.scene2d.actions.Actions;
import zero1hd.rhythmbullet.controls.KeyMap; import zero1hd.rhythmbullet.controls.KeyMap;
public class KeySetter extends Actor { public class KeyBindButton extends Actor {
TextureRegion keyIcon; TextureRegion keyIcon;
KeyMap keyMap; KeyMap keyMap;
public KeySetter(final KeyMap keyMap, final String control) { public KeyBindButton(final KeyMap keyMap, final String control) {
this.keyMap = keyMap; this.keyMap = keyMap;
keyIcon = keyMap.getIcon(keyMap.stringToID(control)); keyIcon = keyMap.getIcon(keyMap.stringToID(control));
setSize(keyIcon.getRegionWidth(), keyIcon.getRegionHeight()); setSize(keyIcon.getRegionWidth(), keyIcon.getRegionHeight());

View File

@ -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.ui.TextButton;
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener; 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); super(width + "x" + height, skin);
Dimension screenDim = Toolkit.getDefaultToolkit().getScreenSize(); Dimension screenDim = Toolkit.getDefaultToolkit().getScreenSize();

View File

@ -3,14 +3,17 @@ package zero1hd.rhythmbullet.graphics.ui.components;
import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.assets.AssetManager; import com.badlogic.gdx.assets.AssetManager;
import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.Pixmap; import com.badlogic.gdx.graphics.Pixmap;
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.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.math.MathUtils;
import com.badlogic.gdx.scenes.scene2d.Group; import com.badlogic.gdx.scenes.scene2d.Group;
import com.badlogic.gdx.scenes.scene2d.ui.Image; import com.badlogic.gdx.scenes.scene2d.ui.Image;
import com.badlogic.gdx.utils.Array;
import com.badlogic.gdx.utils.Disposable; import com.badlogic.gdx.utils.Disposable;
import zero1hd.rhythmbullet.audio.visualizer.MirrorVisualizer; import zero1hd.rhythmbullet.audio.visualizer.MirrorVisualizer;
@ -20,7 +23,13 @@ public class TitleBarVisualizer extends Group implements Disposable {
private MirrorVisualizer visual2; private MirrorVisualizer visual2;
private Texture bgTexture; private Texture bgTexture;
private Image bg; private Image bg;
public TitleBarVisualizer(AssetManager assets, OrthographicCamera camera) { private Image titleImage;
//Particle pools;
ParticleEffectPool beatEffectPool;
Array<PooledEffect> effects = new Array<>();
public TitleBarVisualizer(AssetManager assets) {
if (assets == null) throw new NullPointerException("TitleBarVisualizer requires assets manager... ITS NULL YOU FOOL"); if (assets == null) throw new NullPointerException("TitleBarVisualizer requires assets manager... ITS NULL YOU FOOL");
visual = new Visualizer(); visual = new Visualizer();
visual.getVis().setSpaceBetweenBars(visual.getVis().getBarWidth()-1); visual.getVis().setSpaceBetweenBars(visual.getVis().getBarWidth()-1);
@ -37,24 +46,55 @@ public class TitleBarVisualizer extends Group implements Disposable {
visual.getVis().addMirrorVisualizer(visual2); visual.getVis().addMirrorVisualizer(visual2);
visual2.setyPos(MathUtils.round(getHeight())); 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.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); bgTexture = new Texture(pixmap);
pixmap.dispose(); pixmap.dispose();
setColor(0.451f, 0, 0, 1f);
bg = new Image(bgTexture); bg = new Image(bgTexture);
bg.setSize(getWidth(), getHeight()); bg.setSize(getWidth(), getHeight());
addActor(bg); 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 @Override
public void act(float delta) { 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); super.act(delta);
} }
@Override @Override
public void draw(Batch batch, float parentAlpha) { 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); super.draw(batch, parentAlpha);
} }
@ -69,8 +109,6 @@ public class TitleBarVisualizer extends Group implements Disposable {
@Override @Override
public void setColor(Color color) { public void setColor(Color color) {
bg.setColor(getColor());
visual.setColor(getColor());
super.setColor(color); super.setColor(color);
} }

View File

@ -75,4 +75,5 @@ public class Visualizer extends Widget {
public BasicVisualizer getVis() { public BasicVisualizer getVis() {
return vis; return vis;
} }
} }

View File

@ -19,7 +19,7 @@ public class MainPage extends Page implements OnDifferentSongListener {
public MainPage(RhythmBullet core, Vector3 targetPosition, SongListController sc, OrthographicCamera camera) { public MainPage(RhythmBullet core, Vector3 targetPosition, SongListController sc, OrthographicCamera camera) {
this.sc = sc; this.sc = sc;
titleBar = new TitleBarVisualizer(core.getAssetManager(), camera); titleBar = new TitleBarVisualizer(core.getAssetManager());
addActor(titleBar); addActor(titleBar);
titleBar.getHvisual().setMM(sc.getCurrentSong()); titleBar.getHvisual().setMM(sc.getCurrentSong());

View File

@ -9,16 +9,16 @@ import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
import zero1hd.rhythmbullet.RhythmBullet; import zero1hd.rhythmbullet.RhythmBullet;
import zero1hd.rhythmbullet.controls.KeyMap; import zero1hd.rhythmbullet.controls.KeyMap;
import zero1hd.rhythmbullet.graphics.ui.components.GraphicsTable; import zero1hd.rhythmbullet.graphics.ui.components.GraphicsOptions;
import zero1hd.rhythmbullet.graphics.ui.components.SetControls; import zero1hd.rhythmbullet.graphics.ui.components.ControlOptions;
public class MoreOptionsPage extends Page { public class MoreOptionsPage extends Page {
private KeyMap keymap; private KeyMap keymap;
private ScrollPane controlsScroller; private ScrollPane controlsScroller;
private SetControls controlSetter; private ControlOptions controlSetter;
private ScrollPane graphicsScroller; private ScrollPane graphicsScroller;
private GraphicsTable graphicsSettings; private GraphicsOptions graphicsSettings;
public MoreOptionsPage(RhythmBullet core, final Vector3 targetLocation) { public MoreOptionsPage(RhythmBullet core, final Vector3 targetLocation) {
@ -34,7 +34,7 @@ public class MoreOptionsPage extends Page {
}); });
addActor(backArrow); addActor(backArrow);
controlSetter = new SetControls(core.getDefaultSkin(), keymap); controlSetter = new ControlOptions(core.getDefaultSkin(), keymap);
controlsScroller = new ScrollPane(controlSetter, core.getDefaultSkin()); controlsScroller = new ScrollPane(controlSetter, core.getDefaultSkin());
controlsScroller.setFadeScrollBars(false); controlsScroller.setFadeScrollBars(false);
controlsScroller.setSize(getWidth()-backArrow.getWidth()-backArrow.getX()-10, getHeight()); controlsScroller.setSize(getWidth()-backArrow.getWidth()-backArrow.getX()-10, getHeight());
@ -42,7 +42,7 @@ public class MoreOptionsPage extends Page {
addActor(controlsScroller); addActor(controlsScroller);
controlsScroller.setVisible(false); controlsScroller.setVisible(false);
graphicsSettings = new GraphicsTable(core.getDefaultSkin(), core.getPrefs()); graphicsSettings = new GraphicsOptions(core.getDefaultSkin(), core.getPrefs());
graphicsScroller = new ScrollPane(graphicsSettings, core.getDefaultSkin()); graphicsScroller = new ScrollPane(graphicsSettings, core.getDefaultSkin());
graphicsScroller.setFadeScrollBars(false); graphicsScroller.setFadeScrollBars(false);
graphicsScroller.setSize(getWidth()-backArrow.getWidth()-backArrow.getX()-10, getHeight()); 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; return graphicsSettings;
} }
} }