From 1af07188e61c827f63adf339fe063714ab20106f Mon Sep 17 00:00:00 2001 From: Recrown Date: Fri, 18 Aug 2017 02:14:30 -0500 Subject: [PATCH] switched to lwjgl3, began changing way screen resize system works, minor bug fix with options screen --- android/assets/uiskin.png | Bin 5574 -> 5574 bytes android/assets/uiskin_legacyB.png | Bin 0 -> 5574 bytes build.gradle | 2 +- .../zero1hd/rhythmbullet/RhythmBullet.java | 113 ++++++++++-------- .../rhythmbullet/audio/AudioAnalyzer.java | 3 +- .../zero1hd/rhythmbullet/audio/AudioData.java | 3 +- .../rhythmbullet/audio/Mp3AudioData.java | 2 +- .../rhythmbullet/audio/WavAudioData.java | 2 +- .../rhythmbullet/entity/enemies/Shard.java | 2 +- .../rhythmbullet/screens/LoadingScreen.java | 31 ++--- .../rhythmbullet/screens/MainMenu.java | 27 +++-- .../rhythmbullet/screens/PreGameScreen.java | 12 +- .../ui/builders/GraphicsTable.java | 2 +- .../ui/pages/MusicSelectionPage.java | 7 +- .../rhythmbullet/ui/pages/OptionsPage.java | 43 ++----- .../rhythmbullet/util/TransitionAdapter.java | 12 +- .../rhythmbullet/desktop/DesktopLauncher.java | 20 ++-- 17 files changed, 152 insertions(+), 129 deletions(-) create mode 100755 android/assets/uiskin_legacyB.png diff --git a/android/assets/uiskin.png b/android/assets/uiskin.png index 74cde44b9f95e2aea3f7845826c1ad57022cc852..960d3148b670edc9f1fdfcb2b086cd7e59a5481f 100755 GIT binary patch delta 21 ccmX@6eN20T4VM@LgP0hj{dJSW8{Ha20Y~Eol>h($ delta 21 dcmX@6eN20T4VO3rgP1tu+X>gyH@Y>50su@p2Lu2B diff --git a/android/assets/uiskin_legacyB.png b/android/assets/uiskin_legacyB.png new file mode 100755 index 0000000000000000000000000000000000000000..960d3148b670edc9f1fdfcb2b086cd7e59a5481f GIT binary patch literal 5574 zcmds5hgVZuvp>ltDnUf53IZw!NJpB|l@fZ9`bCO}G?5;<2|*DQM5Gs`iUGwCkPZf< z2v_L_3=jiSgv5Y=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>uTCVRji>7;BFi6DWqwV4lNjSFQe38Lw$Kdw{Q*1sV_S0lr*lU7=6V&Euig0{4R5WE literal 0 HcmV?d00001 diff --git a/build.gradle b/build.gradle index d0e1c1e..fa560fe 100755 --- a/build.gradle +++ b/build.gradle @@ -38,7 +38,7 @@ project(":desktop") { dependencies { compile project(":core") - compile "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion" + compile "com.badlogicgames.gdx:gdx-backend-lwjgl3:$gdxVersion" compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop" compile "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-desktop" } diff --git a/core/src/zero1hd/rhythmbullet/RhythmBullet.java b/core/src/zero1hd/rhythmbullet/RhythmBullet.java index b7d85e3..0d2ae33 100755 --- a/core/src/zero1hd/rhythmbullet/RhythmBullet.java +++ b/core/src/zero1hd/rhythmbullet/RhythmBullet.java @@ -32,12 +32,13 @@ import com.badlogic.gdx.scenes.scene2d.ui.TextField.TextFieldStyle; import com.badlogic.gdx.scenes.scene2d.ui.Window.WindowStyle; import zero1hd.rhythmbullet.screens.LoadingScreen; -import zero1hd.rhythmbullet.screens.MainMenu; 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; @@ -56,18 +57,12 @@ public class RhythmBullet extends Game { Gdx.app.setLogLevel(Application.LOG_DEBUG); prefs = Gdx.app.getPreferences("PolyJet_Preferences"); - setScreen(new MainMenu(this)); if (prefs.getBoolean("fullscreen", true)) { Gdx.graphics.setFullscreenMode(Gdx.graphics.getDisplayMode()); } else { Gdx.graphics.setWindowedMode(prefs.getInteger("screen-width"), prefs.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()); - - Resolution[] resolution = { new Resolution(800, 480, "800x480"), new Resolution(1280, 720, "1280x720"), @@ -87,20 +82,40 @@ public class RhythmBullet extends Game { assetManager.setLoader(ParticleEffect.class, new ParticleEffectLoader(genericFileFinder)); assetManager.setLoader(Sound.class, new SoundLoader(genericFileFinder)); + resizing = false; + default_fontGenerator = new FreeTypeFontGenerator(Gdx.files.internal("fonts/Gasalt-Regular.ttf")); darktech_ldr_fontGenerator = new FreeTypeFontGenerator(Gdx.files.internal("fonts/darktech_ldr.ttf")); + if (prefs.getBoolean("fullscreen", true)) { + Gdx.graphics.setFullscreenMode(Gdx.graphics.getDisplayMode()); + } else { + Gdx.graphics.setWindowedMode(prefs.getInteger("screen-width"), prefs.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)); } @Override public void render() { + if (resizing) { + if (assetManager.update()) { + resizing = false; + generateFonts(); + defineSkinStyles(); + assetManager.get("standard_thrust.p", ParticleEffect.class).flipY(); + ((TransitionAdapter) getScreen()).postTransition(); + } + } super.render(); } @Override public void dispose() { - if (skinAtlas != null) { + Gdx.app.debug("Core", "disposing..."); + if (initComplete) { skinAtlas.dispose(); getDefaultSkin().dispose(); default_fontGenerator.dispose(); @@ -110,6 +125,47 @@ public class RhythmBullet extends Game { super.dispose(); } + @Override + public void resize(int width, int height) { + if (width != 0 && height != 0) { + if (initComplete) { + ((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) { + Gdx.app.debug("Font pixel size", MathUtils.round(Gdx.graphics.getDensity()*(fontSize*Gdx.graphics.getHeight())) + "px"); + if (Gdx.graphics.getHeight() != 0) { + return MathUtils.round(Gdx.graphics.getDensity()*(fontSize*Gdx.graphics.getHeight())); + } else { + return MathUtils.round(Gdx.graphics.getDensity()*(fontSize*480)); + } + } + + 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); @@ -138,11 +194,8 @@ public class RhythmBullet extends Game { assetManager.load("magic1.png", Texture.class); } public void generateFonts() { - initComplete = true; defaultSkin = new Skin(); - Gdx.app.debug("Prelaunch Debug Info", "Generating fonts..."); - skinAtlas = assetManager.get("uiskin.atlas", TextureAtlas.class); getDefaultSkin().addRegions(skinAtlas); @@ -151,32 +204,26 @@ public class RhythmBullet extends Game { size = 18; } })); - getDefaultSkin().add("sub-font", default_fontGenerator.generateFont(new FreeTypeFontParameter() { { size = fontScale(0.04f); } })); - getDefaultSkin().add("default-font", default_fontGenerator.generateFont(new FreeTypeFontParameter() { { size = fontScale(0.07f); } })); - - getDefaultSkin().add("large-font", default_fontGenerator.generateFont(new FreeTypeFontParameter() { { size = fontScale(0.085f); } })); - getDefaultSkin().add("special-font", darktech_ldr_fontGenerator.generateFont(new FreeTypeFontParameter() { { size = fontScale(0.075f); } })); - } public void defineSkinStyles() { @@ -260,34 +307,4 @@ public class RhythmBullet extends Game { Gdx.app.debug("Prelaunch Debug Info", "UI Skin has been defined."); } - - @Override - public void resize(int width, int height) { - if (initComplete) { - getDefaultSkin().dispose(); - assetManager.clear(); - prefs.putInteger("screen-width", width); - prefs.putInteger("screen-height", height); - prefs.flush(); - } - setScreen(new LoadingScreen(this, getScreen(), true, !initComplete)); - super.resize(width, height); - } - - public int fontScale(float fontSize) { - Gdx.app.debug("Font pixel size", MathUtils.round(Gdx.graphics.getDensity()*(fontSize*Gdx.graphics.getHeight())) + "px"); - return MathUtils.round(Gdx.graphics.getDensity()*(fontSize*Gdx.graphics.getHeight())); - } - - public AssetManager getAssetManager() { - return assetManager; - } - - public Skin getDefaultSkin() { - return defaultSkin; - } - - public Preferences getPrefs() { - return prefs; - } } diff --git a/core/src/zero1hd/rhythmbullet/audio/AudioAnalyzer.java b/core/src/zero1hd/rhythmbullet/audio/AudioAnalyzer.java index f79725b..87de5c7 100755 --- a/core/src/zero1hd/rhythmbullet/audio/AudioAnalyzer.java +++ b/core/src/zero1hd/rhythmbullet/audio/AudioAnalyzer.java @@ -71,7 +71,7 @@ public class AudioAnalyzer { public void run() { progress = 0; int tasksDone = 0; - long totalTasks = audioData.getFrameCount()/audioData.getReadWindowSize(); + long totalTasks = audioData.getSampleCount()/audioData.getReadWindowSize(); bassThresholdMultiplier = 1.5f; mThresholdMultiplier = 1.4f; @@ -158,6 +158,7 @@ public class AudioAnalyzer { shrinkData(); containsData = true; Gdx.app.debug("Audio Analyzer", "USING SEED: " + PUID); + progress = 100; sender.send(MiniEvents.SPECTRAL_FLUX_DONE); } } diff --git a/core/src/zero1hd/rhythmbullet/audio/AudioData.java b/core/src/zero1hd/rhythmbullet/audio/AudioData.java index e624d93..f0761f3 100755 --- a/core/src/zero1hd/rhythmbullet/audio/AudioData.java +++ b/core/src/zero1hd/rhythmbullet/audio/AudioData.java @@ -42,9 +42,10 @@ public interface AudioData extends Disposable { /** * returns sample count + * Can be inaccurate. * @return */ - public long getFrameCount(); + public long getSampleCount(); /** * returns duration of song in seconds diff --git a/core/src/zero1hd/rhythmbullet/audio/Mp3AudioData.java b/core/src/zero1hd/rhythmbullet/audio/Mp3AudioData.java index a97313b..4c49e29 100755 --- a/core/src/zero1hd/rhythmbullet/audio/Mp3AudioData.java +++ b/core/src/zero1hd/rhythmbullet/audio/Mp3AudioData.java @@ -92,7 +92,7 @@ public class Mp3AudioData implements AudioData { } @Override - public long getFrameCount() { + public long getSampleCount() { return sampleCount; } diff --git a/core/src/zero1hd/rhythmbullet/audio/WavAudioData.java b/core/src/zero1hd/rhythmbullet/audio/WavAudioData.java index 25fc298..05b66f5 100755 --- a/core/src/zero1hd/rhythmbullet/audio/WavAudioData.java +++ b/core/src/zero1hd/rhythmbullet/audio/WavAudioData.java @@ -69,7 +69,7 @@ public class WavAudioData implements AudioData { } @Override - public long getFrameCount() { + public long getSampleCount() { return decoder.getFrameCount(); } diff --git a/core/src/zero1hd/rhythmbullet/entity/enemies/Shard.java b/core/src/zero1hd/rhythmbullet/entity/enemies/Shard.java index a2c7836..0f1204a 100755 --- a/core/src/zero1hd/rhythmbullet/entity/enemies/Shard.java +++ b/core/src/zero1hd/rhythmbullet/entity/enemies/Shard.java @@ -30,7 +30,7 @@ public class Shard extends Entity { maxHp = hp; this.angle = angle; setPosition(x-(getWidth()/2f), y-(getHeight()/2f)); - + hitbox.setSize(getWidth(), getHeight()); } /** diff --git a/core/src/zero1hd/rhythmbullet/screens/LoadingScreen.java b/core/src/zero1hd/rhythmbullet/screens/LoadingScreen.java index 622e38b..f634f20 100755 --- a/core/src/zero1hd/rhythmbullet/screens/LoadingScreen.java +++ b/core/src/zero1hd/rhythmbullet/screens/LoadingScreen.java @@ -1,7 +1,6 @@ package zero1hd.rhythmbullet.screens; import com.badlogic.gdx.Gdx; -import com.badlogic.gdx.Screen; import com.badlogic.gdx.ScreenAdapter; import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.GL20; @@ -13,35 +12,35 @@ import com.badlogic.gdx.scenes.scene2d.ui.Image; import com.badlogic.gdx.utils.viewport.ScreenViewport; import zero1hd.rhythmbullet.RhythmBullet; -import zero1hd.rhythmbullet.util.TransitionAdapter; public class LoadingScreen extends ScreenAdapter { private Stage stage; RhythmBullet core; Image zero1HD; - Screen gotoScreen; - boolean reInit; - public LoadingScreen(RhythmBullet core, Screen gotoScreen, boolean reInit, boolean timer) { + public LoadingScreen(RhythmBullet core) { this.core = core; - this.gotoScreen = gotoScreen; - this.reInit = reInit; stage = new Stage(new ScreenViewport()); + core.getAssetManager().load("splashlogo.png", Texture.class); core.getAssetManager().finishLoading(); + zero1HD = new Image(this.core.getAssetManager().get("splashlogo.png", Texture.class)); zero1HD.setColor(0f,1f,1f,0f); stage.addActor(zero1HD); zero1HD.setPosition(stage.getWidth()/2 - zero1HD.getWidth()/2, stage.getHeight()/2 - zero1HD.getHeight()/2); - if (timer) { - zero1HD.addAction(Actions.sequence(Actions.color(Color.WHITE, 1f))); - } + zero1HD.addAction(Actions.sequence(Actions.color(Color.WHITE, 1f))); core.queueAssets(); } + @Override + public void show() { + super.show(); + } + float count = 0; @Override public void render(float delta) { @@ -56,11 +55,8 @@ public class LoadingScreen extends ScreenAdapter { core.generateFonts(); core.defineSkinStyles(); - if (reInit) { - ((TransitionAdapter) gotoScreen).postTransition(); - } - - core.setScreen(gotoScreen); + core.setScreen(new MainMenu(core)); + core.setInitComplete(); core.getAssetManager().unload("splashlogo.png"); core.getAssetManager().get("standard_thrust.p", ParticleEffect.class).flipY(); } @@ -73,4 +69,9 @@ public class LoadingScreen extends ScreenAdapter { stage.getViewport().update(width, height, true); super.resize(width, height); } + + @Override + public void hide() { + super.hide(); + } } diff --git a/core/src/zero1hd/rhythmbullet/screens/MainMenu.java b/core/src/zero1hd/rhythmbullet/screens/MainMenu.java index d6550ee..455e8e4 100755 --- a/core/src/zero1hd/rhythmbullet/screens/MainMenu.java +++ b/core/src/zero1hd/rhythmbullet/screens/MainMenu.java @@ -2,7 +2,6 @@ package zero1hd.rhythmbullet.screens; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Input.Keys; -import com.badlogic.gdx.Screen; import com.badlogic.gdx.ScreenAdapter; import com.badlogic.gdx.graphics.GL20; import com.badlogic.gdx.math.Vector3; @@ -19,8 +18,6 @@ import zero1hd.rhythmbullet.ui.pages.MoreOptionsPage; import zero1hd.rhythmbullet.ui.pages.OptionsPage; import zero1hd.rhythmbullet.util.TransitionAdapter; - - public class MainMenu extends ScreenAdapter implements TransitionAdapter { public Stage stage; private Vector3 targetPosition; @@ -32,15 +29,21 @@ public class MainMenu extends ScreenAdapter implements TransitionAdapter { private RhythmBullet core; + private float lerpAlpha; public MainMenu(final RhythmBullet core) { this.core = core; stage = new Stage(new ScreenViewport()); targetPosition = new Vector3(stage.getCamera().position); + + postTransition(); } - public Screen postTransition() { + @Override + public void preTransition() { stage.clear(); - + } + + public void postTransition() { mainPage = new MainPage(core, targetPosition); mainPage.setPosition(0, 0); stage.addActor(mainPage); @@ -86,12 +89,12 @@ public class MainMenu extends ScreenAdapter implements TransitionAdapter { }); Gdx.app.debug("Post Transition", "Beginning screen setup for Main menu."); - return this; } @Override public void show() { Gdx.input.setInputProcessor(stage); + calcLerpAlpha(Gdx.graphics.getWidth()); super.show(); } @@ -117,7 +120,8 @@ public class MainMenu extends ScreenAdapter implements TransitionAdapter { stage.draw(); if (stage.getCamera().position.x != targetPosition.x || stage.getCamera().position.y != targetPosition.y) { - stage.getCamera().position.lerp(targetPosition, 0.25f); + + stage.getCamera().position.lerp(targetPosition, lerpAlpha); } super.render(delta); @@ -128,6 +132,7 @@ public class MainMenu extends ScreenAdapter implements TransitionAdapter { stage.getViewport().update(width, height, false); targetPosition.x = width/2; targetPosition.y = height/2; + calcLerpAlpha(width); super.resize(width, height); } @@ -136,4 +141,12 @@ public class MainMenu extends ScreenAdapter implements TransitionAdapter { stage.dispose(); super.dispose(); } + + private void calcLerpAlpha(int width) { + if (width >= 3835) { + lerpAlpha = 0.005f; + } else { + lerpAlpha = 0.25f; + } + } } diff --git a/core/src/zero1hd/rhythmbullet/screens/PreGameScreen.java b/core/src/zero1hd/rhythmbullet/screens/PreGameScreen.java index eecb7f3..3451983 100755 --- a/core/src/zero1hd/rhythmbullet/screens/PreGameScreen.java +++ b/core/src/zero1hd/rhythmbullet/screens/PreGameScreen.java @@ -68,18 +68,21 @@ public class PreGameScreen extends ScreenAdapter implements TransitionAdapter, M if (cameraPos.x == 1.5f*Gdx.graphics.getWidth()) { cameraPos.x = 0.5f*Gdx.graphics.getWidth(); } else { - core.setScreen(new MainMenu(core).postTransition()); + core.setScreen(new MainMenu(core)); } break; default: break; } } - + @Override - public Screen postTransition() { + public void preTransition() { stage.clear(); - + } + + @Override + public void postTransition() { ms = new MusicSelectionPage(core); ms.miniSender.addListener(this); ms.beginMusicSearch(); @@ -89,7 +92,6 @@ public class PreGameScreen extends ScreenAdapter implements TransitionAdapter, M ap.miniSender.addListener(this); ap.setPosition(Gdx.graphics.getWidth(), ap.getY()); stage.addActor(ap); - return this; } public void setPhase(int phase) { diff --git a/core/src/zero1hd/rhythmbullet/ui/builders/GraphicsTable.java b/core/src/zero1hd/rhythmbullet/ui/builders/GraphicsTable.java index b99c7a4..b21a303 100755 --- a/core/src/zero1hd/rhythmbullet/ui/builders/GraphicsTable.java +++ b/core/src/zero1hd/rhythmbullet/ui/builders/GraphicsTable.java @@ -55,7 +55,7 @@ public class GraphicsTable extends Table { add(fancySpriteShader).minHeight(shaders.getHeight()); row(); - resolutions = new Label("Optimized Resolutions", skin); + resolutions = new Label("Resolutions: ", skin); add(resolutions).left(); row(); diff --git a/core/src/zero1hd/rhythmbullet/ui/pages/MusicSelectionPage.java b/core/src/zero1hd/rhythmbullet/ui/pages/MusicSelectionPage.java index ab2a8fc..fa3e96e 100755 --- a/core/src/zero1hd/rhythmbullet/ui/pages/MusicSelectionPage.java +++ b/core/src/zero1hd/rhythmbullet/ui/pages/MusicSelectionPage.java @@ -127,7 +127,7 @@ public class MusicSelectionPage extends Page { loadingWindow.setProgress(prog); } } else { - NoticeWindow notice = new NoticeWindow(core.getDefaultSkin(), "default", "No song's found in:\n\"" + core.getPrefs().getString("music dir") + "\"\nTo change the search directory, go to game options.", core.getPrefs().getLong("fx vol"), core.getAssetManager()); + NoticeWindow notice = new NoticeWindow(core.getDefaultSkin(), "default", "No song's found in:\n\"" + core.getPrefs().getString("music dir") + "\"\nTo change the search directory, go to game options.", core.getPrefs().getFloat("fx vol"), core.getAssetManager()); notice.setSize(0.6f*getWidth(), 0.6f*getHeight()); notice.setPosition((getWidth()-notice.getWidth())/2f, (getHeight()-notice.getHeight())/2f); notice.setModal(true); @@ -151,4 +151,9 @@ public class MusicSelectionPage extends Page { public AudioInfo getSelectedMusicInfo() { return selectedMusicInfo; } + + @Override + public synchronized void addActor(Actor actor) { + super.addActor(actor); + } } diff --git a/core/src/zero1hd/rhythmbullet/ui/pages/OptionsPage.java b/core/src/zero1hd/rhythmbullet/ui/pages/OptionsPage.java index 6b8d2ea..a65700d 100755 --- a/core/src/zero1hd/rhythmbullet/ui/pages/OptionsPage.java +++ b/core/src/zero1hd/rhythmbullet/ui/pages/OptionsPage.java @@ -25,11 +25,8 @@ public class OptionsPage extends Page { private ProgressBar musicVolSlider; private ProgressBar fxVolSlider; private TextField directoryField; - private RhythmBullet core; - private byte goToScreen; public OptionsPage(final RhythmBullet core, final Vector3 targetPosition, final MoreOptionsPage moreOptionsPage) { - this.core = core; optionsTable.defaults().spaceLeft(40f).padTop(5f).padBottom(5f).left(); Label optionGeneralTitle = new Label("General", core.getDefaultSkin(), "large-font", core.getDefaultSkin().getColor("default")); @@ -81,19 +78,6 @@ public class OptionsPage extends Page { Label debugCodeLabel = new Label("Debug Code: ", core.getDefaultSkin()); optionsTable.add(debugCodeLabel).left(); final TextField debugCodeField = new TextField(null, core.getDefaultSkin()); - debugCodeField.addListener(new InputListener() { - @Override - public boolean keyUp(InputEvent event, int keycode) { - if (keycode == Keys.ENTER) { - Gdx.app.debug("Debug Field", debugCodeField.getText()); - if (debugCodeField.getText().equals("creative")) { - Gdx.app.debug("Debug Field", "going to creative test room..."); - goToScreen = 1; - } - } - return super.keyUp(event, keycode); - } - }); optionsTable.add(debugCodeField).prefWidth(810).left(); optionsTable.top(); @@ -137,7 +121,19 @@ public class OptionsPage extends Page { } }); optionsTable.add(graphicsSettings).colspan(2).fill(); - + addListener(new InputListener() { + @Override + public boolean keyUp(InputEvent event, int keycode) { + if (keycode == Keys.ENTER) { + Gdx.app.debug("Debug Field", debugCodeField.getText()); + if (debugCodeField.getText().equals("creative")) { + Gdx.app.debug("Debug Field", "going to creative test room..."); + core.setScreen(new CreativeScreen(core, (MainMenu) core.getScreen())); + } + } + return super.keyUp(event, keycode); + } + }); } public void saveOptions(Preferences prefs) { @@ -146,17 +142,4 @@ public class OptionsPage extends Page { prefs.putFloat("fx vol", fxVolSlider.getValue()); prefs.putString("music dir", directoryField.getText()); } - - @Override - public void act(float delta) { - if (core.getAssetManager().update() && goToScreen != 0) { - switch (goToScreen) { - case 1: - core.setScreen(new CreativeScreen(core, (MainMenu) core.getScreen())); - } - goToScreen = 0; - } - super.act(delta); - } - } diff --git a/core/src/zero1hd/rhythmbullet/util/TransitionAdapter.java b/core/src/zero1hd/rhythmbullet/util/TransitionAdapter.java index 7819713..c0a6e90 100755 --- a/core/src/zero1hd/rhythmbullet/util/TransitionAdapter.java +++ b/core/src/zero1hd/rhythmbullet/util/TransitionAdapter.java @@ -1,7 +1,13 @@ package zero1hd.rhythmbullet.util; -import com.badlogic.gdx.Screen; - public interface TransitionAdapter { - public Screen postTransition(); + /** + * called before assets are cleared from memory. + */ + public void preTransition(); + + /** + * called after transition completes and assets reloaded. + */ + public void postTransition(); } diff --git a/desktop/src/zero1hd/rhythmbullet/desktop/DesktopLauncher.java b/desktop/src/zero1hd/rhythmbullet/desktop/DesktopLauncher.java index df73a8d..2efe3f5 100755 --- a/desktop/src/zero1hd/rhythmbullet/desktop/DesktopLauncher.java +++ b/desktop/src/zero1hd/rhythmbullet/desktop/DesktopLauncher.java @@ -1,23 +1,17 @@ package zero1hd.rhythmbullet.desktop; -import com.badlogic.gdx.backends.lwjgl.LwjglApplication; -import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration; +import com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application; +import com.badlogic.gdx.backends.lwjgl3.Lwjgl3ApplicationConfiguration; import zero1hd.rhythmbullet.RhythmBullet; public class DesktopLauncher { public static void main (String[] arg) { - LwjglApplicationConfiguration config = new LwjglApplicationConfiguration(); - config.title = "Rhythm Bullet"; - config.width = 800; - config.height = 480; + Lwjgl3ApplicationConfiguration config = new Lwjgl3ApplicationConfiguration(); + config.setTitle("Rhythm Bullet"); + config.setResizable(false); + config.setWindowSizeLimits(800, 480, 3840, 2160); - config.resizable = false; - config.useHDPI = true; -// System.setProperty("org.lwjgl.opengl.Window.undecorated", "true"); - - - new LwjglApplication(new RhythmBullet(), config); - + new Lwjgl3Application(new RhythmBullet(), config); } }