more restructuring that makes more sense
This commit is contained in:
@@ -3,8 +3,12 @@ package zero1hd.rhythmbullet.desktop;
|
||||
import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
|
||||
import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;
|
||||
|
||||
import zero1hd.rhythmbullet.RhythmBullet;
|
||||
import zero1hd.rhythmbullet.desktop.screens.LoadingScreen;
|
||||
|
||||
public class DesktopLauncher {
|
||||
public static void main (String[] arg) {
|
||||
RhythmBullet core;
|
||||
LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
|
||||
config.title = "Rhythm Bullet";
|
||||
config.resizable = false;
|
||||
@@ -12,6 +16,10 @@ public class DesktopLauncher {
|
||||
config.useHDPI = true;
|
||||
config.vSyncEnabled = false;
|
||||
config.foregroundFPS = 0;
|
||||
new LwjglApplication(new RhythmBullet(), config);
|
||||
core = new RhythmBullet();
|
||||
core.setInitialScreen(new LoadingScreen(core));
|
||||
new LwjglApplication(core, config);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -1,340 +0,0 @@
|
||||
package zero1hd.rhythmbullet.desktop;
|
||||
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.badlogic.gdx.Application;
|
||||
import com.badlogic.gdx.Game;
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.Preferences;
|
||||
import com.badlogic.gdx.assets.AssetManager;
|
||||
import com.badlogic.gdx.assets.loaders.ParticleEffectLoader;
|
||||
import com.badlogic.gdx.assets.loaders.SoundLoader;
|
||||
import com.badlogic.gdx.assets.loaders.TextureAtlasLoader;
|
||||
import com.badlogic.gdx.assets.loaders.TextureLoader;
|
||||
import com.badlogic.gdx.assets.loaders.resolvers.InternalFileHandleResolver;
|
||||
import com.badlogic.gdx.assets.loaders.resolvers.ResolutionFileResolver.Resolution;
|
||||
import com.badlogic.gdx.audio.Sound;
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.graphics.Texture;
|
||||
import com.badlogic.gdx.graphics.g2d.ParticleEffect;
|
||||
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
|
||||
import com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator;
|
||||
import com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator.FreeTypeFontParameter;
|
||||
import com.badlogic.gdx.math.MathUtils;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.CheckBox.CheckBoxStyle;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.ImageButton.ImageButtonStyle;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Label.LabelStyle;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.List.ListStyle;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane.ScrollPaneStyle;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.SelectBox.SelectBoxStyle;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Slider.SliderStyle;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.TextButton.TextButtonStyle;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.TextField.TextFieldStyle;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Window.WindowStyle;
|
||||
|
||||
import zero1hd.rhythmbullet.desktop.screens.LoadingScreen;
|
||||
import zero1hd.rhythmbullet.util.GenericFileTypeHandler;
|
||||
import zero1hd.rhythmbullet.util.RoundingResolutionHandler;
|
||||
import zero1hd.rhythmbullet.util.TransitionAdapter;
|
||||
|
||||
|
||||
public class RhythmBullet extends Game {
|
||||
private boolean initComplete = false;
|
||||
private boolean resizing;
|
||||
|
||||
public static final int GAME_AREA_WIDTH = 64;
|
||||
public static final int GAME_AREA_HEIGHT = 48;
|
||||
public static final String VERSION = "(0.1)R1-PreAlpha";
|
||||
|
||||
private AssetManager assetManager = new AssetManager();
|
||||
private Skin defaultSkin = new Skin();
|
||||
private FreeTypeFontGenerator default_fontGenerator;
|
||||
private FreeTypeFontGenerator darktech_ldr_fontGenerator;
|
||||
TextureAtlas skinAtlas;
|
||||
private Preferences prefs;
|
||||
private RoundingResolutionHandler rRHandler;
|
||||
|
||||
@Override
|
||||
public void create() {
|
||||
Gdx.app.setLogLevel(Application.LOG_DEBUG);
|
||||
|
||||
prefs = Gdx.app.getPreferences("PolyJet_Preferences");
|
||||
|
||||
if (getPrefs().getBoolean("fullscreen", true)) {
|
||||
Gdx.graphics.setFullscreenMode(Gdx.graphics.getDisplayMode());
|
||||
} else {
|
||||
Gdx.graphics.setWindowedMode(getPrefs().getInteger("screen-width"), getPrefs().getInteger("screen-height"));
|
||||
}
|
||||
|
||||
Resolution[] resolution = {
|
||||
new Resolution(1280, 720, "1280x720"),
|
||||
new Resolution(1366, 768, "1366x768"),
|
||||
new Resolution(1280, 800, "1280x800"),
|
||||
new Resolution(1920, 1080, "1920x1080"),
|
||||
new Resolution(1920, 1200, "1920x1200"),
|
||||
new Resolution(2560, 1440, "2560x1440"),
|
||||
new Resolution(3840, 2160, "3840x2160")
|
||||
};
|
||||
|
||||
InternalFileHandleResolver internalFileResolver = new InternalFileHandleResolver();
|
||||
rRHandler = new RoundingResolutionHandler(internalFileResolver, resolution);
|
||||
GenericFileTypeHandler genericFileFinder = new GenericFileTypeHandler(internalFileResolver);
|
||||
assetManager.setLoader(TextureAtlas.class, new TextureAtlasLoader(rRHandler));
|
||||
assetManager.setLoader(Texture.class, new TextureLoader(rRHandler));
|
||||
assetManager.setLoader(ParticleEffect.class, new ParticleEffectLoader(genericFileFinder));
|
||||
assetManager.setLoader(Sound.class, new SoundLoader(genericFileFinder));
|
||||
default_fontGenerator = new FreeTypeFontGenerator(Gdx.files.internal("fonts/Gasalt-Regular.ttf"));
|
||||
darktech_ldr_fontGenerator = new FreeTypeFontGenerator(Gdx.files.internal("fonts/darktech_ldr.ttf"));
|
||||
|
||||
getrRHandler().setResolution(getPrefs().getInteger("screen-width"), getPrefs().getInteger("screen-height"));
|
||||
|
||||
Gdx.app.debug("Prelaunch Debug Info", "\ncurrent window size: "
|
||||
+ Gdx.graphics.getWidth() + "x" + Gdx.graphics.getHeight() +"\n"
|
||||
+ "Pixel density (PPI): " + Gdx.graphics.getDensity());
|
||||
|
||||
setScreen(new LoadingScreen(this));
|
||||
|
||||
Logger.getLogger("org.jaudiotagger").setLevel(Level.OFF);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render() {
|
||||
if (resizing) {
|
||||
if (assetManager.update()) {
|
||||
Gdx.app.debug("Resize", "Post transition is happening");
|
||||
resizing = false;
|
||||
generateFonts(Gdx.graphics.getHeight());
|
||||
defineSkinStyles();
|
||||
assetManager.get("standard_thrust.p", ParticleEffect.class).flipY();
|
||||
if (initComplete) {
|
||||
((TransitionAdapter) getScreen()).postTransition(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
super.render();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
Gdx.app.debug("Core", "disposing...");
|
||||
if (initComplete) {
|
||||
skinAtlas.dispose();
|
||||
getDefaultSkin().dispose();
|
||||
default_fontGenerator.dispose();
|
||||
darktech_ldr_fontGenerator.dispose();
|
||||
assetManager.dispose();
|
||||
getScreen().dispose();
|
||||
}
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resize(int width, int height) {
|
||||
if (initComplete) {
|
||||
Gdx.app.debug("Resize", "Pre-transition is happening. Using resolution " + width + "x" + height);
|
||||
rRHandler.setResolution(width, height);
|
||||
((TransitionAdapter) getScreen()).preTransition();
|
||||
assetManager.clear();
|
||||
prefs.putInteger("screen-width", width);
|
||||
prefs.putInteger("screen-height", height);
|
||||
prefs.flush();
|
||||
resizing = true;
|
||||
queueAssets();
|
||||
}
|
||||
super.resize(width, height);
|
||||
}
|
||||
|
||||
public int fontScale(float fontSize, int height) {
|
||||
int size = MathUtils.round(Gdx.graphics.getDensity()*(fontSize*height));
|
||||
if (size >= 200) {
|
||||
size = 200;
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
||||
public AssetManager getAssetManager() {
|
||||
return assetManager;
|
||||
}
|
||||
|
||||
public Skin getDefaultSkin() {
|
||||
return defaultSkin;
|
||||
}
|
||||
|
||||
public Preferences getPrefs() {
|
||||
return prefs;
|
||||
}
|
||||
|
||||
public void setInitComplete() {
|
||||
initComplete = true;
|
||||
}
|
||||
|
||||
public void queueAssets() {
|
||||
assetManager.load("uiskin.atlas", TextureAtlas.class);
|
||||
assetManager.load("Tech-Circle1.png", Texture.class);
|
||||
assetManager.load("polyjet-standard.png", Texture.class);
|
||||
assetManager.load("standard_thrust.p", ParticleEffect.class);
|
||||
assetManager.load("keyboard.atlas", TextureAtlas.class);
|
||||
assetManager.load("cybercircle3B.png", Texture.class);
|
||||
assetManager.load("title.png", Texture.class);
|
||||
assetManager.load("cybercircle1.png", Texture.class);
|
||||
assetManager.load("defaultCover.png", Texture.class);
|
||||
assetManager.load("teleport-cloak.p", ParticleEffect.class);
|
||||
assetManager.load("pop_open.ogg", Sound.class);
|
||||
assetManager.load("pop_close.ogg", Sound.class);
|
||||
assetManager.load("laser.png", Texture.class);
|
||||
assetManager.load("pellet.png", Texture.class);
|
||||
assetManager.load("shard.png", Texture.class);
|
||||
assetManager.load("bar.png", Texture.class);
|
||||
assetManager.load("flake.png", Texture.class);
|
||||
assetManager.load("star_bg.png", Texture.class);
|
||||
assetManager.load("void_circle.png", Texture.class);
|
||||
assetManager.load("laser.ogg", Sound.class);
|
||||
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);
|
||||
assetManager.load("gradients.atlas", TextureAtlas.class);
|
||||
}
|
||||
|
||||
public void generateFonts(final int height) {
|
||||
defaultSkin = new Skin();
|
||||
Gdx.app.debug("Prelaunch Debug Info", "Generating fonts with screen height of " + height);
|
||||
skinAtlas = assetManager.get("uiskin.atlas", TextureAtlas.class);
|
||||
getDefaultSkin().addRegions(skinAtlas);
|
||||
|
||||
getDefaultSkin().add("window-font", default_fontGenerator.generateFont(new FreeTypeFontParameter() {
|
||||
{
|
||||
size = 18;
|
||||
}
|
||||
}));
|
||||
getDefaultSkin().add("sub-font", default_fontGenerator.generateFont(new FreeTypeFontParameter() {
|
||||
{
|
||||
size = fontScale(0.05f, height);
|
||||
}
|
||||
}));
|
||||
getDefaultSkin().add("default-font", default_fontGenerator.generateFont(new FreeTypeFontParameter() {
|
||||
{
|
||||
size = fontScale(0.07f, height);
|
||||
}
|
||||
}));
|
||||
getDefaultSkin().add("large-font", default_fontGenerator.generateFont(new FreeTypeFontParameter() {
|
||||
{
|
||||
size = fontScale(0.085f, height);
|
||||
}
|
||||
}));
|
||||
getDefaultSkin().add("special-font", darktech_ldr_fontGenerator.generateFont(new FreeTypeFontParameter() {
|
||||
{
|
||||
size = fontScale(0.075f, height);
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
public void defineSkinStyles() {
|
||||
getDefaultSkin().add("default", Color.WHITE);
|
||||
getDefaultSkin().add("inverse", Color.BLACK);
|
||||
|
||||
TextButtonStyle defaultTextButton = new TextButtonStyle();
|
||||
defaultTextButton.up = getDefaultSkin().getDrawable("rect");
|
||||
defaultTextButton.down = getDefaultSkin().getDrawable("rect-down");
|
||||
defaultTextButton.font = getDefaultSkin().getFont("default-font");
|
||||
defaultTextButton.fontColor = getDefaultSkin().getColor("default");
|
||||
defaultTextButton.disabled = getDefaultSkin().getDrawable("rect-disabled");
|
||||
getDefaultSkin().add("default", defaultTextButton);
|
||||
|
||||
TextButtonStyle subTextbutton = new TextButtonStyle(defaultTextButton);
|
||||
subTextbutton.font = getDefaultSkin().getFont("sub-font");
|
||||
getDefaultSkin().add("sub", subTextbutton);
|
||||
|
||||
TextButtonStyle windowTextButton = new TextButtonStyle(defaultTextButton);
|
||||
windowTextButton.font = getDefaultSkin().getFont("window-font");
|
||||
getDefaultSkin().add("window", windowTextButton);
|
||||
|
||||
TextButtonStyle textButtonLeft = new TextButtonStyle();
|
||||
textButtonLeft.up = getDefaultSkin().getDrawable("left-button");
|
||||
textButtonLeft.down = getDefaultSkin().getDrawable("left-button-down");
|
||||
textButtonLeft.font = getDefaultSkin().getFont("default-font");
|
||||
textButtonLeft.fontColor = getDefaultSkin().getColor("default");
|
||||
getDefaultSkin().add("left", textButtonLeft);
|
||||
|
||||
SliderStyle defaultSlider = new SliderStyle(getDefaultSkin().getDrawable("default-slider"), getDefaultSkin().getDrawable("default-slider-knob"));
|
||||
getDefaultSkin().add("default-horizontal", defaultSlider);
|
||||
|
||||
SliderStyle vertSlider = new SliderStyle(defaultSlider);
|
||||
vertSlider.knob = getDefaultSkin().getDrawable("vertical-slider-knob");
|
||||
getDefaultSkin().add("default-vertical", vertSlider);
|
||||
|
||||
LabelStyle defaultLabel = new LabelStyle();
|
||||
defaultLabel.font = getDefaultSkin().getFont("default-font");
|
||||
defaultLabel.fontColor = getDefaultSkin().getColor("default");
|
||||
getDefaultSkin().add("default", defaultLabel);
|
||||
|
||||
TextFieldStyle defaultTextField = new TextFieldStyle(getDefaultSkin().getFont("sub-font"), getDefaultSkin().getColor("default"), getDefaultSkin().getDrawable("cursor"), getDefaultSkin().getDrawable("selection"), getDefaultSkin().getDrawable("textfield"));
|
||||
getDefaultSkin().add("default", defaultTextField);
|
||||
|
||||
TextFieldStyle uiTextField = new TextFieldStyle(defaultTextField);
|
||||
uiTextField.font = getDefaultSkin().getFont("window-font");
|
||||
getDefaultSkin().add("ui", uiTextField);
|
||||
|
||||
WindowStyle defaultWindow = new WindowStyle(getDefaultSkin().getFont("window-font"), getDefaultSkin().getColor("default"), getDefaultSkin().getDrawable("default-window"));
|
||||
getDefaultSkin().add("default", defaultWindow);
|
||||
|
||||
WindowStyle tintedWindow = new WindowStyle(defaultWindow);
|
||||
tintedWindow.titleFontColor = getDefaultSkin().getColor("inverse");
|
||||
tintedWindow.background = getDefaultSkin().getDrawable("tinted-window");
|
||||
getDefaultSkin().add("tinted", tintedWindow);
|
||||
|
||||
ListStyle defaultList = new ListStyle(getDefaultSkin().getFont("window-font"), getDefaultSkin().getColor("inverse"), getDefaultSkin().getColor("default"), getDefaultSkin().getDrawable("selection"));
|
||||
getDefaultSkin().add("default", defaultList);
|
||||
|
||||
ScrollPaneStyle defaultScrollPane = new ScrollPaneStyle();
|
||||
defaultScrollPane.vScroll = getDefaultSkin().getDrawable("default-scroll");
|
||||
defaultScrollPane.hScrollKnob = getDefaultSkin().getDrawable("default-round-large");
|
||||
defaultScrollPane.hScroll = getDefaultSkin().getDrawable("default-scroll");
|
||||
defaultScrollPane.vScrollKnob = getDefaultSkin().getDrawable("default-round-large");
|
||||
getDefaultSkin().add("default", defaultScrollPane);
|
||||
|
||||
CheckBoxStyle defaultCheckBox = new CheckBoxStyle(getDefaultSkin().getDrawable("check-off"), getDefaultSkin().getDrawable("check-on"), getDefaultSkin().getFont("window-font"), getDefaultSkin().getColor("default"));
|
||||
defaultCheckBox.checkboxOffDisabled = getDefaultSkin().getDrawable("check-disabled");
|
||||
getDefaultSkin().add("default", defaultCheckBox);
|
||||
|
||||
SelectBoxStyle defaultSelectBox = new SelectBoxStyle(getDefaultSkin().getFont("default-font"), getDefaultSkin().getColor("default"), getDefaultSkin().getDrawable("default-select"), defaultScrollPane, defaultList);
|
||||
getDefaultSkin().add("default", defaultSelectBox);
|
||||
|
||||
Gdx.app.debug("Prelaunch Debug Info", "UI Skin has been defined.");
|
||||
|
||||
CheckBoxStyle playButtonStyle = new CheckBoxStyle(defaultCheckBox);
|
||||
playButtonStyle.checkboxOn = getDefaultSkin().getDrawable("play-down");
|
||||
playButtonStyle.checkboxOff = getDefaultSkin().getDrawable("play");
|
||||
getDefaultSkin().add("play-button", playButtonStyle);
|
||||
|
||||
ImageButtonStyle pauseButtonStyle = new ImageButtonStyle();
|
||||
pauseButtonStyle.down = getDefaultSkin().getDrawable("pause-down");
|
||||
pauseButtonStyle.up = getDefaultSkin().getDrawable("pause");
|
||||
getDefaultSkin().add("pause-button", pauseButtonStyle);
|
||||
|
||||
ImageButtonStyle fastForwardButtonStyle = new ImageButtonStyle();
|
||||
fastForwardButtonStyle.down = getDefaultSkin().getDrawable("fast-forward-down");
|
||||
fastForwardButtonStyle.up = getDefaultSkin().getDrawable("fast-forward");
|
||||
getDefaultSkin().add("fast-forward-button", fastForwardButtonStyle);
|
||||
|
||||
ImageButtonStyle reverseButtonStyle = new ImageButtonStyle();
|
||||
reverseButtonStyle.down = getDefaultSkin().getDrawable("rewind-down");
|
||||
reverseButtonStyle.up = getDefaultSkin().getDrawable("rewind");
|
||||
getDefaultSkin().add("rewind-button", reverseButtonStyle);
|
||||
|
||||
CheckBoxStyle shuffleButtonStyle = new CheckBoxStyle(defaultCheckBox);
|
||||
shuffleButtonStyle.checkboxOff = getDefaultSkin().getDrawable("shuffle");
|
||||
shuffleButtonStyle.checkboxOn = getDefaultSkin().getDrawable("shuffle-down");
|
||||
getDefaultSkin().add("shuffle-button", shuffleButtonStyle);
|
||||
|
||||
}
|
||||
|
||||
public RoundingResolutionHandler getrRHandler() {
|
||||
return rRHandler;
|
||||
}
|
||||
|
||||
}
|
@@ -2,10 +2,10 @@ package zero1hd.rhythmbullet.desktop.audio.map;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import zero1hd.rhythmbullet.desktop.entity.Entity;
|
||||
import zero1hd.rhythmbullet.desktop.entity.EntityFrame;
|
||||
import zero1hd.rhythmbullet.desktop.entity.coordinator.Coordinator;
|
||||
import zero1hd.rhythmbullet.desktop.entity.coordinator.CoordinatorFrame;
|
||||
import zero1hd.rhythmbullet.entity.Entity;
|
||||
import zero1hd.rhythmbullet.entity.EntityFrame;
|
||||
import zero1hd.rhythmbullet.entity.coordinator.Coordinator;
|
||||
import zero1hd.rhythmbullet.entity.coordinator.CoordinatorFrame;
|
||||
|
||||
public class EntitySpawnInfo {
|
||||
private EntityFrame<? extends Entity> entityToSpawn;
|
||||
|
@@ -1,9 +1,9 @@
|
||||
package zero1hd.rhythmbullet.desktop.audio.map;
|
||||
|
||||
import zero1hd.rhythmbullet.desktop.entity.Entity;
|
||||
import zero1hd.rhythmbullet.desktop.entity.EntityFrame;
|
||||
import zero1hd.rhythmbullet.desktop.entity.coordinator.Coordinator;
|
||||
import zero1hd.rhythmbullet.desktop.entity.coordinator.CoordinatorFrame;
|
||||
import zero1hd.rhythmbullet.entity.Entity;
|
||||
import zero1hd.rhythmbullet.entity.EntityFrame;
|
||||
import zero1hd.rhythmbullet.entity.coordinator.Coordinator;
|
||||
import zero1hd.rhythmbullet.entity.coordinator.CoordinatorFrame;
|
||||
import zero1hd.rhythmbullet.util.MusicManager;
|
||||
|
||||
public class GamePlayMap {
|
||||
|
@@ -5,10 +5,10 @@ import org.apache.commons.math3.random.MersenneTwister;
|
||||
import com.badlogic.gdx.math.MathUtils;
|
||||
import com.badlogic.gdx.utils.FloatArray;
|
||||
|
||||
import zero1hd.rhythmbullet.RhythmBullet;
|
||||
import zero1hd.rhythmbullet.audio.AudioDataPackage;
|
||||
import zero1hd.rhythmbullet.desktop.RhythmBullet;
|
||||
import zero1hd.rhythmbullet.desktop.entity.EntityManager;
|
||||
import zero1hd.rhythmbullet.desktop.entity.coordinator.CoordinatorManager;
|
||||
import zero1hd.rhythmbullet.entity.EntityManager;
|
||||
import zero1hd.rhythmbullet.entity.coordinator.CoordinatorManager;
|
||||
import zero1hd.rhythmbullet.util.MiniEvents;
|
||||
import zero1hd.rhythmbullet.util.MiniSender;
|
||||
|
||||
|
@@ -1,101 +0,0 @@
|
||||
package zero1hd.rhythmbullet.desktop.entity;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.Preferences;
|
||||
import com.badlogic.gdx.assets.AssetManager;
|
||||
import com.badlogic.gdx.audio.Sound;
|
||||
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.utils.Array;
|
||||
|
||||
import zero1hd.rhythmbullet.desktop.RhythmBullet;
|
||||
|
||||
public class CollisionDetector {
|
||||
Array<Entity> enemies;
|
||||
Array<Entity> allies;
|
||||
|
||||
AssetManager assets;
|
||||
Preferences prefs;
|
||||
|
||||
//Particle pools;
|
||||
ParticleEffectPool explosionEffectPool;
|
||||
Array<PooledEffect> effects = new Array<>();
|
||||
|
||||
private int amassedPoints;
|
||||
Sound explosionSFX;
|
||||
public CollisionDetector(Array<Entity> enemies, Array<Entity> allies, AssetManager assetManager, Preferences prefs) {
|
||||
this.enemies = enemies;
|
||||
this.allies = allies;
|
||||
assets = assetManager;
|
||||
this.prefs = prefs;
|
||||
|
||||
explosionEffectPool = new ParticleEffectPool(assets.get("explosion-s.p", ParticleEffect.class), 1, 64);
|
||||
explosionSFX = assets.get("explosion.ogg", Sound.class);
|
||||
}
|
||||
|
||||
public void collisionCheck() {
|
||||
if ((enemies.size != 0) && (allies.size != 0)) {
|
||||
for (int f = 0; f < enemies.size; f++) {
|
||||
Entity enemy = enemies.get(f);
|
||||
if (enemy.getHitZone() != null) {
|
||||
for (int s = 0; s < allies.size; s++) {
|
||||
Entity ally = allies.get(s);
|
||||
if (ally.getHitZone() != null) {
|
||||
if (enemy.getHitZone().overlaps(ally.getHitZone())) {
|
||||
Gdx.app.debug("Collision Detector", "Collision between entities: " + enemy.getClass().getSimpleName() + " and " + ally.getClass().getSimpleName());
|
||||
|
||||
//Play FX;
|
||||
if (ally.playCollideSFX() && enemy.playCollideSFX()) {
|
||||
explosionSFX.play(prefs.getFloat("fx vol")/100f, 1f, (enemy.getX()/RhythmBullet.GAME_AREA_WIDTH));
|
||||
}
|
||||
if (ally.playCollidePFX() && enemy.playCollidePFX()) {
|
||||
PooledEffect currentPFX;
|
||||
currentPFX = explosionEffectPool.obtain();
|
||||
currentPFX.setPosition(ally.getX() + ally.getWidth()/2f, ally.getY() + ally.getHeight()/2f);
|
||||
effects.add(currentPFX);
|
||||
}
|
||||
|
||||
enemy.collided(ally);
|
||||
ally.collided(enemy);
|
||||
|
||||
amassedPoints += enemy.getPoints();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* draws the explosion particles where necessary.
|
||||
* @param batch the batch used to draw the said particles
|
||||
* @param cleanBatch whether this method should call begin and end on the batch.
|
||||
*/
|
||||
public void renderParticles(Batch batch, float delta, boolean cleanBatch) {
|
||||
if (cleanBatch) {
|
||||
batch.begin();
|
||||
}
|
||||
for (int i = 0; i < effects.size; i++) {
|
||||
effects.get(i).draw(batch, delta);
|
||||
if (effects.get(i).isComplete()) {
|
||||
effects.get(i).free();
|
||||
effects.removeIndex(i);
|
||||
}
|
||||
}
|
||||
|
||||
if (cleanBatch) {
|
||||
batch.end();
|
||||
}
|
||||
}
|
||||
|
||||
public int getAmassedPoints() {
|
||||
int amassedPoints = this.amassedPoints;
|
||||
this.amassedPoints = 0;
|
||||
return amassedPoints;
|
||||
}
|
||||
}
|
@@ -1,208 +0,0 @@
|
||||
package zero1hd.rhythmbullet.desktop.entity;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import com.badlogic.gdx.Preferences;
|
||||
import com.badlogic.gdx.assets.AssetManager;
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.graphics.g2d.Batch;
|
||||
import com.badlogic.gdx.graphics.g2d.Sprite;
|
||||
import com.badlogic.gdx.math.MathUtils;
|
||||
import com.badlogic.gdx.math.Rectangle;
|
||||
import com.badlogic.gdx.math.Vector2;
|
||||
import com.badlogic.gdx.scenes.scene2d.Actor;
|
||||
import com.badlogic.gdx.utils.Pool.Poolable;
|
||||
|
||||
import zero1hd.rhythmbullet.desktop.RhythmBullet;
|
||||
import zero1hd.rhythmbullet.desktop.entity.coordinator.Coordinator;
|
||||
|
||||
public class Entity extends Actor implements Poolable {
|
||||
private Coordinator coordinator;
|
||||
private EntityFrame<?> ef;
|
||||
|
||||
protected AssetManager assets;
|
||||
protected Preferences prefs;
|
||||
protected EntityManager ec;
|
||||
|
||||
protected boolean enemy;
|
||||
protected boolean simple = true;
|
||||
protected boolean nonStnrd = false;
|
||||
protected boolean move = true;
|
||||
|
||||
protected boolean dead;
|
||||
protected Rectangle hitbox;
|
||||
protected Sprite sprite;
|
||||
protected Vector2 rotRatios;
|
||||
protected Vector2 center;
|
||||
public float angle;
|
||||
public float speed;
|
||||
|
||||
protected int points;
|
||||
|
||||
/**
|
||||
* called by the entity frame and only once (when this object is created).
|
||||
* Used by the frame to setup variables for simple calling later.
|
||||
* Anything that needs to be setup for the entity on first call should not override this.
|
||||
* (Unless you call the super of this and then the rest which is fine too).
|
||||
* This will then call preInit() which is the method you should override.
|
||||
*/
|
||||
protected void setup(EntityManager ec, EntityFrame<?> ef) {
|
||||
this.ec = ec;
|
||||
this.ef = ef;
|
||||
assets = ec.getAssets();
|
||||
prefs = ec.getPrefs();
|
||||
rotRatios = new Vector2();
|
||||
center = new Vector2();
|
||||
hitbox = new Rectangle();
|
||||
|
||||
preInit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to override should any setup need to be done once (on entity first creation).
|
||||
*/
|
||||
public void preInit() {
|
||||
if (sprite.getTexture() == null) throw new NullPointerException("what, your not going to have a texture for your entity?");
|
||||
sprite.setOriginCenter();
|
||||
}
|
||||
|
||||
/**
|
||||
* used by the game stage to pass parameters for different types of entities.
|
||||
* @param params a hashmap containing parameters necessary for different entities.
|
||||
*/
|
||||
public void init(HashMap<String, Float> params) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Called whenever a collision is detected
|
||||
* @param entity is the entity that hit this one.
|
||||
*/
|
||||
public void collided(Entity entity) {
|
||||
}
|
||||
|
||||
/**
|
||||
* gets the box that represents the hit box to calculate whether there is a collision or not
|
||||
* @return the object that represents the hit box
|
||||
*/
|
||||
public Rectangle getHitZone() {
|
||||
return hitbox;
|
||||
}
|
||||
|
||||
public boolean isDead() {
|
||||
return dead;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void act(float delta) {
|
||||
if (!nonStnrd) {
|
||||
if (coordinator != null) {
|
||||
coordinator.coordinate(delta);
|
||||
}
|
||||
|
||||
if (move) {
|
||||
move(delta, true);
|
||||
}
|
||||
if (dead) {
|
||||
ef.recycleEntity(this);
|
||||
}
|
||||
}
|
||||
|
||||
if (angle >= 360f) {
|
||||
angle -= 360f;
|
||||
}
|
||||
|
||||
if (getX() > RhythmBullet.GAME_AREA_WIDTH || getY() > RhythmBullet.GAME_AREA_HEIGHT || getX() < 0-getWidth() || getY() < 0-getHeight()) {
|
||||
dead = true;
|
||||
}
|
||||
super.act(delta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Batch batch, float parentAlpha) {
|
||||
if (!nonStnrd) {
|
||||
sprite.draw(batch);
|
||||
}
|
||||
batch.setColor(Color.WHITE);
|
||||
super.draw(batch, parentAlpha);
|
||||
}
|
||||
|
||||
public boolean playCollidePFX() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean playCollideSFX() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void move(float delta, boolean update) {
|
||||
rotRatios.set(MathUtils.cosDeg(angle), MathUtils.sinDeg(angle));
|
||||
moveBy(rotRatios.x*speed*delta, rotRatios.y*speed*delta);
|
||||
center.set(getX() + getWidth()/2f, getY() + getHeight()/2f);
|
||||
|
||||
if (update) {
|
||||
updatePositionData();
|
||||
}
|
||||
}
|
||||
|
||||
public void updatePositionData() {
|
||||
if (simple) {
|
||||
sprite.setPosition(getX(), getY());
|
||||
hitbox.setPosition(getX(), getY());
|
||||
sprite.setSize(getWidth(), getHeight());
|
||||
hitbox.setSize(getWidth(), getHeight());
|
||||
} else {
|
||||
sprite.setCenter(center.x, center.y);
|
||||
hitbox.setCenter(center);
|
||||
sprite.setOriginCenter();
|
||||
sprite.setRotation(angle);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
if (coordinator != null) {
|
||||
coordinator.clean();
|
||||
coordinator = null;
|
||||
}
|
||||
rotRatios.set(0, 0);
|
||||
sprite.setPosition(0, 0);
|
||||
hitbox.set(0, 0, 0, 0);
|
||||
sprite.setRotation(0);
|
||||
sprite.setColor(Color.WHITE);
|
||||
setPosition(0, 0);
|
||||
center.set(0, 0);
|
||||
angle = 0;
|
||||
speed = 0;
|
||||
points = 0;
|
||||
dead = false;
|
||||
}
|
||||
|
||||
public Vector2 getCenter() {
|
||||
return center;
|
||||
}
|
||||
|
||||
public float getAngle() {
|
||||
return angle;
|
||||
}
|
||||
|
||||
public void setSpeed(float speed) {
|
||||
this.speed = speed;
|
||||
}
|
||||
|
||||
public float getSpeed() {
|
||||
return speed;
|
||||
}
|
||||
|
||||
public void setCoordinator(Coordinator coordinator) {
|
||||
this.coordinator = coordinator;
|
||||
coordinator.setEntity(this);
|
||||
}
|
||||
|
||||
public void kill() {
|
||||
dead = true;
|
||||
}
|
||||
|
||||
public int getPoints() {
|
||||
return points + (coordinator != null ? coordinator.getScoreBonus() : 0);
|
||||
}
|
||||
}
|
@@ -1,61 +0,0 @@
|
||||
package zero1hd.rhythmbullet.desktop.entity;
|
||||
|
||||
import com.badlogic.gdx.utils.Pool;
|
||||
|
||||
public class EntityFrame<T extends Entity> {
|
||||
private Pool<T> pool;
|
||||
private EntityManager ec;
|
||||
Class<T> ct;
|
||||
EntityFrame<T> ef;
|
||||
public EntityFrame(EntityManager entityController, Class<T> classType) {
|
||||
this.ct = classType;
|
||||
ef = this;
|
||||
ec = entityController;
|
||||
pool = new Pool<T>() {
|
||||
@Override
|
||||
protected T newObject() {
|
||||
try {
|
||||
T entity = ct.newInstance();
|
||||
entity.setup(ec, ef);
|
||||
|
||||
return entity;
|
||||
} catch (InstantiationException | IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public T buildEntity() {
|
||||
T entity = pool.obtain();
|
||||
|
||||
if (entity.enemy) {
|
||||
ec.activeEnemies.add(entity);
|
||||
} else {
|
||||
ec.activeAllies.add(entity);
|
||||
}
|
||||
return entity;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Free the entity if no longer used.
|
||||
* @param entity to be freed.
|
||||
*/
|
||||
protected void recycleEntity(Entity entity) {
|
||||
if (entity.enemy) {
|
||||
ec.activeEnemies.removeValue(entity, true);
|
||||
} else {
|
||||
ec.activeAllies.removeValue(entity, true);
|
||||
}
|
||||
entity.remove();
|
||||
pool.free(ct.cast(entity));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return ct.getSimpleName();
|
||||
}
|
||||
}
|
@@ -1,59 +0,0 @@
|
||||
package zero1hd.rhythmbullet.desktop.entity;
|
||||
|
||||
import com.badlogic.gdx.Preferences;
|
||||
import com.badlogic.gdx.assets.AssetManager;
|
||||
import com.badlogic.gdx.scenes.scene2d.Stage;
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
|
||||
import zero1hd.rhythmbullet.desktop.entity.ally.Laser;
|
||||
import zero1hd.rhythmbullet.desktop.entity.enemies.Flake;
|
||||
import zero1hd.rhythmbullet.desktop.entity.enemies.Pellet;
|
||||
import zero1hd.rhythmbullet.desktop.entity.enemies.Shard;
|
||||
import zero1hd.rhythmbullet.desktop.entity.enemies.VoidCircle;
|
||||
|
||||
public class EntityManager {
|
||||
private AssetManager assets;
|
||||
private Preferences prefs;
|
||||
private Stage stage;
|
||||
|
||||
public Array<Entity> activeAllies;
|
||||
public Array<Entity> activeEnemies;
|
||||
|
||||
public EntityFrame<VoidCircle> voidCircle;
|
||||
public EntityFrame<Pellet> pellet;
|
||||
public EntityFrame<Shard> shard;
|
||||
public EntityFrame<Flake> flake;
|
||||
|
||||
public EntityFrame<Laser> laser;
|
||||
|
||||
public EntityManager(AssetManager assetManager, Preferences preferences, Stage stage) {
|
||||
activeAllies = new Array<Entity>();
|
||||
activeEnemies = new Array<Entity>();
|
||||
this.assets = assetManager;
|
||||
this.prefs = preferences;
|
||||
this.stage = stage;
|
||||
|
||||
setup();
|
||||
}
|
||||
|
||||
private void setup() {
|
||||
voidCircle = new EntityFrame<>(this, VoidCircle.class);
|
||||
pellet = new EntityFrame<>(this, Pellet.class);
|
||||
shard = new EntityFrame<>(this, Shard.class);
|
||||
flake = new EntityFrame<>(this, Flake.class);
|
||||
laser = new EntityFrame<>(this, Laser.class);
|
||||
|
||||
}
|
||||
|
||||
public Stage getStage() {
|
||||
return stage;
|
||||
}
|
||||
|
||||
public AssetManager getAssets() {
|
||||
return assets;
|
||||
}
|
||||
|
||||
public Preferences getPrefs() {
|
||||
return prefs;
|
||||
}
|
||||
}
|
@@ -1,69 +0,0 @@
|
||||
package zero1hd.rhythmbullet.desktop.entity.ally;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import com.badlogic.gdx.audio.Sound;
|
||||
import com.badlogic.gdx.graphics.Texture;
|
||||
import com.badlogic.gdx.graphics.g2d.Batch;
|
||||
import com.badlogic.gdx.graphics.g2d.Sprite;
|
||||
|
||||
import zero1hd.rhythmbullet.desktop.RhythmBullet;
|
||||
import zero1hd.rhythmbullet.desktop.entity.Entity;
|
||||
|
||||
public class Laser extends Entity {
|
||||
Sound sfx;
|
||||
|
||||
@Override
|
||||
public void preInit() {
|
||||
sprite = new Sprite(assets.get("laser.png", Texture.class));
|
||||
sfx = assets.get("laser.ogg", Sound.class);
|
||||
setSize(0.25f, 2f);
|
||||
super.preInit();
|
||||
}
|
||||
|
||||
public void init(float x, float y, float rate) {
|
||||
setPosition(x-getWidth()/2f, y-getHeight()/2f);
|
||||
speed = rate;
|
||||
sfx.play(prefs.getFloat("fx vol")/100f);
|
||||
toBack();
|
||||
angle = 90f;
|
||||
}
|
||||
|
||||
/**
|
||||
* Vars: x, y, rate;
|
||||
*/
|
||||
@Override
|
||||
public void init(HashMap<String, Float> params) {
|
||||
setX(params.get("x") - getWidth()/2f);
|
||||
setY(params.get("y") - getHeight()/2f);
|
||||
speed = params.get("rate");
|
||||
angle = 90f;
|
||||
sfx.play(prefs.getFloat("fx vol")/100f);
|
||||
super.init(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void act(float delta) {
|
||||
toBack();
|
||||
if (getY() > RhythmBullet.GAME_AREA_HEIGHT) {
|
||||
dead = true;
|
||||
}
|
||||
super.act(delta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Batch batch, float parentAlpha) {
|
||||
super.draw(batch, parentAlpha);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
super.reset();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void collided(Entity entity) {
|
||||
dead = true;
|
||||
}
|
||||
|
||||
}
|
@@ -1,118 +0,0 @@
|
||||
package zero1hd.rhythmbullet.desktop.entity.ally;
|
||||
|
||||
import com.badlogic.gdx.assets.AssetManager;
|
||||
import com.badlogic.gdx.graphics.Texture;
|
||||
import com.badlogic.gdx.graphics.g2d.Batch;
|
||||
import com.badlogic.gdx.graphics.g2d.ParticleEffect;
|
||||
import com.badlogic.gdx.math.Rectangle;
|
||||
import com.badlogic.gdx.scenes.scene2d.actions.Actions;
|
||||
|
||||
import zero1hd.rhythmbullet.desktop.RhythmBullet;
|
||||
import zero1hd.rhythmbullet.desktop.entity.Entity;
|
||||
|
||||
public class PolyjetEntity extends Entity {
|
||||
public float health;
|
||||
private ParticleEffect thrust;
|
||||
private Texture polyjet;
|
||||
private ParticleEffect teleportCloak;
|
||||
public boolean moveLeft, moveRight, moveUp, moveDown, teleporting, accelerate;
|
||||
private float speed, accel;
|
||||
private float rate;
|
||||
private int maxH;
|
||||
public PolyjetEntity(AssetManager assets, float speed, float accel,int maxHealth, String jet) {
|
||||
nonStnrd = true;
|
||||
health = 100;
|
||||
this.speed = speed;
|
||||
this.accel = accel;
|
||||
setSize(1.5f, 1.5f);
|
||||
setPosition(RhythmBullet.GAME_AREA_WIDTH/2 - getWidth()/2, -4f);
|
||||
maxH = maxHealth;
|
||||
hitbox = new Rectangle(getX(), getY(), getWidth(), getHeight());
|
||||
polyjet = assets.get("polyjet-" + jet + ".png", Texture.class);
|
||||
thrust = assets.get("standard_thrust.p", ParticleEffect.class);
|
||||
thrust.start();
|
||||
|
||||
teleportCloak = assets.get("teleport-cloak.p", ParticleEffect.class);
|
||||
|
||||
addAction(Actions.moveTo(getX(), 4f, 0.5f));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void act(float delta) {
|
||||
hitbox.setPosition(getX(), getY());
|
||||
|
||||
thrust.setPosition(getX()+(getWidth())/2 - 1f/16f, getY()-0.2f);
|
||||
thrust.update(delta);
|
||||
teleportCloak.setPosition(getX() +(getWidth()-1)/2, getY() + (getHeight()-1)/2);
|
||||
|
||||
hitbox.setPosition(getX(), getY());
|
||||
|
||||
//Movement!
|
||||
if (accelerate) {
|
||||
rate = speed + accel;
|
||||
} else {
|
||||
rate = speed;
|
||||
}
|
||||
|
||||
if (moveLeft && !moveRight) {
|
||||
moveBy(-(rate*delta), 0);
|
||||
}
|
||||
if (moveRight && !moveLeft) {
|
||||
moveBy(rate*delta, 0);
|
||||
}
|
||||
if (moveUp && !moveDown) {
|
||||
moveBy(0, rate*delta);
|
||||
}
|
||||
|
||||
if (moveDown && !moveUp) {
|
||||
moveBy(0, -rate*delta);
|
||||
}
|
||||
|
||||
if (health <= 0) {
|
||||
dead = true;
|
||||
} else if (health > maxH) {
|
||||
health = maxH;
|
||||
}
|
||||
|
||||
if (getX() <= 1) {
|
||||
moveLeft = false;
|
||||
setX(1f);
|
||||
}
|
||||
|
||||
if (getX() >= RhythmBullet.GAME_AREA_WIDTH-1-getWidth()) {
|
||||
moveRight = false;
|
||||
setX(RhythmBullet.GAME_AREA_WIDTH-1f-getWidth());
|
||||
}
|
||||
|
||||
if (getY() >= RhythmBullet.GAME_AREA_HEIGHT - 1 - getHeight()) {
|
||||
moveUp = false;
|
||||
setY(RhythmBullet.GAME_AREA_HEIGHT - 1 - getHeight());
|
||||
}
|
||||
|
||||
if (getY() <= 1) {
|
||||
moveDown = false;
|
||||
setY(1f);
|
||||
}
|
||||
|
||||
super.act(delta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Batch batch, float parentAlpha) {
|
||||
thrust.draw(batch);
|
||||
batch.draw(polyjet, getX(), getY(), getWidth(), getHeight());
|
||||
super.draw(batch, parentAlpha);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void collided(Entity entity) {
|
||||
}
|
||||
|
||||
public Rectangle getHitbox() {
|
||||
return hitbox;
|
||||
}
|
||||
|
||||
public void setHealth(float health) {
|
||||
this.health = health;
|
||||
}
|
||||
}
|
@@ -1,42 +0,0 @@
|
||||
package zero1hd.rhythmbullet.desktop.entity.coordinator;
|
||||
|
||||
import com.badlogic.gdx.utils.Pool.Poolable;
|
||||
|
||||
import zero1hd.rhythmbullet.desktop.entity.Entity;
|
||||
import zero1hd.rhythmbullet.desktop.entity.EntityManager;
|
||||
|
||||
public class Coordinator implements Poolable {
|
||||
private CoordinatorFrame<? extends Coordinator> cf;
|
||||
protected EntityManager em;
|
||||
protected Entity entity;
|
||||
protected int scoreBonus;
|
||||
|
||||
public void setup(EntityManager em, CoordinatorFrame<? extends Coordinator> cf) {
|
||||
this.em = em;
|
||||
this.cf = cf;
|
||||
}
|
||||
|
||||
public void init(Entity entity) {
|
||||
this.entity = entity;
|
||||
}
|
||||
|
||||
public void coordinate(float delta) {
|
||||
}
|
||||
|
||||
public void clean() {
|
||||
cf.recycleCoordinator(this);
|
||||
}
|
||||
|
||||
public void setEntity(Entity entity) {
|
||||
this.entity = entity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
entity = null;
|
||||
}
|
||||
|
||||
public int getScoreBonus() {
|
||||
return scoreBonus;
|
||||
}
|
||||
}
|
@@ -1,44 +0,0 @@
|
||||
package zero1hd.rhythmbullet.desktop.entity.coordinator;
|
||||
|
||||
import com.badlogic.gdx.utils.Pool;
|
||||
|
||||
import zero1hd.rhythmbullet.desktop.entity.EntityManager;
|
||||
|
||||
public class CoordinatorFrame<T extends Coordinator> {
|
||||
private Pool<T> pool;
|
||||
private EntityManager em;
|
||||
CoordinatorFrame<T> cf;
|
||||
Class<T> coordinatorType;
|
||||
public CoordinatorFrame(EntityManager entityManager, Class<T> classtype) {
|
||||
this.em = entityManager;
|
||||
coordinatorType = classtype;
|
||||
cf = this;
|
||||
pool = new Pool<T>() {
|
||||
@Override
|
||||
protected T newObject() {
|
||||
try {
|
||||
T coordinator = coordinatorType.newInstance();
|
||||
coordinator.setup(em, cf);
|
||||
return coordinator;
|
||||
} catch (InstantiationException | IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public T buildCoordinator() {
|
||||
T coordinator = pool.obtain();
|
||||
return coordinator;
|
||||
}
|
||||
|
||||
protected void recycleCoordinator(Coordinator coordinator) {
|
||||
pool.free(coordinatorType.cast(coordinator));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return coordinatorType.getSimpleName();
|
||||
}
|
||||
}
|
@@ -1,20 +0,0 @@
|
||||
package zero1hd.rhythmbullet.desktop.entity.coordinator;
|
||||
|
||||
import zero1hd.rhythmbullet.desktop.entity.EntityManager;
|
||||
|
||||
public class CoordinatorManager {
|
||||
private EntityManager em;
|
||||
|
||||
public CoordinatorFrame<SlowLeftCoordinator> slowLeft;
|
||||
public CoordinatorFrame<SlowRightCoordinator> slowRight;
|
||||
|
||||
public CoordinatorManager(EntityManager em) {
|
||||
this.em = em;
|
||||
setup();
|
||||
}
|
||||
|
||||
private void setup() {
|
||||
slowLeft = new CoordinatorFrame<>(em, SlowLeftCoordinator.class);
|
||||
slowRight = new CoordinatorFrame<>(em, SlowRightCoordinator.class);
|
||||
}
|
||||
}
|
@@ -1,9 +0,0 @@
|
||||
package zero1hd.rhythmbullet.desktop.entity.coordinator;
|
||||
|
||||
public class SlowLeftCoordinator extends Coordinator {
|
||||
@Override
|
||||
public void coordinate(float delta) {
|
||||
entity.angle -= 32*delta;
|
||||
super.coordinate(delta);
|
||||
}
|
||||
}
|
@@ -1,9 +0,0 @@
|
||||
package zero1hd.rhythmbullet.desktop.entity.coordinator;
|
||||
|
||||
public class SlowRightCoordinator extends Coordinator {
|
||||
@Override
|
||||
public void coordinate(float delta) {
|
||||
entity.angle += 32*delta;
|
||||
super.coordinate(delta);
|
||||
}
|
||||
}
|
@@ -1,116 +0,0 @@
|
||||
package zero1hd.rhythmbullet.desktop.entity.enemies;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import com.badlogic.gdx.graphics.Texture;
|
||||
import com.badlogic.gdx.graphics.g2d.Batch;
|
||||
import com.badlogic.gdx.graphics.g2d.Sprite;
|
||||
import com.badlogic.gdx.math.Rectangle;
|
||||
|
||||
import zero1hd.rhythmbullet.desktop.entity.Entity;
|
||||
import zero1hd.rhythmbullet.desktop.entity.ally.Laser;
|
||||
|
||||
public class Flake extends Entity {
|
||||
private float timer;
|
||||
private float totalTime;
|
||||
private Shard[] shards;
|
||||
|
||||
@Override
|
||||
public void preInit() {
|
||||
sprite = new Sprite(assets.get("flake.png", Texture.class));
|
||||
simple = true;
|
||||
enemy = true;
|
||||
move = false;
|
||||
setSize(3f, 3f);
|
||||
sprite.setSize(getWidth(), getHeight());
|
||||
super.preInit();
|
||||
}
|
||||
|
||||
public void init(float x, float y, float rate, float fuse, float angle, int shardCount) {
|
||||
this.shards = new Shard[shardCount];
|
||||
for (int i = 0; i < shards.length; i++) {
|
||||
shards[i] = ec.shard.buildEntity();
|
||||
shards[i].init(x, y, 360/shards.length*i, 0, 2);
|
||||
ec.getStage().addActor(shards[i]);
|
||||
}
|
||||
|
||||
this.speed = rate;
|
||||
this.timer = fuse;
|
||||
this.totalTime = fuse;
|
||||
this.angle = angle;
|
||||
setPosition(x-getWidth()/2f, y-getHeight()/2f);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* params: shardCount, x, y, rate, fuse, angle;
|
||||
*/
|
||||
@Override
|
||||
public void init(HashMap<String, Float> params) {
|
||||
this.shards = new Shard[params.get("shardCount").intValue()];
|
||||
for (int i = 0; i < shards.length; i++) {
|
||||
shards[i] = ec.shard.buildEntity();
|
||||
shards[i].init(params.get("x"), params.get("y"), 360/shards.length*i, 0, 1);
|
||||
ec.getStage().addActor(shards[i]);
|
||||
}
|
||||
this.speed = params.get("rate");
|
||||
this.timer = params.get("fuse");
|
||||
this.totalTime = timer;
|
||||
this.angle = params.get("angle");
|
||||
hitbox.setSize(getWidth(), getHeight());
|
||||
setPosition(params.get("x")-getWidth()/2f, params.get("y")-getHeight()/2f);
|
||||
super.init(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void act(float delta) {
|
||||
if (timer > 0) {
|
||||
timer -= delta;
|
||||
}
|
||||
|
||||
move(delta, true);
|
||||
for (int i = 0; i < shards.length; i++) {
|
||||
shards[i].setPosition(center.x-shards[i].getWidth()/2f, center.y-shards[i].getWidth()/2f);
|
||||
shards[i].move(delta, true);
|
||||
}
|
||||
|
||||
if (timer <= 0) {
|
||||
for (int i = 0; i < shards.length; i++) {
|
||||
shards[i].setSpeed(30f);
|
||||
}
|
||||
dead = true;
|
||||
}
|
||||
|
||||
super.act(delta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Batch batch, float parentAlpha) {
|
||||
sprite.setColor(0f, 0f, 0f, 1-(timer/totalTime));
|
||||
super.draw(batch, parentAlpha);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void collided(Entity entity) {
|
||||
if (entity.getClass() == Laser.class) {
|
||||
dead = true;
|
||||
for (int i = 0; i < shards.length; i++) {
|
||||
shards[i].kill();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Rectangle getHitZone() {
|
||||
return hitbox;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
timer = 0;
|
||||
shards = null;
|
||||
totalTime = 0;
|
||||
super.reset();
|
||||
}
|
||||
|
||||
}
|
@@ -1,56 +0,0 @@
|
||||
package zero1hd.rhythmbullet.desktop.entity.enemies;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import com.badlogic.gdx.graphics.Texture;
|
||||
import com.badlogic.gdx.graphics.g2d.Sprite;
|
||||
import com.badlogic.gdx.utils.Pool.Poolable;
|
||||
|
||||
import zero1hd.rhythmbullet.desktop.entity.Entity;
|
||||
|
||||
public class Pellet extends Entity implements Poolable {
|
||||
|
||||
@Override
|
||||
public void preInit() {
|
||||
sprite = new Sprite(assets.get("pellet.png", Texture.class));
|
||||
enemy = true;
|
||||
setSize(0.5f, 0.5f);
|
||||
sprite.setColor(0.5f, 1f, 1f, 0.5f);
|
||||
super.preInit();
|
||||
}
|
||||
|
||||
public void init(float x, float y, float angle, float rate) {
|
||||
setPosition(x, y);
|
||||
this.speed = rate;
|
||||
this.angle = angle;
|
||||
}
|
||||
|
||||
/**
|
||||
* Vars: x, y, speed, angle;
|
||||
*/
|
||||
@Override
|
||||
public void init(HashMap<String, Float> params) {
|
||||
setPosition(params.get("x"), params.get("y"));
|
||||
speed = params.get("speed");
|
||||
angle = params.get("angle");
|
||||
super.init(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void act(float delta) {
|
||||
super.act(delta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void collided(Entity entity) {
|
||||
dead = true;
|
||||
super.collided(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
dead = false;
|
||||
super.reset();
|
||||
}
|
||||
|
||||
}
|
@@ -1,84 +0,0 @@
|
||||
package zero1hd.rhythmbullet.desktop.entity.enemies;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import com.badlogic.gdx.graphics.Texture;
|
||||
import com.badlogic.gdx.graphics.g2d.Batch;
|
||||
import com.badlogic.gdx.graphics.g2d.Sprite;
|
||||
import com.badlogic.gdx.math.Rectangle;
|
||||
|
||||
import zero1hd.rhythmbullet.desktop.entity.Entity;
|
||||
import zero1hd.rhythmbullet.desktop.entity.ally.Laser;
|
||||
|
||||
public class Shard extends Entity {
|
||||
private int hp;
|
||||
private int maxHp;
|
||||
|
||||
@Override
|
||||
public void preInit() {
|
||||
sprite = new Sprite(assets.get("shard.png", Texture.class));
|
||||
setSize(2f, 2f);
|
||||
sprite.setSize(3f, 2f);
|
||||
simple = false;
|
||||
enemy = true;
|
||||
super.preInit();
|
||||
}
|
||||
|
||||
public void init(float x, float y, float angle, float rate, int hp) {
|
||||
speed = rate;
|
||||
this.hp = hp;
|
||||
maxHp = hp;
|
||||
this.angle = angle;
|
||||
setPosition(x-(getWidth()/2f), y-(getHeight()/2f));
|
||||
hitbox.setSize(getWidth(), getHeight());
|
||||
}
|
||||
|
||||
/**
|
||||
* x, y, angle, rate, hp;
|
||||
*/
|
||||
@Override
|
||||
public void init(HashMap<String, Float> params) {
|
||||
setX(params.get("x"));
|
||||
setY(params.get("y"));
|
||||
angle = params.get("angle");
|
||||
speed = params.get("rate");
|
||||
hp = params.get("hp").intValue();
|
||||
super.init(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
hp = 0;
|
||||
maxHp = 0;
|
||||
super.reset();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void act(float delta) {
|
||||
if (hp <= 0) {
|
||||
dead = true;
|
||||
}
|
||||
super.act(delta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Batch batch, float parentAlpha) {
|
||||
sprite.setColor(((float)hp/(float)maxHp), ((float)hp/(float)maxHp), ((float)hp/(float)maxHp), 0.5f);
|
||||
super.draw(batch, parentAlpha);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void collided(Entity entity) {
|
||||
if (entity.getClass() == Laser.class) {
|
||||
hp --;
|
||||
} else {
|
||||
dead = true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Rectangle getHitZone() {
|
||||
return hitbox;
|
||||
}
|
||||
|
||||
}
|
@@ -1,126 +0,0 @@
|
||||
package zero1hd.rhythmbullet.desktop.entity.enemies;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import com.badlogic.gdx.audio.Sound;
|
||||
import com.badlogic.gdx.graphics.Texture;
|
||||
import com.badlogic.gdx.graphics.g2d.Batch;
|
||||
import com.badlogic.gdx.graphics.g2d.Sprite;
|
||||
|
||||
import zero1hd.rhythmbullet.desktop.entity.Entity;
|
||||
|
||||
public class VoidCircle extends Entity {
|
||||
private float timer;
|
||||
private float endRadius;
|
||||
private float currentRadius;
|
||||
private float growthRate;
|
||||
private boolean begin;
|
||||
private float maxTime;
|
||||
private Sound sound;
|
||||
|
||||
@Override
|
||||
public void preInit() {
|
||||
sprite = new Sprite(assets.get("void_circle.png", Texture.class));
|
||||
simple = false;
|
||||
enemy = true;
|
||||
sound = assets.get("disintegrate.ogg", Sound.class);
|
||||
super.preInit();
|
||||
}
|
||||
|
||||
public void init(float endRadius, float x, float y, float growthRate, float warningTime) {
|
||||
timer = warningTime;
|
||||
maxTime = warningTime;
|
||||
this.endRadius = endRadius;
|
||||
setSize(2f*endRadius, 2f*endRadius);
|
||||
setPosition(x-getWidth()/2f, y-getHeight()/2f);
|
||||
this.growthRate = growthRate;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* warningTime, endRadius, growthRate, x, y;
|
||||
*/
|
||||
@Override
|
||||
public void init(HashMap<String, Float> params) {
|
||||
timer = params.get("warningTime");
|
||||
maxTime = timer;
|
||||
endRadius = params.get("endRadius");
|
||||
setSize(2f*endRadius, 2f*endRadius);
|
||||
setPosition(params.get("x")-getWidth()/2f, params.get("y")-getHeight()/2f);
|
||||
growthRate = params.get("growthRate");
|
||||
super.init(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void act(float delta) {
|
||||
toFront();
|
||||
if (begin) {
|
||||
sprite.setSize(2*currentRadius, 2*currentRadius);
|
||||
sprite.setColor(0f,0f,0f,1f);
|
||||
} else {
|
||||
sprite.setSize(2*endRadius, 2*endRadius);
|
||||
sprite.setColor(1f,0.52f,0.32f,0.1f*(timer/maxTime));
|
||||
}
|
||||
|
||||
if (timer > 0) {
|
||||
timer -= delta;
|
||||
} else {
|
||||
begin = true;
|
||||
if (currentRadius < endRadius) {
|
||||
growCurrentRadius(delta*growthRate);
|
||||
} else {
|
||||
endRadius = -1f;
|
||||
if (currentRadius > 0) {
|
||||
growCurrentRadius(delta*-growthRate);
|
||||
} else {
|
||||
dead = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
super.act(delta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Batch batch, float parentAlpha) {
|
||||
super.draw(batch, parentAlpha);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
currentRadius = 0;
|
||||
growthRate = 0;
|
||||
timer = 0;
|
||||
maxTime = 0;
|
||||
endRadius = 0;
|
||||
begin = false;
|
||||
setSize(0, 0);
|
||||
|
||||
super.reset();
|
||||
}
|
||||
|
||||
public void growCurrentRadius(float radius) {
|
||||
currentRadius += radius;
|
||||
float length = (float) Math.sqrt(2*(currentRadius*currentRadius));
|
||||
if (length < 0) {
|
||||
length = 0;
|
||||
}
|
||||
hitbox.setSize(length, length);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void collided(Entity entity) {
|
||||
if (begin) {
|
||||
sound.play(prefs.getFloat("fx vol"));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playCollidePFX() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playCollideSFX() {
|
||||
return false;
|
||||
}
|
||||
}
|
@@ -6,7 +6,7 @@ import com.badlogic.gdx.scenes.scene2d.ui.Image;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup;
|
||||
|
||||
import zero1hd.rhythmbullet.desktop.entity.ally.PolyjetEntity;
|
||||
import zero1hd.rhythmbullet.entity.ally.PolyjetEntity;
|
||||
|
||||
public class HealthBar extends WidgetGroup {
|
||||
Image empty;
|
||||
|
@@ -14,7 +14,7 @@ import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
|
||||
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
|
||||
import com.badlogic.gdx.utils.Align;
|
||||
|
||||
import zero1hd.rhythmbullet.desktop.RhythmBullet;
|
||||
import zero1hd.rhythmbullet.RhythmBullet;
|
||||
import zero1hd.rhythmbullet.desktop.audio.MusicListController;
|
||||
import zero1hd.rhythmbullet.desktop.graphics.ui.components.MusicControls;
|
||||
import zero1hd.rhythmbullet.desktop.graphics.ui.components.ScrollText;
|
||||
|
@@ -14,7 +14,7 @@ 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 zero1hd.rhythmbullet.desktop.RhythmBullet;
|
||||
import zero1hd.rhythmbullet.RhythmBullet;
|
||||
import zero1hd.rhythmbullet.desktop.audio.MusicListController;
|
||||
|
||||
public class OptionsPage extends Page {
|
||||
|
@@ -11,17 +11,17 @@ import com.badlogic.gdx.scenes.scene2d.ui.Slider;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Window;
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
|
||||
import zero1hd.rhythmbullet.desktop.entity.Entity;
|
||||
import zero1hd.rhythmbullet.desktop.entity.EntityFrame;
|
||||
import zero1hd.rhythmbullet.desktop.entity.EntityManager;
|
||||
import zero1hd.rhythmbullet.desktop.entity.ally.Laser;
|
||||
import zero1hd.rhythmbullet.desktop.entity.coordinator.Coordinator;
|
||||
import zero1hd.rhythmbullet.desktop.entity.coordinator.CoordinatorFrame;
|
||||
import zero1hd.rhythmbullet.desktop.entity.coordinator.CoordinatorManager;
|
||||
import zero1hd.rhythmbullet.desktop.entity.enemies.Flake;
|
||||
import zero1hd.rhythmbullet.desktop.entity.enemies.Pellet;
|
||||
import zero1hd.rhythmbullet.desktop.entity.enemies.Shard;
|
||||
import zero1hd.rhythmbullet.desktop.entity.enemies.VoidCircle;
|
||||
import zero1hd.rhythmbullet.entity.Entity;
|
||||
import zero1hd.rhythmbullet.entity.EntityFrame;
|
||||
import zero1hd.rhythmbullet.entity.EntityManager;
|
||||
import zero1hd.rhythmbullet.entity.ally.Laser;
|
||||
import zero1hd.rhythmbullet.entity.coordinator.Coordinator;
|
||||
import zero1hd.rhythmbullet.entity.coordinator.CoordinatorFrame;
|
||||
import zero1hd.rhythmbullet.entity.coordinator.CoordinatorManager;
|
||||
import zero1hd.rhythmbullet.entity.enemies.Flake;
|
||||
import zero1hd.rhythmbullet.entity.enemies.Pellet;
|
||||
import zero1hd.rhythmbullet.entity.enemies.Shard;
|
||||
import zero1hd.rhythmbullet.entity.enemies.VoidCircle;
|
||||
|
||||
public class SpawnerWindow extends Window {
|
||||
private Stage stage;
|
||||
|
@@ -16,7 +16,7 @@ import com.badlogic.gdx.scenes.scene2d.ui.ImageButton;
|
||||
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
|
||||
import com.badlogic.gdx.utils.viewport.ScreenViewport;
|
||||
|
||||
import zero1hd.rhythmbullet.desktop.RhythmBullet;
|
||||
import zero1hd.rhythmbullet.RhythmBullet;
|
||||
import zero1hd.rhythmbullet.desktop.audio.map.GamePlayMap;
|
||||
import zero1hd.rhythmbullet.desktop.stages.GameHUD;
|
||||
import zero1hd.rhythmbullet.desktop.stages.GamePlayArea;
|
||||
|
@@ -1,6 +1,5 @@
|
||||
package zero1hd.rhythmbullet.desktop.screens;
|
||||
|
||||
import com.badlogic.gdx.ApplicationListener;
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.ScreenAdapter;
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
@@ -11,28 +10,18 @@ import com.badlogic.gdx.scenes.scene2d.actions.Actions;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Image;
|
||||
import com.badlogic.gdx.utils.viewport.ScreenViewport;
|
||||
|
||||
import zero1hd.rhythmbullet.desktop.RhythmBullet;
|
||||
import zero1hd.rhythmbullet.RhythmBullet;
|
||||
import zero1hd.rhythmbullet.util.AdvancedResizeScreen;
|
||||
|
||||
public class LoadingScreen extends ScreenAdapter implements ApplicationListener {
|
||||
public class LoadingScreen extends ScreenAdapter implements AdvancedResizeScreen {
|
||||
private Stage stage;
|
||||
private RhythmBullet core;
|
||||
private Texture splash;
|
||||
private Image zero1HD;
|
||||
private boolean done;
|
||||
|
||||
public LoadingScreen(RhythmBullet core) {
|
||||
this.core = core;
|
||||
stage = new Stage(new ScreenViewport());
|
||||
splash = new Texture(Gdx.files.internal("splashlogo.png"));
|
||||
zero1HD = new Image(splash);
|
||||
zero1HD.setScale((Gdx.graphics.getHeight()*0.8f)/zero1HD.getHeight());
|
||||
|
||||
zero1HD.setColor(0f,1f,1f,0f);
|
||||
stage.addActor(zero1HD);
|
||||
zero1HD.setPosition((stage.getWidth() - zero1HD.getWidth()*zero1HD.getScaleX())/2f, (stage.getHeight() - zero1HD.getHeight()*zero1HD.getScaleY())/2f);
|
||||
zero1HD.addAction(Actions.sequence(Actions.color(Color.WHITE, 1f), Actions.fadeOut(0.5f)));
|
||||
core.getrRHandler().setResolution(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
|
||||
core.queueAssets();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -47,7 +36,7 @@ public class LoadingScreen extends ScreenAdapter implements ApplicationListener
|
||||
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
|
||||
stage.act(delta);
|
||||
|
||||
if (!zero1HD.hasActions() & core.getAssetManager().update()) {
|
||||
if (!zero1HD.hasActions() && core.isInitComplete()) {
|
||||
moveOn();
|
||||
}
|
||||
|
||||
@@ -59,19 +48,10 @@ public class LoadingScreen extends ScreenAdapter implements ApplicationListener
|
||||
if (!done) {
|
||||
Gdx.app.debug("Loading Screen", "queue has all been loaded. Action is done playing.");
|
||||
done = true;
|
||||
core.generateFonts(Gdx.graphics.getHeight());
|
||||
core.defineSkinStyles();
|
||||
|
||||
core.setScreen(new MainMenu(core));
|
||||
zero1HD.remove();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resize(int width, int height) {
|
||||
stage.getViewport().update(width, height, true);
|
||||
super.resize(width, height);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hide() {
|
||||
@@ -81,11 +61,23 @@ public class LoadingScreen extends ScreenAdapter implements ApplicationListener
|
||||
}
|
||||
|
||||
@Override
|
||||
public void create() {
|
||||
|
||||
public void preAssetLoad() {
|
||||
if (stage != null) {
|
||||
stage.dispose();
|
||||
splash.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render() {
|
||||
public void postAssetLoad() {
|
||||
stage = new Stage(new ScreenViewport());
|
||||
splash = new Texture(Gdx.files.internal("splashlogo.png"));
|
||||
zero1HD = new Image(splash);
|
||||
zero1HD.setScale((Gdx.graphics.getHeight()*0.8f)/zero1HD.getHeight());
|
||||
|
||||
zero1HD.setColor(0f,1f,1f,0f);
|
||||
stage.addActor(zero1HD);
|
||||
zero1HD.setPosition((stage.getWidth() - zero1HD.getWidth()*zero1HD.getScaleX())/2f, (stage.getHeight() - zero1HD.getHeight()*zero1HD.getScaleY())/2f);
|
||||
zero1HD.addAction(Actions.sequence(Actions.color(Color.WHITE, 1f), Actions.fadeOut(0.5f)));
|
||||
}
|
||||
}
|
||||
|
@@ -18,7 +18,7 @@ import com.badlogic.gdx.scenes.scene2d.Stage;
|
||||
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
|
||||
import com.badlogic.gdx.utils.viewport.ScreenViewport;
|
||||
|
||||
import zero1hd.rhythmbullet.desktop.RhythmBullet;
|
||||
import zero1hd.rhythmbullet.RhythmBullet;
|
||||
import zero1hd.rhythmbullet.desktop.audio.MusicList;
|
||||
import zero1hd.rhythmbullet.desktop.audio.MusicListController;
|
||||
import zero1hd.rhythmbullet.desktop.graphics.ui.pages.AnalysisPage;
|
||||
@@ -28,9 +28,9 @@ import zero1hd.rhythmbullet.desktop.graphics.ui.pages.MainPage;
|
||||
import zero1hd.rhythmbullet.desktop.graphics.ui.pages.MusicSelectionPage;
|
||||
import zero1hd.rhythmbullet.desktop.graphics.ui.pages.OptionsPage;
|
||||
import zero1hd.rhythmbullet.desktop.graphics.ui.pages.VideoOptionsPage;
|
||||
import zero1hd.rhythmbullet.util.TransitionAdapter;
|
||||
import zero1hd.rhythmbullet.util.AdvancedResizeScreen;
|
||||
|
||||
public class MainMenu extends ScreenAdapter implements TransitionAdapter {
|
||||
public class MainMenu extends ScreenAdapter implements AdvancedResizeScreen {
|
||||
public Stage stage;
|
||||
private Vector3 cameraPosition;
|
||||
|
||||
@@ -70,11 +70,10 @@ public class MainMenu extends ScreenAdapter implements TransitionAdapter {
|
||||
mlc = new MusicListController(musicList, core.getPrefs());
|
||||
mlc.setAutoPlay(true);
|
||||
mlc.setShuffle(true);
|
||||
postTransition(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postTransition(boolean first) {
|
||||
public void postAssetLoad() {
|
||||
attemptLoadShaders();
|
||||
|
||||
mainPage = new MainPage(core, cameraPosition, mlc, this);
|
||||
@@ -281,7 +280,7 @@ public class MainMenu extends ScreenAdapter implements TransitionAdapter {
|
||||
super.render(delta);
|
||||
}
|
||||
@Override
|
||||
public void preTransition() {
|
||||
public void preAssetLoad() {
|
||||
stage.clear();
|
||||
mainPage.dispose();
|
||||
optionsPage.dispose();
|
||||
|
@@ -17,7 +17,7 @@ import com.badlogic.gdx.scenes.scene2d.ui.Label;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
|
||||
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
|
||||
|
||||
import zero1hd.rhythmbullet.desktop.RhythmBullet;
|
||||
import zero1hd.rhythmbullet.RhythmBullet;
|
||||
import zero1hd.rhythmbullet.desktop.graphics.ui.components.HealthBar;
|
||||
import zero1hd.rhythmbullet.desktop.graphics.ui.windows.FPSWindow;
|
||||
import zero1hd.rhythmbullet.desktop.graphics.ui.windows.PauseMenu;
|
||||
|
@@ -6,17 +6,17 @@ import com.badlogic.gdx.assets.AssetManager;
|
||||
import com.badlogic.gdx.scenes.scene2d.Stage;
|
||||
import com.badlogic.gdx.utils.viewport.FitViewport;
|
||||
|
||||
import zero1hd.rhythmbullet.RhythmBullet;
|
||||
import zero1hd.rhythmbullet.controls.KeyMap;
|
||||
import zero1hd.rhythmbullet.desktop.RhythmBullet;
|
||||
import zero1hd.rhythmbullet.desktop.audio.map.EntitySpawnInfo;
|
||||
import zero1hd.rhythmbullet.desktop.audio.map.GamePlayMap;
|
||||
import zero1hd.rhythmbullet.desktop.audio.map.MapWindowData;
|
||||
import zero1hd.rhythmbullet.desktop.entity.CollisionDetector;
|
||||
import zero1hd.rhythmbullet.desktop.entity.Entity;
|
||||
import zero1hd.rhythmbullet.desktop.entity.EntityManager;
|
||||
import zero1hd.rhythmbullet.desktop.entity.ally.Laser;
|
||||
import zero1hd.rhythmbullet.desktop.entity.ally.PolyjetEntity;
|
||||
import zero1hd.rhythmbullet.desktop.entity.coordinator.CoordinatorManager;
|
||||
import zero1hd.rhythmbullet.entity.CollisionDetector;
|
||||
import zero1hd.rhythmbullet.entity.Entity;
|
||||
import zero1hd.rhythmbullet.entity.EntityManager;
|
||||
import zero1hd.rhythmbullet.entity.ally.Laser;
|
||||
import zero1hd.rhythmbullet.entity.ally.PolyjetEntity;
|
||||
import zero1hd.rhythmbullet.entity.coordinator.CoordinatorManager;
|
||||
import zero1hd.rhythmbullet.util.ScoreManager;
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user