diff --git a/desktop/src/zero1hd/rhythmbullet/desktop/RhythmBullet.java b/core/src/zero1hd/rhythmbullet/RhythmBullet.java similarity index 92% rename from desktop/src/zero1hd/rhythmbullet/desktop/RhythmBullet.java rename to core/src/zero1hd/rhythmbullet/RhythmBullet.java index 2110dc1..723f08b 100755 --- a/desktop/src/zero1hd/rhythmbullet/desktop/RhythmBullet.java +++ b/core/src/zero1hd/rhythmbullet/RhythmBullet.java @@ -1,12 +1,10 @@ -package zero1hd.rhythmbullet.desktop; - -import java.util.logging.Level; -import java.util.logging.Logger; +package zero1hd.rhythmbullet; import com.badlogic.gdx.Application; import com.badlogic.gdx.Game; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Preferences; +import com.badlogic.gdx.Screen; import com.badlogic.gdx.assets.AssetManager; import com.badlogic.gdx.assets.loaders.ParticleEffectLoader; 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.Window.WindowStyle; -import zero1hd.rhythmbullet.desktop.screens.LoadingScreen; import zero1hd.rhythmbullet.util.GenericFileTypeHandler; import zero1hd.rhythmbullet.util.RoundingResolutionHandler; -import zero1hd.rhythmbullet.util.TransitionAdapter; +import zero1hd.rhythmbullet.util.AdvancedResizeScreen; public class RhythmBullet extends Game { @@ -55,6 +52,11 @@ public class RhythmBullet extends Game { TextureAtlas skinAtlas; private Preferences prefs; private RoundingResolutionHandler rRHandler; + private Screen initialScreen; + + public void setInitialScreen(Screen initialScreen) { + this.initialScreen = initialScreen; + } @Override public void create() { @@ -94,13 +96,20 @@ public class RhythmBullet extends Game { + 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); + queueAssets(); + setScreen(initialScreen); + } + public void checkAssetQueue() { + if (!initComplete) { + if (assetManager.update()) { + generateFonts(Gdx.graphics.getHeight()); + defineSkinStyles(); + setInitComplete(); + } + } } - @Override - public void render() { + public void checkResize() { if (resizing) { if (assetManager.update()) { Gdx.app.debug("Resize", "Post transition is happening"); @@ -108,14 +117,32 @@ public class RhythmBullet extends Game { generateFonts(Gdx.graphics.getHeight()); defineSkinStyles(); assetManager.get("standard_thrust.p", ParticleEffect.class).flipY(); - if (initComplete) { - ((TransitionAdapter) getScreen()).postTransition(false); - } + ((AdvancedResizeScreen) getScreen()).postAssetLoad(); } } + } + + @Override + public void render() { + checkResize(); + checkAssetQueue(); 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 public void dispose() { Gdx.app.debug("Core", "disposing..."); @@ -135,7 +162,7 @@ public class RhythmBullet extends Game { if (initComplete) { Gdx.app.debug("Resize", "Pre-transition is happening. Using resolution " + width + "x" + height); rRHandler.setResolution(width, height); - ((TransitionAdapter) getScreen()).preTransition(); + ((AdvancedResizeScreen) getScreen()).preAssetLoad(); assetManager.clear(); prefs.putInteger("screen-width", width); prefs.putInteger("screen-height", height); @@ -170,6 +197,14 @@ public class RhythmBullet extends Game { initComplete = true; } + public boolean isInitComplete() { + return initComplete; + } + + public RoundingResolutionHandler getrRHandler() { + return rRHandler; + } + public void queueAssets() { assetManager.load("uiskin.atlas", TextureAtlas.class); assetManager.load("Tech-Circle1.png", Texture.class); @@ -332,9 +367,4 @@ public class RhythmBullet extends Game { getDefaultSkin().add("shuffle-button", shuffleButtonStyle); } - - public RoundingResolutionHandler getrRHandler() { - return rRHandler; - } - } diff --git a/desktop/src/zero1hd/rhythmbullet/desktop/entity/CollisionDetector.java b/core/src/zero1hd/rhythmbullet/entity/CollisionDetector.java similarity index 93% rename from desktop/src/zero1hd/rhythmbullet/desktop/entity/CollisionDetector.java rename to core/src/zero1hd/rhythmbullet/entity/CollisionDetector.java index d05f57c..1f70491 100755 --- a/desktop/src/zero1hd/rhythmbullet/desktop/entity/CollisionDetector.java +++ b/core/src/zero1hd/rhythmbullet/entity/CollisionDetector.java @@ -1,4 +1,4 @@ -package zero1hd.rhythmbullet.desktop.entity; +package zero1hd.rhythmbullet.entity; import com.badlogic.gdx.Gdx; 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.utils.Array; -import zero1hd.rhythmbullet.desktop.RhythmBullet; +import zero1hd.rhythmbullet.RhythmBullet; public class CollisionDetector { Array enemies; diff --git a/desktop/src/zero1hd/rhythmbullet/desktop/entity/Entity.java b/core/src/zero1hd/rhythmbullet/entity/Entity.java similarity index 96% rename from desktop/src/zero1hd/rhythmbullet/desktop/entity/Entity.java rename to core/src/zero1hd/rhythmbullet/entity/Entity.java index 89aa65c..a8a0ab6 100755 --- a/desktop/src/zero1hd/rhythmbullet/desktop/entity/Entity.java +++ b/core/src/zero1hd/rhythmbullet/entity/Entity.java @@ -1,4 +1,4 @@ -package zero1hd.rhythmbullet.desktop.entity; +package zero1hd.rhythmbullet.entity; 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.utils.Pool.Poolable; -import zero1hd.rhythmbullet.desktop.RhythmBullet; -import zero1hd.rhythmbullet.desktop.entity.coordinator.Coordinator; +import zero1hd.rhythmbullet.RhythmBullet; +import zero1hd.rhythmbullet.entity.coordinator.Coordinator; public class Entity extends Actor implements Poolable { private Coordinator coordinator; diff --git a/desktop/src/zero1hd/rhythmbullet/desktop/entity/EntityFrame.java b/core/src/zero1hd/rhythmbullet/entity/EntityFrame.java similarity index 91% rename from desktop/src/zero1hd/rhythmbullet/desktop/entity/EntityFrame.java rename to core/src/zero1hd/rhythmbullet/entity/EntityFrame.java index 1892480..ec1f57d 100755 --- a/desktop/src/zero1hd/rhythmbullet/desktop/entity/EntityFrame.java +++ b/core/src/zero1hd/rhythmbullet/entity/EntityFrame.java @@ -1,4 +1,4 @@ -package zero1hd.rhythmbullet.desktop.entity; +package zero1hd.rhythmbullet.entity; import com.badlogic.gdx.utils.Pool; diff --git a/desktop/src/zero1hd/rhythmbullet/desktop/entity/EntityManager.java b/core/src/zero1hd/rhythmbullet/entity/EntityManager.java similarity index 75% rename from desktop/src/zero1hd/rhythmbullet/desktop/entity/EntityManager.java rename to core/src/zero1hd/rhythmbullet/entity/EntityManager.java index 882b8c8..288ee47 100755 --- a/desktop/src/zero1hd/rhythmbullet/desktop/entity/EntityManager.java +++ b/core/src/zero1hd/rhythmbullet/entity/EntityManager.java @@ -1,15 +1,15 @@ -package zero1hd.rhythmbullet.desktop.entity; +package zero1hd.rhythmbullet.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; +import zero1hd.rhythmbullet.entity.ally.Laser; +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 EntityManager { private AssetManager assets; diff --git a/desktop/src/zero1hd/rhythmbullet/desktop/entity/ally/Laser.java b/core/src/zero1hd/rhythmbullet/entity/ally/Laser.java similarity index 85% rename from desktop/src/zero1hd/rhythmbullet/desktop/entity/ally/Laser.java rename to core/src/zero1hd/rhythmbullet/entity/ally/Laser.java index f3ad336..aee2962 100755 --- a/desktop/src/zero1hd/rhythmbullet/desktop/entity/ally/Laser.java +++ b/core/src/zero1hd/rhythmbullet/entity/ally/Laser.java @@ -1,4 +1,4 @@ -package zero1hd.rhythmbullet.desktop.entity.ally; +package zero1hd.rhythmbullet.entity.ally; 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.Sprite; -import zero1hd.rhythmbullet.desktop.RhythmBullet; -import zero1hd.rhythmbullet.desktop.entity.Entity; +import zero1hd.rhythmbullet.RhythmBullet; +import zero1hd.rhythmbullet.entity.Entity; public class Laser extends Entity { Sound sfx; diff --git a/desktop/src/zero1hd/rhythmbullet/desktop/entity/ally/PolyjetEntity.java b/core/src/zero1hd/rhythmbullet/entity/ally/PolyjetEntity.java similarity index 91% rename from desktop/src/zero1hd/rhythmbullet/desktop/entity/ally/PolyjetEntity.java rename to core/src/zero1hd/rhythmbullet/entity/ally/PolyjetEntity.java index a169b2e..19606b1 100755 --- a/desktop/src/zero1hd/rhythmbullet/desktop/entity/ally/PolyjetEntity.java +++ b/core/src/zero1hd/rhythmbullet/entity/ally/PolyjetEntity.java @@ -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.graphics.Texture; @@ -7,8 +7,8 @@ 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; +import zero1hd.rhythmbullet.RhythmBullet; +import zero1hd.rhythmbullet.entity.Entity; public class PolyjetEntity extends Entity { public float health; diff --git a/desktop/src/zero1hd/rhythmbullet/desktop/entity/coordinator/Coordinator.java b/core/src/zero1hd/rhythmbullet/entity/coordinator/Coordinator.java similarity index 77% rename from desktop/src/zero1hd/rhythmbullet/desktop/entity/coordinator/Coordinator.java rename to core/src/zero1hd/rhythmbullet/entity/coordinator/Coordinator.java index 91c0996..f048447 100755 --- a/desktop/src/zero1hd/rhythmbullet/desktop/entity/coordinator/Coordinator.java +++ b/core/src/zero1hd/rhythmbullet/entity/coordinator/Coordinator.java @@ -1,9 +1,9 @@ -package zero1hd.rhythmbullet.desktop.entity.coordinator; +package zero1hd.rhythmbullet.entity.coordinator; import com.badlogic.gdx.utils.Pool.Poolable; -import zero1hd.rhythmbullet.desktop.entity.Entity; -import zero1hd.rhythmbullet.desktop.entity.EntityManager; +import zero1hd.rhythmbullet.entity.Entity; +import zero1hd.rhythmbullet.entity.EntityManager; public class Coordinator implements Poolable { private CoordinatorFrame cf; diff --git a/desktop/src/zero1hd/rhythmbullet/desktop/entity/coordinator/CoordinatorFrame.java b/core/src/zero1hd/rhythmbullet/entity/coordinator/CoordinatorFrame.java similarity index 85% rename from desktop/src/zero1hd/rhythmbullet/desktop/entity/coordinator/CoordinatorFrame.java rename to core/src/zero1hd/rhythmbullet/entity/coordinator/CoordinatorFrame.java index b3a6ed4..e1e8531 100755 --- a/desktop/src/zero1hd/rhythmbullet/desktop/entity/coordinator/CoordinatorFrame.java +++ b/core/src/zero1hd/rhythmbullet/entity/coordinator/CoordinatorFrame.java @@ -1,8 +1,8 @@ -package zero1hd.rhythmbullet.desktop.entity.coordinator; +package zero1hd.rhythmbullet.entity.coordinator; import com.badlogic.gdx.utils.Pool; -import zero1hd.rhythmbullet.desktop.entity.EntityManager; +import zero1hd.rhythmbullet.entity.EntityManager; public class CoordinatorFrame { private Pool pool; diff --git a/desktop/src/zero1hd/rhythmbullet/desktop/entity/coordinator/CoordinatorManager.java b/core/src/zero1hd/rhythmbullet/entity/coordinator/CoordinatorManager.java similarity index 75% rename from desktop/src/zero1hd/rhythmbullet/desktop/entity/coordinator/CoordinatorManager.java rename to core/src/zero1hd/rhythmbullet/entity/coordinator/CoordinatorManager.java index 3cdc70f..384b2a2 100755 --- a/desktop/src/zero1hd/rhythmbullet/desktop/entity/coordinator/CoordinatorManager.java +++ b/core/src/zero1hd/rhythmbullet/entity/coordinator/CoordinatorManager.java @@ -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 { private EntityManager em; diff --git a/desktop/src/zero1hd/rhythmbullet/desktop/entity/coordinator/SlowLeftCoordinator.java b/core/src/zero1hd/rhythmbullet/entity/coordinator/SlowLeftCoordinator.java similarity index 71% rename from desktop/src/zero1hd/rhythmbullet/desktop/entity/coordinator/SlowLeftCoordinator.java rename to core/src/zero1hd/rhythmbullet/entity/coordinator/SlowLeftCoordinator.java index e5ed746..26ffd52 100755 --- a/desktop/src/zero1hd/rhythmbullet/desktop/entity/coordinator/SlowLeftCoordinator.java +++ b/core/src/zero1hd/rhythmbullet/entity/coordinator/SlowLeftCoordinator.java @@ -1,4 +1,4 @@ -package zero1hd.rhythmbullet.desktop.entity.coordinator; +package zero1hd.rhythmbullet.entity.coordinator; public class SlowLeftCoordinator extends Coordinator { @Override diff --git a/desktop/src/zero1hd/rhythmbullet/desktop/entity/coordinator/SlowRightCoordinator.java b/core/src/zero1hd/rhythmbullet/entity/coordinator/SlowRightCoordinator.java similarity index 71% rename from desktop/src/zero1hd/rhythmbullet/desktop/entity/coordinator/SlowRightCoordinator.java rename to core/src/zero1hd/rhythmbullet/entity/coordinator/SlowRightCoordinator.java index 9984348..7b7da40 100755 --- a/desktop/src/zero1hd/rhythmbullet/desktop/entity/coordinator/SlowRightCoordinator.java +++ b/core/src/zero1hd/rhythmbullet/entity/coordinator/SlowRightCoordinator.java @@ -1,4 +1,4 @@ -package zero1hd.rhythmbullet.desktop.entity.coordinator; +package zero1hd.rhythmbullet.entity.coordinator; public class SlowRightCoordinator extends Coordinator { @Override diff --git a/desktop/src/zero1hd/rhythmbullet/desktop/entity/enemies/Flake.java b/core/src/zero1hd/rhythmbullet/entity/enemies/Flake.java similarity index 90% rename from desktop/src/zero1hd/rhythmbullet/desktop/entity/enemies/Flake.java rename to core/src/zero1hd/rhythmbullet/entity/enemies/Flake.java index 145708e..d04a46b 100755 --- a/desktop/src/zero1hd/rhythmbullet/desktop/entity/enemies/Flake.java +++ b/core/src/zero1hd/rhythmbullet/entity/enemies/Flake.java @@ -1,4 +1,4 @@ -package zero1hd.rhythmbullet.desktop.entity.enemies; +package zero1hd.rhythmbullet.entity.enemies; 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.math.Rectangle; -import zero1hd.rhythmbullet.desktop.entity.Entity; -import zero1hd.rhythmbullet.desktop.entity.ally.Laser; +import zero1hd.rhythmbullet.entity.Entity; +import zero1hd.rhythmbullet.entity.ally.Laser; public class Flake extends Entity { private float timer; diff --git a/desktop/src/zero1hd/rhythmbullet/desktop/entity/enemies/Pellet.java b/core/src/zero1hd/rhythmbullet/entity/enemies/Pellet.java similarity index 90% rename from desktop/src/zero1hd/rhythmbullet/desktop/entity/enemies/Pellet.java rename to core/src/zero1hd/rhythmbullet/entity/enemies/Pellet.java index 380a329..3fa43af 100755 --- a/desktop/src/zero1hd/rhythmbullet/desktop/entity/enemies/Pellet.java +++ b/core/src/zero1hd/rhythmbullet/entity/enemies/Pellet.java @@ -1,4 +1,4 @@ -package zero1hd.rhythmbullet.desktop.entity.enemies; +package zero1hd.rhythmbullet.entity.enemies; 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.utils.Pool.Poolable; -import zero1hd.rhythmbullet.desktop.entity.Entity; +import zero1hd.rhythmbullet.entity.Entity; public class Pellet extends Entity implements Poolable { diff --git a/desktop/src/zero1hd/rhythmbullet/desktop/entity/enemies/Shard.java b/core/src/zero1hd/rhythmbullet/entity/enemies/Shard.java similarity index 90% rename from desktop/src/zero1hd/rhythmbullet/desktop/entity/enemies/Shard.java rename to core/src/zero1hd/rhythmbullet/entity/enemies/Shard.java index d66361e..0f1204a 100755 --- a/desktop/src/zero1hd/rhythmbullet/desktop/entity/enemies/Shard.java +++ b/core/src/zero1hd/rhythmbullet/entity/enemies/Shard.java @@ -1,4 +1,4 @@ -package zero1hd.rhythmbullet.desktop.entity.enemies; +package zero1hd.rhythmbullet.entity.enemies; 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.math.Rectangle; -import zero1hd.rhythmbullet.desktop.entity.Entity; -import zero1hd.rhythmbullet.desktop.entity.ally.Laser; +import zero1hd.rhythmbullet.entity.Entity; +import zero1hd.rhythmbullet.entity.ally.Laser; public class Shard extends Entity { private int hp; diff --git a/desktop/src/zero1hd/rhythmbullet/desktop/entity/enemies/VoidCircle.java b/core/src/zero1hd/rhythmbullet/entity/enemies/VoidCircle.java similarity index 92% rename from desktop/src/zero1hd/rhythmbullet/desktop/entity/enemies/VoidCircle.java rename to core/src/zero1hd/rhythmbullet/entity/enemies/VoidCircle.java index 03981de..0a50eea 100755 --- a/desktop/src/zero1hd/rhythmbullet/desktop/entity/enemies/VoidCircle.java +++ b/core/src/zero1hd/rhythmbullet/entity/enemies/VoidCircle.java @@ -1,4 +1,4 @@ -package zero1hd.rhythmbullet.desktop.entity.enemies; +package zero1hd.rhythmbullet.entity.enemies; 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.Sprite; -import zero1hd.rhythmbullet.desktop.entity.Entity; +import zero1hd.rhythmbullet.entity.Entity; public class VoidCircle extends Entity { private float timer; diff --git a/core/src/zero1hd/rhythmbullet/util/AdvancedResizeScreen.java b/core/src/zero1hd/rhythmbullet/util/AdvancedResizeScreen.java new file mode 100755 index 0000000..51a2fd9 --- /dev/null +++ b/core/src/zero1hd/rhythmbullet/util/AdvancedResizeScreen.java @@ -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(); +} diff --git a/core/src/zero1hd/rhythmbullet/util/TransitionAdapter.java b/core/src/zero1hd/rhythmbullet/util/TransitionAdapter.java deleted file mode 100755 index 9254353..0000000 --- a/core/src/zero1hd/rhythmbullet/util/TransitionAdapter.java +++ /dev/null @@ -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); -} diff --git a/desktop/src/zero1hd/rhythmbullet/desktop/DesktopLauncher.java b/desktop/src/zero1hd/rhythmbullet/desktop/DesktopLauncher.java index e26ab62..0f176ff 100755 --- a/desktop/src/zero1hd/rhythmbullet/desktop/DesktopLauncher.java +++ b/desktop/src/zero1hd/rhythmbullet/desktop/DesktopLauncher.java @@ -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); + + } } diff --git a/desktop/src/zero1hd/rhythmbullet/desktop/audio/map/EntitySpawnInfo.java b/desktop/src/zero1hd/rhythmbullet/desktop/audio/map/EntitySpawnInfo.java index 2eb6253..af4e93b 100755 --- a/desktop/src/zero1hd/rhythmbullet/desktop/audio/map/EntitySpawnInfo.java +++ b/desktop/src/zero1hd/rhythmbullet/desktop/audio/map/EntitySpawnInfo.java @@ -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 entityToSpawn; diff --git a/desktop/src/zero1hd/rhythmbullet/desktop/audio/map/GamePlayMap.java b/desktop/src/zero1hd/rhythmbullet/desktop/audio/map/GamePlayMap.java index ec1a26e..d95210a 100755 --- a/desktop/src/zero1hd/rhythmbullet/desktop/audio/map/GamePlayMap.java +++ b/desktop/src/zero1hd/rhythmbullet/desktop/audio/map/GamePlayMap.java @@ -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 { diff --git a/desktop/src/zero1hd/rhythmbullet/desktop/audio/map/RhythmMapAlgorithm.java b/desktop/src/zero1hd/rhythmbullet/desktop/audio/map/RhythmMapAlgorithm.java index 899f483..abebe8f 100755 --- a/desktop/src/zero1hd/rhythmbullet/desktop/audio/map/RhythmMapAlgorithm.java +++ b/desktop/src/zero1hd/rhythmbullet/desktop/audio/map/RhythmMapAlgorithm.java @@ -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; diff --git a/desktop/src/zero1hd/rhythmbullet/desktop/graphics/ui/components/HealthBar.java b/desktop/src/zero1hd/rhythmbullet/desktop/graphics/ui/components/HealthBar.java index 4327d7d..2239ad2 100755 --- a/desktop/src/zero1hd/rhythmbullet/desktop/graphics/ui/components/HealthBar.java +++ b/desktop/src/zero1hd/rhythmbullet/desktop/graphics/ui/components/HealthBar.java @@ -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; diff --git a/desktop/src/zero1hd/rhythmbullet/desktop/graphics/ui/pages/MainPage.java b/desktop/src/zero1hd/rhythmbullet/desktop/graphics/ui/pages/MainPage.java index 4988f78..3a3b301 100755 --- a/desktop/src/zero1hd/rhythmbullet/desktop/graphics/ui/pages/MainPage.java +++ b/desktop/src/zero1hd/rhythmbullet/desktop/graphics/ui/pages/MainPage.java @@ -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; diff --git a/desktop/src/zero1hd/rhythmbullet/desktop/graphics/ui/pages/OptionsPage.java b/desktop/src/zero1hd/rhythmbullet/desktop/graphics/ui/pages/OptionsPage.java index 28e3b8d..64d03e3 100755 --- a/desktop/src/zero1hd/rhythmbullet/desktop/graphics/ui/pages/OptionsPage.java +++ b/desktop/src/zero1hd/rhythmbullet/desktop/graphics/ui/pages/OptionsPage.java @@ -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 { diff --git a/desktop/src/zero1hd/rhythmbullet/desktop/graphics/ui/windows/SpawnerWindow.java b/desktop/src/zero1hd/rhythmbullet/desktop/graphics/ui/windows/SpawnerWindow.java index 344de2c..ee29663 100755 --- a/desktop/src/zero1hd/rhythmbullet/desktop/graphics/ui/windows/SpawnerWindow.java +++ b/desktop/src/zero1hd/rhythmbullet/desktop/graphics/ui/windows/SpawnerWindow.java @@ -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; diff --git a/desktop/src/zero1hd/rhythmbullet/desktop/screens/GameScreen.java b/desktop/src/zero1hd/rhythmbullet/desktop/screens/GameScreen.java index 492872c..244d9d5 100755 --- a/desktop/src/zero1hd/rhythmbullet/desktop/screens/GameScreen.java +++ b/desktop/src/zero1hd/rhythmbullet/desktop/screens/GameScreen.java @@ -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; diff --git a/desktop/src/zero1hd/rhythmbullet/desktop/screens/LoadingScreen.java b/desktop/src/zero1hd/rhythmbullet/desktop/screens/LoadingScreen.java index a21ca1e..30c0beb 100755 --- a/desktop/src/zero1hd/rhythmbullet/desktop/screens/LoadingScreen.java +++ b/desktop/src/zero1hd/rhythmbullet/desktop/screens/LoadingScreen.java @@ -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))); } } diff --git a/desktop/src/zero1hd/rhythmbullet/desktop/screens/MainMenu.java b/desktop/src/zero1hd/rhythmbullet/desktop/screens/MainMenu.java index 5913622..d543d6a 100755 --- a/desktop/src/zero1hd/rhythmbullet/desktop/screens/MainMenu.java +++ b/desktop/src/zero1hd/rhythmbullet/desktop/screens/MainMenu.java @@ -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(); diff --git a/desktop/src/zero1hd/rhythmbullet/desktop/stages/GameHUD.java b/desktop/src/zero1hd/rhythmbullet/desktop/stages/GameHUD.java index 7c88886..e56f33e 100755 --- a/desktop/src/zero1hd/rhythmbullet/desktop/stages/GameHUD.java +++ b/desktop/src/zero1hd/rhythmbullet/desktop/stages/GameHUD.java @@ -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; diff --git a/desktop/src/zero1hd/rhythmbullet/desktop/stages/GamePlayArea.java b/desktop/src/zero1hd/rhythmbullet/desktop/stages/GamePlayArea.java index c55a493..5e3f051 100755 --- a/desktop/src/zero1hd/rhythmbullet/desktop/stages/GamePlayArea.java +++ b/desktop/src/zero1hd/rhythmbullet/desktop/stages/GamePlayArea.java @@ -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;