more restructuring that makes more sense

This commit is contained in:
Harrison Deng 2018-01-05 20:52:07 -06:00
parent aa4a0f3166
commit b6da79adc2
31 changed files with 168 additions and 140 deletions

View File

@ -1,12 +1,10 @@
package zero1hd.rhythmbullet.desktop; package zero1hd.rhythmbullet;
import java.util.logging.Level;
import java.util.logging.Logger;
import com.badlogic.gdx.Application; import com.badlogic.gdx.Application;
import com.badlogic.gdx.Game; import com.badlogic.gdx.Game;
import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Preferences; import com.badlogic.gdx.Preferences;
import com.badlogic.gdx.Screen;
import com.badlogic.gdx.assets.AssetManager; import com.badlogic.gdx.assets.AssetManager;
import com.badlogic.gdx.assets.loaders.ParticleEffectLoader; import com.badlogic.gdx.assets.loaders.ParticleEffectLoader;
import com.badlogic.gdx.assets.loaders.SoundLoader; import com.badlogic.gdx.assets.loaders.SoundLoader;
@ -34,10 +32,9 @@ 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.TextField.TextFieldStyle;
import com.badlogic.gdx.scenes.scene2d.ui.Window.WindowStyle; import com.badlogic.gdx.scenes.scene2d.ui.Window.WindowStyle;
import zero1hd.rhythmbullet.desktop.screens.LoadingScreen;
import zero1hd.rhythmbullet.util.GenericFileTypeHandler; import zero1hd.rhythmbullet.util.GenericFileTypeHandler;
import zero1hd.rhythmbullet.util.RoundingResolutionHandler; import zero1hd.rhythmbullet.util.RoundingResolutionHandler;
import zero1hd.rhythmbullet.util.TransitionAdapter; import zero1hd.rhythmbullet.util.AdvancedResizeScreen;
public class RhythmBullet extends Game { public class RhythmBullet extends Game {
@ -55,6 +52,11 @@ public class RhythmBullet extends Game {
TextureAtlas skinAtlas; TextureAtlas skinAtlas;
private Preferences prefs; private Preferences prefs;
private RoundingResolutionHandler rRHandler; private RoundingResolutionHandler rRHandler;
private Screen initialScreen;
public void setInitialScreen(Screen initialScreen) {
this.initialScreen = initialScreen;
}
@Override @Override
public void create() { public void create() {
@ -94,13 +96,20 @@ public class RhythmBullet extends Game {
+ Gdx.graphics.getWidth() + "x" + Gdx.graphics.getHeight() +"\n" + Gdx.graphics.getWidth() + "x" + Gdx.graphics.getHeight() +"\n"
+ "Pixel density (PPI): " + Gdx.graphics.getDensity()); + "Pixel density (PPI): " + Gdx.graphics.getDensity());
setScreen(new LoadingScreen(this)); queueAssets();
setScreen(initialScreen);
Logger.getLogger("org.jaudiotagger").setLevel(Level.OFF); }
public void checkAssetQueue() {
if (!initComplete) {
if (assetManager.update()) {
generateFonts(Gdx.graphics.getHeight());
defineSkinStyles();
setInitComplete();
}
}
} }
@Override public void checkResize() {
public void render() {
if (resizing) { if (resizing) {
if (assetManager.update()) { if (assetManager.update()) {
Gdx.app.debug("Resize", "Post transition is happening"); Gdx.app.debug("Resize", "Post transition is happening");
@ -108,14 +117,32 @@ public class RhythmBullet extends Game {
generateFonts(Gdx.graphics.getHeight()); generateFonts(Gdx.graphics.getHeight());
defineSkinStyles(); defineSkinStyles();
assetManager.get("standard_thrust.p", ParticleEffect.class).flipY(); assetManager.get("standard_thrust.p", ParticleEffect.class).flipY();
if (initComplete) { ((AdvancedResizeScreen) getScreen()).postAssetLoad();
((TransitionAdapter) getScreen()).postTransition(false);
}
} }
} }
}
@Override
public void render() {
checkResize();
checkAssetQueue();
super.render(); super.render();
} }
@Override
public void setScreen(Screen screen) {
if (screen instanceof AdvancedResizeScreen) {
AdvancedResizeScreen advancedResizeScreen = (AdvancedResizeScreen) screen;
try {
advancedResizeScreen.preAssetLoad();
} catch (NullPointerException cleanScreen) {
} finally {
advancedResizeScreen.postAssetLoad();
}
}
super.setScreen(screen);
}
@Override @Override
public void dispose() { public void dispose() {
Gdx.app.debug("Core", "disposing..."); Gdx.app.debug("Core", "disposing...");
@ -135,7 +162,7 @@ public class RhythmBullet extends Game {
if (initComplete) { if (initComplete) {
Gdx.app.debug("Resize", "Pre-transition is happening. Using resolution " + width + "x" + height); Gdx.app.debug("Resize", "Pre-transition is happening. Using resolution " + width + "x" + height);
rRHandler.setResolution(width, height); rRHandler.setResolution(width, height);
((TransitionAdapter) getScreen()).preTransition(); ((AdvancedResizeScreen) getScreen()).preAssetLoad();
assetManager.clear(); assetManager.clear();
prefs.putInteger("screen-width", width); prefs.putInteger("screen-width", width);
prefs.putInteger("screen-height", height); prefs.putInteger("screen-height", height);
@ -170,6 +197,14 @@ public class RhythmBullet extends Game {
initComplete = true; initComplete = true;
} }
public boolean isInitComplete() {
return initComplete;
}
public RoundingResolutionHandler getrRHandler() {
return rRHandler;
}
public void queueAssets() { public void queueAssets() {
assetManager.load("uiskin.atlas", TextureAtlas.class); assetManager.load("uiskin.atlas", TextureAtlas.class);
assetManager.load("Tech-Circle1.png", Texture.class); assetManager.load("Tech-Circle1.png", Texture.class);
@ -332,9 +367,4 @@ public class RhythmBullet extends Game {
getDefaultSkin().add("shuffle-button", shuffleButtonStyle); getDefaultSkin().add("shuffle-button", shuffleButtonStyle);
} }
public RoundingResolutionHandler getrRHandler() {
return rRHandler;
}
} }

View File

@ -1,4 +1,4 @@
package zero1hd.rhythmbullet.desktop.entity; package zero1hd.rhythmbullet.entity;
import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Preferences; import com.badlogic.gdx.Preferences;
@ -10,7 +10,7 @@ import com.badlogic.gdx.graphics.g2d.ParticleEffectPool;
import com.badlogic.gdx.graphics.g2d.ParticleEffectPool.PooledEffect; import com.badlogic.gdx.graphics.g2d.ParticleEffectPool.PooledEffect;
import com.badlogic.gdx.utils.Array; import com.badlogic.gdx.utils.Array;
import zero1hd.rhythmbullet.desktop.RhythmBullet; import zero1hd.rhythmbullet.RhythmBullet;
public class CollisionDetector { public class CollisionDetector {
Array<Entity> enemies; Array<Entity> enemies;

View File

@ -1,4 +1,4 @@
package zero1hd.rhythmbullet.desktop.entity; package zero1hd.rhythmbullet.entity;
import java.util.HashMap; import java.util.HashMap;
@ -13,8 +13,8 @@ import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.scenes.scene2d.Actor; import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.utils.Pool.Poolable; import com.badlogic.gdx.utils.Pool.Poolable;
import zero1hd.rhythmbullet.desktop.RhythmBullet; import zero1hd.rhythmbullet.RhythmBullet;
import zero1hd.rhythmbullet.desktop.entity.coordinator.Coordinator; import zero1hd.rhythmbullet.entity.coordinator.Coordinator;
public class Entity extends Actor implements Poolable { public class Entity extends Actor implements Poolable {
private Coordinator coordinator; private Coordinator coordinator;

View File

@ -1,4 +1,4 @@
package zero1hd.rhythmbullet.desktop.entity; package zero1hd.rhythmbullet.entity;
import com.badlogic.gdx.utils.Pool; import com.badlogic.gdx.utils.Pool;

View File

@ -1,15 +1,15 @@
package zero1hd.rhythmbullet.desktop.entity; package zero1hd.rhythmbullet.entity;
import com.badlogic.gdx.Preferences; import com.badlogic.gdx.Preferences;
import com.badlogic.gdx.assets.AssetManager; import com.badlogic.gdx.assets.AssetManager;
import com.badlogic.gdx.scenes.scene2d.Stage; import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.utils.Array; import com.badlogic.gdx.utils.Array;
import zero1hd.rhythmbullet.desktop.entity.ally.Laser; import zero1hd.rhythmbullet.entity.ally.Laser;
import zero1hd.rhythmbullet.desktop.entity.enemies.Flake; import zero1hd.rhythmbullet.entity.enemies.Flake;
import zero1hd.rhythmbullet.desktop.entity.enemies.Pellet; import zero1hd.rhythmbullet.entity.enemies.Pellet;
import zero1hd.rhythmbullet.desktop.entity.enemies.Shard; import zero1hd.rhythmbullet.entity.enemies.Shard;
import zero1hd.rhythmbullet.desktop.entity.enemies.VoidCircle; import zero1hd.rhythmbullet.entity.enemies.VoidCircle;
public class EntityManager { public class EntityManager {
private AssetManager assets; private AssetManager assets;

View File

@ -1,4 +1,4 @@
package zero1hd.rhythmbullet.desktop.entity.ally; package zero1hd.rhythmbullet.entity.ally;
import java.util.HashMap; import java.util.HashMap;
@ -7,8 +7,8 @@ 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.Sprite; import com.badlogic.gdx.graphics.g2d.Sprite;
import zero1hd.rhythmbullet.desktop.RhythmBullet; import zero1hd.rhythmbullet.RhythmBullet;
import zero1hd.rhythmbullet.desktop.entity.Entity; import zero1hd.rhythmbullet.entity.Entity;
public class Laser extends Entity { public class Laser extends Entity {
Sound sfx; Sound sfx;

View File

@ -1,4 +1,4 @@
package zero1hd.rhythmbullet.desktop.entity.ally; package zero1hd.rhythmbullet.entity.ally;
import com.badlogic.gdx.assets.AssetManager; import com.badlogic.gdx.assets.AssetManager;
import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.Texture;
@ -7,8 +7,8 @@ import com.badlogic.gdx.graphics.g2d.ParticleEffect;
import com.badlogic.gdx.math.Rectangle; import com.badlogic.gdx.math.Rectangle;
import com.badlogic.gdx.scenes.scene2d.actions.Actions; import com.badlogic.gdx.scenes.scene2d.actions.Actions;
import zero1hd.rhythmbullet.desktop.RhythmBullet; import zero1hd.rhythmbullet.RhythmBullet;
import zero1hd.rhythmbullet.desktop.entity.Entity; import zero1hd.rhythmbullet.entity.Entity;
public class PolyjetEntity extends Entity { public class PolyjetEntity extends Entity {
public float health; public float health;

View File

@ -1,9 +1,9 @@
package zero1hd.rhythmbullet.desktop.entity.coordinator; package zero1hd.rhythmbullet.entity.coordinator;
import com.badlogic.gdx.utils.Pool.Poolable; import com.badlogic.gdx.utils.Pool.Poolable;
import zero1hd.rhythmbullet.desktop.entity.Entity; import zero1hd.rhythmbullet.entity.Entity;
import zero1hd.rhythmbullet.desktop.entity.EntityManager; import zero1hd.rhythmbullet.entity.EntityManager;
public class Coordinator implements Poolable { public class Coordinator implements Poolable {
private CoordinatorFrame<? extends Coordinator> cf; private CoordinatorFrame<? extends Coordinator> cf;

View File

@ -1,8 +1,8 @@
package zero1hd.rhythmbullet.desktop.entity.coordinator; package zero1hd.rhythmbullet.entity.coordinator;
import com.badlogic.gdx.utils.Pool; import com.badlogic.gdx.utils.Pool;
import zero1hd.rhythmbullet.desktop.entity.EntityManager; import zero1hd.rhythmbullet.entity.EntityManager;
public class CoordinatorFrame<T extends Coordinator> { public class CoordinatorFrame<T extends Coordinator> {
private Pool<T> pool; private Pool<T> pool;

View File

@ -1,6 +1,6 @@
package zero1hd.rhythmbullet.desktop.entity.coordinator; package zero1hd.rhythmbullet.entity.coordinator;
import zero1hd.rhythmbullet.desktop.entity.EntityManager; import zero1hd.rhythmbullet.entity.EntityManager;
public class CoordinatorManager { public class CoordinatorManager {
private EntityManager em; private EntityManager em;

View File

@ -1,4 +1,4 @@
package zero1hd.rhythmbullet.desktop.entity.coordinator; package zero1hd.rhythmbullet.entity.coordinator;
public class SlowLeftCoordinator extends Coordinator { public class SlowLeftCoordinator extends Coordinator {
@Override @Override

View File

@ -1,4 +1,4 @@
package zero1hd.rhythmbullet.desktop.entity.coordinator; package zero1hd.rhythmbullet.entity.coordinator;
public class SlowRightCoordinator extends Coordinator { public class SlowRightCoordinator extends Coordinator {
@Override @Override

View File

@ -1,4 +1,4 @@
package zero1hd.rhythmbullet.desktop.entity.enemies; package zero1hd.rhythmbullet.entity.enemies;
import java.util.HashMap; import java.util.HashMap;
@ -7,8 +7,8 @@ import com.badlogic.gdx.graphics.g2d.Batch;
import com.badlogic.gdx.graphics.g2d.Sprite; import com.badlogic.gdx.graphics.g2d.Sprite;
import com.badlogic.gdx.math.Rectangle; import com.badlogic.gdx.math.Rectangle;
import zero1hd.rhythmbullet.desktop.entity.Entity; import zero1hd.rhythmbullet.entity.Entity;
import zero1hd.rhythmbullet.desktop.entity.ally.Laser; import zero1hd.rhythmbullet.entity.ally.Laser;
public class Flake extends Entity { public class Flake extends Entity {
private float timer; private float timer;

View File

@ -1,4 +1,4 @@
package zero1hd.rhythmbullet.desktop.entity.enemies; package zero1hd.rhythmbullet.entity.enemies;
import java.util.HashMap; import java.util.HashMap;
@ -6,7 +6,7 @@ import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.Sprite; import com.badlogic.gdx.graphics.g2d.Sprite;
import com.badlogic.gdx.utils.Pool.Poolable; import com.badlogic.gdx.utils.Pool.Poolable;
import zero1hd.rhythmbullet.desktop.entity.Entity; import zero1hd.rhythmbullet.entity.Entity;
public class Pellet extends Entity implements Poolable { public class Pellet extends Entity implements Poolable {

View File

@ -1,4 +1,4 @@
package zero1hd.rhythmbullet.desktop.entity.enemies; package zero1hd.rhythmbullet.entity.enemies;
import java.util.HashMap; import java.util.HashMap;
@ -7,8 +7,8 @@ import com.badlogic.gdx.graphics.g2d.Batch;
import com.badlogic.gdx.graphics.g2d.Sprite; import com.badlogic.gdx.graphics.g2d.Sprite;
import com.badlogic.gdx.math.Rectangle; import com.badlogic.gdx.math.Rectangle;
import zero1hd.rhythmbullet.desktop.entity.Entity; import zero1hd.rhythmbullet.entity.Entity;
import zero1hd.rhythmbullet.desktop.entity.ally.Laser; import zero1hd.rhythmbullet.entity.ally.Laser;
public class Shard extends Entity { public class Shard extends Entity {
private int hp; private int hp;

View File

@ -1,4 +1,4 @@
package zero1hd.rhythmbullet.desktop.entity.enemies; package zero1hd.rhythmbullet.entity.enemies;
import java.util.HashMap; import java.util.HashMap;
@ -7,7 +7,7 @@ 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.Sprite; import com.badlogic.gdx.graphics.g2d.Sprite;
import zero1hd.rhythmbullet.desktop.entity.Entity; import zero1hd.rhythmbullet.entity.Entity;
public class VoidCircle extends Entity { public class VoidCircle extends Entity {
private float timer; private float timer;

View File

@ -0,0 +1,13 @@
package zero1hd.rhythmbullet.util;
public interface AdvancedResizeScreen {
/**
* called before assets are cleared from memory.
*/
public void preAssetLoad();
/**
* called after transition completes and assets reloaded.
*/
public void postAssetLoad();
}

View File

@ -1,14 +0,0 @@
package zero1hd.rhythmbullet.util;
public interface TransitionAdapter {
/**
* called before assets are cleared from memory.
*/
public void preTransition();
/**
* called after transition completes and assets reloaded.
* @param first true if this is the first time load (when the game is just started or something)
*/
public void postTransition(boolean first);
}

View File

@ -3,8 +3,12 @@ package zero1hd.rhythmbullet.desktop;
import com.badlogic.gdx.backends.lwjgl.LwjglApplication; import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration; import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;
import zero1hd.rhythmbullet.RhythmBullet;
import zero1hd.rhythmbullet.desktop.screens.LoadingScreen;
public class DesktopLauncher { public class DesktopLauncher {
public static void main (String[] arg) { public static void main (String[] arg) {
RhythmBullet core;
LwjglApplicationConfiguration config = new LwjglApplicationConfiguration(); LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
config.title = "Rhythm Bullet"; config.title = "Rhythm Bullet";
config.resizable = false; config.resizable = false;
@ -12,6 +16,10 @@ public class DesktopLauncher {
config.useHDPI = true; config.useHDPI = true;
config.vSyncEnabled = false; config.vSyncEnabled = false;
config.foregroundFPS = 0; config.foregroundFPS = 0;
new LwjglApplication(new RhythmBullet(), config); core = new RhythmBullet();
core.setInitialScreen(new LoadingScreen(core));
new LwjglApplication(core, config);
} }
} }

View File

@ -2,10 +2,10 @@ package zero1hd.rhythmbullet.desktop.audio.map;
import java.util.HashMap; import java.util.HashMap;
import zero1hd.rhythmbullet.desktop.entity.Entity; import zero1hd.rhythmbullet.entity.Entity;
import zero1hd.rhythmbullet.desktop.entity.EntityFrame; import zero1hd.rhythmbullet.entity.EntityFrame;
import zero1hd.rhythmbullet.desktop.entity.coordinator.Coordinator; import zero1hd.rhythmbullet.entity.coordinator.Coordinator;
import zero1hd.rhythmbullet.desktop.entity.coordinator.CoordinatorFrame; import zero1hd.rhythmbullet.entity.coordinator.CoordinatorFrame;
public class EntitySpawnInfo { public class EntitySpawnInfo {
private EntityFrame<? extends Entity> entityToSpawn; private EntityFrame<? extends Entity> entityToSpawn;

View File

@ -1,9 +1,9 @@
package zero1hd.rhythmbullet.desktop.audio.map; package zero1hd.rhythmbullet.desktop.audio.map;
import zero1hd.rhythmbullet.desktop.entity.Entity; import zero1hd.rhythmbullet.entity.Entity;
import zero1hd.rhythmbullet.desktop.entity.EntityFrame; import zero1hd.rhythmbullet.entity.EntityFrame;
import zero1hd.rhythmbullet.desktop.entity.coordinator.Coordinator; import zero1hd.rhythmbullet.entity.coordinator.Coordinator;
import zero1hd.rhythmbullet.desktop.entity.coordinator.CoordinatorFrame; import zero1hd.rhythmbullet.entity.coordinator.CoordinatorFrame;
import zero1hd.rhythmbullet.util.MusicManager; import zero1hd.rhythmbullet.util.MusicManager;
public class GamePlayMap { public class GamePlayMap {

View File

@ -5,10 +5,10 @@ import org.apache.commons.math3.random.MersenneTwister;
import com.badlogic.gdx.math.MathUtils; import com.badlogic.gdx.math.MathUtils;
import com.badlogic.gdx.utils.FloatArray; import com.badlogic.gdx.utils.FloatArray;
import zero1hd.rhythmbullet.RhythmBullet;
import zero1hd.rhythmbullet.audio.AudioDataPackage; import zero1hd.rhythmbullet.audio.AudioDataPackage;
import zero1hd.rhythmbullet.desktop.RhythmBullet; import zero1hd.rhythmbullet.entity.EntityManager;
import zero1hd.rhythmbullet.desktop.entity.EntityManager; import zero1hd.rhythmbullet.entity.coordinator.CoordinatorManager;
import zero1hd.rhythmbullet.desktop.entity.coordinator.CoordinatorManager;
import zero1hd.rhythmbullet.util.MiniEvents; import zero1hd.rhythmbullet.util.MiniEvents;
import zero1hd.rhythmbullet.util.MiniSender; import zero1hd.rhythmbullet.util.MiniSender;

View File

@ -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.Skin;
import com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup; 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 { public class HealthBar extends WidgetGroup {
Image empty; Image empty;

View File

@ -14,7 +14,7 @@ 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;
import zero1hd.rhythmbullet.desktop.RhythmBullet; import zero1hd.rhythmbullet.RhythmBullet;
import zero1hd.rhythmbullet.desktop.audio.MusicListController; import zero1hd.rhythmbullet.desktop.audio.MusicListController;
import zero1hd.rhythmbullet.desktop.graphics.ui.components.MusicControls; import zero1hd.rhythmbullet.desktop.graphics.ui.components.MusicControls;
import zero1hd.rhythmbullet.desktop.graphics.ui.components.ScrollText; import zero1hd.rhythmbullet.desktop.graphics.ui.components.ScrollText;

View File

@ -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.ui.TextField;
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener; import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
import zero1hd.rhythmbullet.desktop.RhythmBullet; import zero1hd.rhythmbullet.RhythmBullet;
import zero1hd.rhythmbullet.desktop.audio.MusicListController; import zero1hd.rhythmbullet.desktop.audio.MusicListController;
public class OptionsPage extends Page { public class OptionsPage extends Page {

View File

@ -11,17 +11,17 @@ import com.badlogic.gdx.scenes.scene2d.ui.Slider;
import com.badlogic.gdx.scenes.scene2d.ui.Window; import com.badlogic.gdx.scenes.scene2d.ui.Window;
import com.badlogic.gdx.utils.Array; import com.badlogic.gdx.utils.Array;
import zero1hd.rhythmbullet.desktop.entity.Entity; import zero1hd.rhythmbullet.entity.Entity;
import zero1hd.rhythmbullet.desktop.entity.EntityFrame; import zero1hd.rhythmbullet.entity.EntityFrame;
import zero1hd.rhythmbullet.desktop.entity.EntityManager; import zero1hd.rhythmbullet.entity.EntityManager;
import zero1hd.rhythmbullet.desktop.entity.ally.Laser; import zero1hd.rhythmbullet.entity.ally.Laser;
import zero1hd.rhythmbullet.desktop.entity.coordinator.Coordinator; import zero1hd.rhythmbullet.entity.coordinator.Coordinator;
import zero1hd.rhythmbullet.desktop.entity.coordinator.CoordinatorFrame; import zero1hd.rhythmbullet.entity.coordinator.CoordinatorFrame;
import zero1hd.rhythmbullet.desktop.entity.coordinator.CoordinatorManager; import zero1hd.rhythmbullet.entity.coordinator.CoordinatorManager;
import zero1hd.rhythmbullet.desktop.entity.enemies.Flake; import zero1hd.rhythmbullet.entity.enemies.Flake;
import zero1hd.rhythmbullet.desktop.entity.enemies.Pellet; import zero1hd.rhythmbullet.entity.enemies.Pellet;
import zero1hd.rhythmbullet.desktop.entity.enemies.Shard; import zero1hd.rhythmbullet.entity.enemies.Shard;
import zero1hd.rhythmbullet.desktop.entity.enemies.VoidCircle; import zero1hd.rhythmbullet.entity.enemies.VoidCircle;
public class SpawnerWindow extends Window { public class SpawnerWindow extends Window {
private Stage stage; private Stage stage;

View File

@ -16,7 +16,7 @@ import com.badlogic.gdx.scenes.scene2d.ui.ImageButton;
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener; import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
import com.badlogic.gdx.utils.viewport.ScreenViewport; 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.audio.map.GamePlayMap;
import zero1hd.rhythmbullet.desktop.stages.GameHUD; import zero1hd.rhythmbullet.desktop.stages.GameHUD;
import zero1hd.rhythmbullet.desktop.stages.GamePlayArea; import zero1hd.rhythmbullet.desktop.stages.GamePlayArea;

View File

@ -1,6 +1,5 @@
package zero1hd.rhythmbullet.desktop.screens; package zero1hd.rhythmbullet.desktop.screens;
import com.badlogic.gdx.ApplicationListener;
import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.ScreenAdapter; import com.badlogic.gdx.ScreenAdapter;
import com.badlogic.gdx.graphics.Color; 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.scenes.scene2d.ui.Image;
import com.badlogic.gdx.utils.viewport.ScreenViewport; 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 Stage stage;
private RhythmBullet core; private RhythmBullet core;
private Texture splash; private Texture splash;
private Image zero1HD; private Image zero1HD;
private boolean done; private boolean done;
public LoadingScreen(RhythmBullet core) { public LoadingScreen(RhythmBullet core) {
this.core = 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 @Override
@ -47,7 +36,7 @@ public class LoadingScreen extends ScreenAdapter implements ApplicationListener
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
stage.act(delta); stage.act(delta);
if (!zero1HD.hasActions() & core.getAssetManager().update()) { if (!zero1HD.hasActions() && core.isInitComplete()) {
moveOn(); moveOn();
} }
@ -59,19 +48,10 @@ public class LoadingScreen extends ScreenAdapter implements ApplicationListener
if (!done) { if (!done) {
Gdx.app.debug("Loading Screen", "queue has all been loaded. Action is done playing."); Gdx.app.debug("Loading Screen", "queue has all been loaded. Action is done playing.");
done = true; done = true;
core.generateFonts(Gdx.graphics.getHeight());
core.defineSkinStyles();
core.setScreen(new MainMenu(core)); core.setScreen(new MainMenu(core));
zero1HD.remove(); zero1HD.remove();
} }
} }
@Override
public void resize(int width, int height) {
stage.getViewport().update(width, height, true);
super.resize(width, height);
}
@Override @Override
public void hide() { public void hide() {
@ -81,11 +61,23 @@ public class LoadingScreen extends ScreenAdapter implements ApplicationListener
} }
@Override @Override
public void create() { public void preAssetLoad() {
if (stage != null) {
stage.dispose();
splash.dispose();
}
} }
@Override @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)));
} }
} }

View File

@ -18,7 +18,7 @@ import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener; import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
import com.badlogic.gdx.utils.viewport.ScreenViewport; 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.MusicList;
import zero1hd.rhythmbullet.desktop.audio.MusicListController; import zero1hd.rhythmbullet.desktop.audio.MusicListController;
import zero1hd.rhythmbullet.desktop.graphics.ui.pages.AnalysisPage; 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.MusicSelectionPage;
import zero1hd.rhythmbullet.desktop.graphics.ui.pages.OptionsPage; import zero1hd.rhythmbullet.desktop.graphics.ui.pages.OptionsPage;
import zero1hd.rhythmbullet.desktop.graphics.ui.pages.VideoOptionsPage; 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; public Stage stage;
private Vector3 cameraPosition; private Vector3 cameraPosition;
@ -70,11 +70,10 @@ public class MainMenu extends ScreenAdapter implements TransitionAdapter {
mlc = new MusicListController(musicList, core.getPrefs()); mlc = new MusicListController(musicList, core.getPrefs());
mlc.setAutoPlay(true); mlc.setAutoPlay(true);
mlc.setShuffle(true); mlc.setShuffle(true);
postTransition(true);
} }
@Override @Override
public void postTransition(boolean first) { public void postAssetLoad() {
attemptLoadShaders(); attemptLoadShaders();
mainPage = new MainPage(core, cameraPosition, mlc, this); mainPage = new MainPage(core, cameraPosition, mlc, this);
@ -281,7 +280,7 @@ public class MainMenu extends ScreenAdapter implements TransitionAdapter {
super.render(delta); super.render(delta);
} }
@Override @Override
public void preTransition() { public void preAssetLoad() {
stage.clear(); stage.clear();
mainPage.dispose(); mainPage.dispose();
optionsPage.dispose(); optionsPage.dispose();

View File

@ -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.ui.Skin;
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener; 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.components.HealthBar;
import zero1hd.rhythmbullet.desktop.graphics.ui.windows.FPSWindow; import zero1hd.rhythmbullet.desktop.graphics.ui.windows.FPSWindow;
import zero1hd.rhythmbullet.desktop.graphics.ui.windows.PauseMenu; import zero1hd.rhythmbullet.desktop.graphics.ui.windows.PauseMenu;

View File

@ -6,17 +6,17 @@ import com.badlogic.gdx.assets.AssetManager;
import com.badlogic.gdx.scenes.scene2d.Stage; import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.utils.viewport.FitViewport; import com.badlogic.gdx.utils.viewport.FitViewport;
import zero1hd.rhythmbullet.RhythmBullet;
import zero1hd.rhythmbullet.controls.KeyMap; import zero1hd.rhythmbullet.controls.KeyMap;
import zero1hd.rhythmbullet.desktop.RhythmBullet;
import zero1hd.rhythmbullet.desktop.audio.map.EntitySpawnInfo; import zero1hd.rhythmbullet.desktop.audio.map.EntitySpawnInfo;
import zero1hd.rhythmbullet.desktop.audio.map.GamePlayMap; import zero1hd.rhythmbullet.desktop.audio.map.GamePlayMap;
import zero1hd.rhythmbullet.desktop.audio.map.MapWindowData; import zero1hd.rhythmbullet.desktop.audio.map.MapWindowData;
import zero1hd.rhythmbullet.desktop.entity.CollisionDetector; import zero1hd.rhythmbullet.entity.CollisionDetector;
import zero1hd.rhythmbullet.desktop.entity.Entity; import zero1hd.rhythmbullet.entity.Entity;
import zero1hd.rhythmbullet.desktop.entity.EntityManager; import zero1hd.rhythmbullet.entity.EntityManager;
import zero1hd.rhythmbullet.desktop.entity.ally.Laser; import zero1hd.rhythmbullet.entity.ally.Laser;
import zero1hd.rhythmbullet.desktop.entity.ally.PolyjetEntity; import zero1hd.rhythmbullet.entity.ally.PolyjetEntity;
import zero1hd.rhythmbullet.desktop.entity.coordinator.CoordinatorManager; import zero1hd.rhythmbullet.entity.coordinator.CoordinatorManager;
import zero1hd.rhythmbullet.util.ScoreManager; import zero1hd.rhythmbullet.util.ScoreManager;