clean main menu start while starting on mesh creation
This commit is contained in:
parent
33c9eeef2f
commit
bf2e68e0f7
10
android/assets/shaders/mesh.fsh
Executable file
10
android/assets/shaders/mesh.fsh
Executable file
@ -0,0 +1,10 @@
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
//input from vertex shader
|
||||
varying vec4 vColor;
|
||||
|
||||
void main() {
|
||||
gl_FragColor = vColor;
|
||||
}
|
13
android/assets/shaders/mesh.vsh
Executable file
13
android/assets/shaders/mesh.vsh
Executable file
@ -0,0 +1,13 @@
|
||||
attribute vec2 a_position;
|
||||
attribute vec4 a_color;
|
||||
|
||||
//our camera matrix
|
||||
uniform mat4 u_projTrans;
|
||||
|
||||
//send the color out to the fragment shader
|
||||
varying vec4 vColor;
|
||||
|
||||
void main() {
|
||||
vColor = a_color;
|
||||
gl_Position = u_projTrans * vec4(a_position.xy, 0.0, 1.0);
|
||||
}
|
84
core/src/zero1hd/rhythmbullet/graphics/meshes/Parallelogram.java
Executable file
84
core/src/zero1hd/rhythmbullet/graphics/meshes/Parallelogram.java
Executable file
@ -0,0 +1,84 @@
|
||||
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;
|
||||
|
||||
public class Parallelogram {
|
||||
private Mesh mesh;
|
||||
private OrthographicCamera cam;
|
||||
private ShaderProgram shader;
|
||||
|
||||
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_QUADS = 1;
|
||||
public final int MAX_VERTS = 4 * MAX_QUADS;
|
||||
|
||||
private float[] verts = new float[MAX_VERTS * TOTAL_VARS];
|
||||
|
||||
|
||||
public Parallelogram(OrthographicCamera camera) {
|
||||
this.cam = camera;
|
||||
|
||||
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"));
|
||||
}
|
||||
private int idx = 0;
|
||||
|
||||
public void drawParallelogram(float x, float y, float width, float height, float topOffset, Color color) {
|
||||
if (idx >= verts.length) {
|
||||
flush();
|
||||
}
|
||||
|
||||
float c = color.toFloatBits();
|
||||
|
||||
verts[idx++] = x;
|
||||
verts[idx++] = y;
|
||||
verts[idx++] = c;
|
||||
|
||||
verts[idx++] = x + width;
|
||||
verts[idx++] = y;
|
||||
verts[idx++] = c;
|
||||
|
||||
verts[idx++] = x + width + topOffset;
|
||||
verts[idx++] = y + height;
|
||||
verts[idx++] = c;
|
||||
|
||||
verts[idx++] = x + topOffset;
|
||||
verts[idx++] = y + height;
|
||||
verts[idx++] = c;
|
||||
}
|
||||
|
||||
private 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_TRIANGLES, 0, vertCount);
|
||||
|
||||
shader.end();
|
||||
|
||||
Gdx.gl.glDepthMask(true);
|
||||
|
||||
idx = 0;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package zero1hd.rhythmbullet.ui.components;
|
||||
package zero1hd.rhythmbullet.graphics.ui.components;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.Input.Keys;
|
@ -1,4 +1,4 @@
|
||||
package zero1hd.rhythmbullet.ui.components;
|
||||
package zero1hd.rhythmbullet.graphics.ui.components;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.Input.Keys;
|
@ -1,4 +1,4 @@
|
||||
package zero1hd.rhythmbullet.ui.components;
|
||||
package zero1hd.rhythmbullet.graphics.ui.components;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.Preferences;
|
@ -1,4 +1,4 @@
|
||||
package zero1hd.rhythmbullet.ui.components;
|
||||
package zero1hd.rhythmbullet.graphics.ui.components;
|
||||
|
||||
import com.badlogic.gdx.math.MathUtils;
|
||||
import com.badlogic.gdx.scenes.scene2d.actions.Actions;
|
@ -1,4 +1,4 @@
|
||||
package zero1hd.rhythmbullet.ui.components;
|
||||
package zero1hd.rhythmbullet.graphics.ui.components;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.Input.Keys;
|
@ -1,4 +1,4 @@
|
||||
package zero1hd.rhythmbullet.ui.components;
|
||||
package zero1hd.rhythmbullet.graphics.ui.components;
|
||||
|
||||
import com.badlogic.gdx.Preferences;
|
||||
import com.badlogic.gdx.files.FileHandle;
|
@ -1,4 +1,4 @@
|
||||
package zero1hd.rhythmbullet.ui.components;
|
||||
package zero1hd.rhythmbullet.graphics.ui.components;
|
||||
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.graphics.g2d.Batch;
|
@ -1,4 +1,4 @@
|
||||
package zero1hd.rhythmbullet.ui.components;
|
||||
package zero1hd.rhythmbullet.graphics.ui.components;
|
||||
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.scenes.scene2d.Actor;
|
@ -1,4 +1,4 @@
|
||||
package zero1hd.rhythmbullet.ui.components;
|
||||
package zero1hd.rhythmbullet.graphics.ui.components;
|
||||
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Toolkit;
|
67
core/src/zero1hd/rhythmbullet/graphics/ui/components/TitleBarVisualizer.java
Executable file
67
core/src/zero1hd/rhythmbullet/graphics/ui/components/TitleBarVisualizer.java
Executable file
@ -0,0 +1,67 @@
|
||||
package zero1hd.rhythmbullet.graphics.ui.components;
|
||||
|
||||
import com.badlogic.gdx.assets.AssetManager;
|
||||
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.Sprite;
|
||||
import com.badlogic.gdx.scenes.scene2d.Group;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Image;
|
||||
import com.badlogic.gdx.utils.Disposable;
|
||||
|
||||
public class TitleBarVisualizer extends Group implements Disposable {
|
||||
private Visualizer hvisual;
|
||||
private Sprite backgroundBar;
|
||||
private Texture backgroundTexture;
|
||||
private Image titleImage;
|
||||
|
||||
public TitleBarVisualizer(AssetManager assets) {
|
||||
if (assets == null) throw new NullPointerException("TitleBarVisualizer requires assets manager... ITS NULL YOU FOOL");
|
||||
|
||||
hvisual = new Visualizer();
|
||||
addActor(hvisual);
|
||||
|
||||
Pixmap pixmap = new Pixmap(2, 2, Format.RGBA8888);
|
||||
pixmap.setColor(Color.WHITE);
|
||||
pixmap.fill();
|
||||
backgroundTexture = new Texture(pixmap);
|
||||
pixmap.dispose();
|
||||
backgroundBar = new Sprite(backgroundTexture);
|
||||
|
||||
titleImage = new Image(assets.get("title.png", Texture.class));
|
||||
addActor(titleImage);
|
||||
|
||||
backgroundBar.setPosition(getX(), getY());
|
||||
backgroundBar.setRotation(getRotation());
|
||||
backgroundBar.setSize(getWidth(), getHeight());
|
||||
hvisual.setY(getHeight());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void act(float delta) {
|
||||
super.act(delta);
|
||||
}
|
||||
|
||||
public Visualizer getHvisual() {
|
||||
return hvisual;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
backgroundTexture.dispose();
|
||||
backgroundTexture = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setColor(Color color) {
|
||||
backgroundBar.setColor(color);
|
||||
super.setColor(color);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setColor(float r, float g, float b, float a) {
|
||||
backgroundBar.setColor(r, g, b, a);
|
||||
super.setColor(r, g, b, a);
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package zero1hd.rhythmbullet.ui.components;
|
||||
package zero1hd.rhythmbullet.graphics.ui.components;
|
||||
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.graphics.g2d.Batch;
|
@ -1,4 +1,4 @@
|
||||
package zero1hd.rhythmbullet.ui.pages;
|
||||
package zero1hd.rhythmbullet.graphics.ui.pages;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
@ -23,8 +23,8 @@ import zero1hd.rhythmbullet.audio.MusicManager;
|
||||
import zero1hd.rhythmbullet.audio.SongInfo;
|
||||
import zero1hd.rhythmbullet.audio.map.GamePlayMap;
|
||||
import zero1hd.rhythmbullet.audio.map.RhythmMapAlgorithm;
|
||||
import zero1hd.rhythmbullet.graphics.ui.components.ScrollText;
|
||||
import zero1hd.rhythmbullet.screens.GameScreen;
|
||||
import zero1hd.rhythmbullet.ui.components.ScrollText;
|
||||
import zero1hd.rhythmbullet.util.MiniEvents;
|
||||
import zero1hd.rhythmbullet.util.MiniListener;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package zero1hd.rhythmbullet.ui.pages;
|
||||
package zero1hd.rhythmbullet.graphics.ui.pages;
|
||||
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Label;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
|
46
core/src/zero1hd/rhythmbullet/graphics/ui/pages/MainPage.java
Executable file
46
core/src/zero1hd/rhythmbullet/graphics/ui/pages/MainPage.java
Executable file
@ -0,0 +1,46 @@
|
||||
package zero1hd.rhythmbullet.graphics.ui.pages;
|
||||
|
||||
import com.badlogic.gdx.graphics.g2d.Batch;
|
||||
import com.badlogic.gdx.math.Vector3;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Label;
|
||||
|
||||
import zero1hd.rhythmbullet.RhythmBullet;
|
||||
import zero1hd.rhythmbullet.audio.MusicManager;
|
||||
import zero1hd.rhythmbullet.audio.SongListController;
|
||||
import zero1hd.rhythmbullet.events.OnDifferentSongListener;
|
||||
import zero1hd.rhythmbullet.graphics.ui.components.TitleBarVisualizer;
|
||||
|
||||
public class MainPage extends Page implements OnDifferentSongListener {
|
||||
private Label versionLabel;
|
||||
|
||||
private SongListController sc;
|
||||
private TitleBarVisualizer titleBar;
|
||||
public MainPage(RhythmBullet core, Vector3 targetPosition, SongListController sc) {
|
||||
this.sc = sc;
|
||||
|
||||
titleBar = new TitleBarVisualizer(core.getAssetManager());
|
||||
addActor(titleBar);
|
||||
|
||||
sc.addOnDifferentSongListener(this);
|
||||
|
||||
versionLabel = new Label("Version: " + RhythmBullet.VERSION, core.getDefaultSkin(), "sub-font",
|
||||
core.getDefaultSkin().getColor("default"));
|
||||
versionLabel.setPosition(3, 3);
|
||||
addActor(versionLabel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void act(float delta) {
|
||||
super.act(delta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Batch batch, float parentAlpha) {
|
||||
super.draw(batch, parentAlpha);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDifferentSong(MusicManager mdp) {
|
||||
titleBar.getHvisual().setMDP(mdp);
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package zero1hd.rhythmbullet.ui.pages;
|
||||
package zero1hd.rhythmbullet.graphics.ui.pages;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.math.Vector3;
|
||||
@ -9,8 +9,8 @@ import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
|
||||
|
||||
import zero1hd.rhythmbullet.RhythmBullet;
|
||||
import zero1hd.rhythmbullet.controls.KeyMap;
|
||||
import zero1hd.rhythmbullet.ui.components.GraphicsTable;
|
||||
import zero1hd.rhythmbullet.ui.components.SetControls;
|
||||
import zero1hd.rhythmbullet.graphics.ui.components.GraphicsTable;
|
||||
import zero1hd.rhythmbullet.graphics.ui.components.SetControls;
|
||||
|
||||
public class MoreOptionsPage extends Page {
|
||||
private KeyMap keymap;
|
@ -1,4 +1,4 @@
|
||||
package zero1hd.rhythmbullet.ui.pages;
|
||||
package zero1hd.rhythmbullet.graphics.ui.pages;
|
||||
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
@ -18,7 +18,7 @@ import com.badlogic.gdx.utils.Array;
|
||||
|
||||
import zero1hd.rhythmbullet.audio.SongInfo;
|
||||
import zero1hd.rhythmbullet.audio.SongList;
|
||||
import zero1hd.rhythmbullet.ui.components.MusicSelectable;
|
||||
import zero1hd.rhythmbullet.graphics.ui.components.MusicSelectable;
|
||||
import zero1hd.rhythmbullet.util.MiniEvents;
|
||||
|
||||
public class MusicSelectionPage extends Page {
|
@ -1,4 +1,4 @@
|
||||
package zero1hd.rhythmbullet.ui.pages;
|
||||
package zero1hd.rhythmbullet.graphics.ui.pages;
|
||||
|
||||
import com.badlogic.gdx.math.Vector3;
|
||||
import com.badlogic.gdx.scenes.scene2d.Actor;
|
@ -1,4 +1,4 @@
|
||||
package zero1hd.rhythmbullet.ui.pages;
|
||||
package zero1hd.rhythmbullet.graphics.ui.pages;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.Input.Keys;
|
@ -1,4 +1,4 @@
|
||||
package zero1hd.rhythmbullet.ui.pages;
|
||||
package zero1hd.rhythmbullet.graphics.ui.pages;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.scenes.scene2d.Group;
|
@ -1,4 +1,4 @@
|
||||
package zero1hd.rhythmbullet.ui.pages;
|
||||
package zero1hd.rhythmbullet.graphics.ui.pages;
|
||||
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Label;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
|
@ -1,4 +1,4 @@
|
||||
package zero1hd.rhythmbullet.ui.windows;
|
||||
package zero1hd.rhythmbullet.graphics.ui.windows;
|
||||
|
||||
import com.badlogic.gdx.graphics.Pixmap;
|
||||
import com.badlogic.gdx.graphics.Pixmap.Format;
|
@ -1,4 +1,4 @@
|
||||
package zero1hd.rhythmbullet.ui.windows;
|
||||
package zero1hd.rhythmbullet.graphics.ui.windows;
|
||||
|
||||
import com.badlogic.gdx.scenes.scene2d.Actor;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Label;
|
@ -1,4 +1,4 @@
|
||||
package zero1hd.rhythmbullet.ui.windows;
|
||||
package zero1hd.rhythmbullet.graphics.ui.windows;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Label;
|
@ -1,4 +1,4 @@
|
||||
package zero1hd.rhythmbullet.ui.windows;
|
||||
package zero1hd.rhythmbullet.graphics.ui.windows;
|
||||
|
||||
import com.badlogic.gdx.assets.AssetManager;
|
||||
import com.badlogic.gdx.audio.Sound;
|
@ -1,4 +1,4 @@
|
||||
package zero1hd.rhythmbullet.ui.windows;
|
||||
package zero1hd.rhythmbullet.graphics.ui.windows;
|
||||
|
||||
import com.badlogic.gdx.Input.Keys;
|
||||
import com.badlogic.gdx.audio.Music;
|
@ -1,4 +1,4 @@
|
||||
package zero1hd.rhythmbullet.ui.windows;
|
||||
package zero1hd.rhythmbullet.graphics.ui.windows;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.files.FileHandle;
|
@ -1,4 +1,4 @@
|
||||
package zero1hd.rhythmbullet.ui.windows;
|
||||
package zero1hd.rhythmbullet.graphics.ui.windows;
|
||||
|
||||
import com.badlogic.gdx.assets.AssetManager;
|
||||
import com.badlogic.gdx.audio.Sound;
|
@ -1,4 +1,4 @@
|
||||
package zero1hd.rhythmbullet.ui.windows;
|
||||
package zero1hd.rhythmbullet.graphics.ui.windows;
|
||||
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Label;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
|
@ -1,4 +1,4 @@
|
||||
package zero1hd.rhythmbullet.ui.windows;
|
||||
package zero1hd.rhythmbullet.graphics.ui.windows;
|
||||
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
|
@ -1,4 +1,4 @@
|
||||
package zero1hd.rhythmbullet.ui.windows;
|
||||
package zero1hd.rhythmbullet.graphics.ui.windows;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.Input.Keys;
|
@ -1,4 +1,4 @@
|
||||
package zero1hd.rhythmbullet.ui.windows;
|
||||
package zero1hd.rhythmbullet.graphics.ui.windows;
|
||||
|
||||
import com.badlogic.gdx.Preferences;
|
||||
import com.badlogic.gdx.math.MathUtils;
|
@ -13,11 +13,11 @@ import com.badlogic.gdx.utils.viewport.ScreenViewport;
|
||||
|
||||
import zero1hd.rhythmbullet.RhythmBullet;
|
||||
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.ui.pages.CreditsPage;
|
||||
import zero1hd.rhythmbullet.ui.pages.MainPage;
|
||||
import zero1hd.rhythmbullet.ui.pages.MoreOptionsPage;
|
||||
import zero1hd.rhythmbullet.ui.pages.OptionsPage;
|
||||
import zero1hd.rhythmbullet.util.TransitionAdapter;
|
||||
|
||||
public class MainMenu extends ScreenAdapter implements TransitionAdapter {
|
||||
|
@ -9,8 +9,8 @@ import com.badlogic.gdx.utils.viewport.ScreenViewport;
|
||||
|
||||
import zero1hd.rhythmbullet.RhythmBullet;
|
||||
import zero1hd.rhythmbullet.audio.SongList;
|
||||
import zero1hd.rhythmbullet.ui.pages.AnalyzePage;
|
||||
import zero1hd.rhythmbullet.ui.pages.MusicSelectionPage;
|
||||
import zero1hd.rhythmbullet.graphics.ui.pages.AnalyzePage;
|
||||
import zero1hd.rhythmbullet.graphics.ui.pages.MusicSelectionPage;
|
||||
import zero1hd.rhythmbullet.util.MiniEvents;
|
||||
import zero1hd.rhythmbullet.util.MiniListener;
|
||||
import zero1hd.rhythmbullet.util.TransitionAdapter;
|
||||
|
@ -18,15 +18,15 @@ import zero1hd.rhythmbullet.audio.AudioAnalyzer;
|
||||
import zero1hd.rhythmbullet.audio.AudioDataPackage;
|
||||
import zero1hd.rhythmbullet.audio.SongList;
|
||||
import zero1hd.rhythmbullet.audio.map.RhythmMapAlgorithm;
|
||||
import zero1hd.rhythmbullet.graphics.ui.components.AudioGraph;
|
||||
import zero1hd.rhythmbullet.graphics.ui.windows.BeatViewer;
|
||||
import zero1hd.rhythmbullet.graphics.ui.windows.DifficultyWindow;
|
||||
import zero1hd.rhythmbullet.graphics.ui.windows.FPSWindow;
|
||||
import zero1hd.rhythmbullet.graphics.ui.windows.MusicController;
|
||||
import zero1hd.rhythmbullet.graphics.ui.windows.MusicSelector;
|
||||
import zero1hd.rhythmbullet.graphics.ui.windows.SpawnerWindow;
|
||||
import zero1hd.rhythmbullet.graphics.ui.windows.VolumeWindow;
|
||||
import zero1hd.rhythmbullet.screens.MainMenu;
|
||||
import zero1hd.rhythmbullet.ui.components.AudioGraph;
|
||||
import zero1hd.rhythmbullet.ui.windows.BeatViewer;
|
||||
import zero1hd.rhythmbullet.ui.windows.DifficultyWindow;
|
||||
import zero1hd.rhythmbullet.ui.windows.FPSWindow;
|
||||
import zero1hd.rhythmbullet.ui.windows.MusicController;
|
||||
import zero1hd.rhythmbullet.ui.windows.MusicSelector;
|
||||
import zero1hd.rhythmbullet.ui.windows.SpawnerWindow;
|
||||
import zero1hd.rhythmbullet.ui.windows.VolumeWindow;
|
||||
import zero1hd.rhythmbullet.util.MiniEvents;
|
||||
import zero1hd.rhythmbullet.util.MiniListener;
|
||||
|
||||
|
@ -20,9 +20,9 @@ import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
|
||||
|
||||
import zero1hd.rhythmbullet.RhythmBullet;
|
||||
import zero1hd.rhythmbullet.audio.MusicManager;
|
||||
import zero1hd.rhythmbullet.ui.components.HealthBar;
|
||||
import zero1hd.rhythmbullet.ui.windows.FPSWindow;
|
||||
import zero1hd.rhythmbullet.ui.windows.PauseMenu;
|
||||
import zero1hd.rhythmbullet.graphics.ui.components.HealthBar;
|
||||
import zero1hd.rhythmbullet.graphics.ui.windows.FPSWindow;
|
||||
import zero1hd.rhythmbullet.graphics.ui.windows.PauseMenu;
|
||||
import zero1hd.rhythmbullet.util.ScoreManager;
|
||||
|
||||
public class GameHUD extends Stage {
|
||||
|
@ -1,139 +0,0 @@
|
||||
package zero1hd.rhythmbullet.ui.pages;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.graphics.Texture;
|
||||
import com.badlogic.gdx.graphics.g2d.Batch;
|
||||
import com.badlogic.gdx.math.Vector3;
|
||||
import com.badlogic.gdx.scenes.scene2d.Actor;
|
||||
import com.badlogic.gdx.scenes.scene2d.InputEvent;
|
||||
import com.badlogic.gdx.scenes.scene2d.actions.Actions;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Image;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Label;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup;
|
||||
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
|
||||
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
|
||||
|
||||
import zero1hd.rhythmbullet.RhythmBullet;
|
||||
import zero1hd.rhythmbullet.audio.MusicManager;
|
||||
import zero1hd.rhythmbullet.audio.SongListController;
|
||||
import zero1hd.rhythmbullet.events.OnDifferentSongListener;
|
||||
import zero1hd.rhythmbullet.screens.PreGameScreen;
|
||||
import zero1hd.rhythmbullet.ui.components.Visualizer;
|
||||
|
||||
public class MainPage extends Page implements OnDifferentSongListener {
|
||||
private Image title;
|
||||
private Label versionLabel;
|
||||
private TextButton options;
|
||||
private Image cyberCircle;
|
||||
private Label begin;
|
||||
private TextButton quit;
|
||||
private TextButton credits;
|
||||
private WidgetGroup playButton;
|
||||
|
||||
private SongListController sc;
|
||||
private Visualizer hvisual;
|
||||
|
||||
public MainPage(RhythmBullet core, Vector3 targetPosition, SongListController sc) {
|
||||
hvisual = new Visualizer();
|
||||
this.sc = sc;
|
||||
sc.addOnDifferentSongListener(this);
|
||||
hvisual.setMDP(sc.getCurrentSong());
|
||||
addActor(hvisual);
|
||||
title = new Image(core.getAssetManager().get("title.png", Texture.class));
|
||||
title.setPosition(10, getHeight() - title.getHeight()-30);
|
||||
addActor(title);
|
||||
versionLabel = new Label("Version: " + RhythmBullet.VERSION, core.getDefaultSkin(), "sub-font",
|
||||
core.getDefaultSkin().getColor("default"));
|
||||
versionLabel.setPosition(3, 3);
|
||||
addActor(versionLabel);
|
||||
|
||||
options = new TextButton(" Options ", core.getDefaultSkin(), "left");
|
||||
options.addListener(new ChangeListener() {
|
||||
@Override
|
||||
public void changed(ChangeEvent event, Actor actor) {
|
||||
targetPosition.x = 1.5f * getWidth();
|
||||
}
|
||||
});
|
||||
options.setPosition(-options.getWidth(), title.getY() - options.getHeight() - 30);
|
||||
options.addAction(Actions.sequence(Actions.delay(0.25f), Actions.moveTo(0, options.getY(), 0.5f)));
|
||||
addActor(options);
|
||||
|
||||
credits = new TextButton(" Credits ", core.getDefaultSkin(), "left");
|
||||
credits.addListener(new ChangeListener() {
|
||||
|
||||
@Override
|
||||
public void changed(ChangeEvent event, Actor actor) {
|
||||
targetPosition.y = 1.5f * getHeight();
|
||||
}
|
||||
});
|
||||
credits.setPosition(-credits.getWidth(), options.getY() - credits.getHeight() - 10);
|
||||
credits.addAction(Actions.sequence(Actions.delay(0.5f), Actions.moveTo(0, credits.getY(), 0.5f)));
|
||||
addActor(credits);
|
||||
|
||||
quit = new TextButton(" Quit ", core.getDefaultSkin(), "left");
|
||||
quit.setPosition(-quit.getWidth(), credits.getY() - credits.getHeight() - 10);
|
||||
quit.addListener(new ChangeListener() {
|
||||
|
||||
@Override
|
||||
public void changed(ChangeEvent event, Actor actor) {
|
||||
Gdx.app.exit();
|
||||
}
|
||||
|
||||
});
|
||||
quit.addAction(Actions.sequence(Actions.delay(0.75f), Actions.moveTo(0, quit.getY(), 0.5f)));
|
||||
addActor(quit);
|
||||
|
||||
// begin play button
|
||||
playButton = new WidgetGroup();
|
||||
|
||||
cyberCircle = new Image(core.getAssetManager().get("Tech-Circle1.png", Texture.class));
|
||||
cyberCircle.setOrigin(cyberCircle.getWidth() / 2, cyberCircle.getHeight() / 2);
|
||||
cyberCircle.setColor(0.7f, 0.7f, 0.7f, 0.8f);
|
||||
cyberCircle.addAction(Actions.forever(Actions.rotateBy(-360f, 10f)));
|
||||
playButton.addActor(cyberCircle);
|
||||
playButton.setSize(cyberCircle.getWidth(), cyberCircle.getHeight());
|
||||
|
||||
begin = new Label("Play", core.getDefaultSkin(), "special-font", core.getDefaultSkin().getColor("default"));
|
||||
begin.setColor(1f, 1f, 1f, 1f);
|
||||
playButton.addActor(begin);
|
||||
begin.setPosition(((playButton.getWidth() - begin.getWidth()) / 2)-10,
|
||||
(playButton.getHeight() - begin.getHeight()) / 2);
|
||||
playButton.setPosition(getWidth() - cyberCircle.getWidth() * 3 / 4, -cyberCircle.getHeight() / 4);
|
||||
|
||||
// begin animation of begin button
|
||||
playButton.addListener(new ClickListener() {
|
||||
@Override
|
||||
public void clicked(InputEvent event, float x, float y) {
|
||||
if (targetPosition.x == 0.5f * getWidth()) {
|
||||
cyberCircle.addAction(
|
||||
Actions.sequence(Actions.parallel(Actions.scaleBy(2f, 2f, 0.25f), Actions.fadeOut(0.25f)),
|
||||
Actions.run(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
core.setScreen(new PreGameScreen(core, sc.getSongList()));
|
||||
}
|
||||
}), Actions.parallel(Actions.scaleTo(1, 1), Actions.alpha(0.6f))));
|
||||
}
|
||||
super.clicked(event, x, y);
|
||||
}
|
||||
});
|
||||
addActor(playButton);
|
||||
// end play button
|
||||
}
|
||||
|
||||
@Override
|
||||
public void act(float delta) {
|
||||
super.act(delta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Batch batch, float parentAlpha) {
|
||||
super.draw(batch, parentAlpha);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDifferentSong(MusicManager mdp) {
|
||||
hvisual.setMDP(mdp);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user