smoothed out transition from loading splash to game menu
This commit is contained in:
parent
e8a96bbc87
commit
695ed19c50
@ -38,7 +38,7 @@ project(":desktop") {
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile project(":core")
|
compile project(":core")
|
||||||
compile "com.badlogicgames.gdx:gdx-backend-lwjgl3:$gdxVersion"
|
compile "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion"
|
||||||
compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
|
compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
|
||||||
compile "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-desktop"
|
compile "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-desktop"
|
||||||
}
|
}
|
||||||
|
@ -36,6 +36,7 @@ import zero1hd.rhythmbullet.util.GenericFileTypeHandler;
|
|||||||
import zero1hd.rhythmbullet.util.RoundingResolutionHandler;
|
import zero1hd.rhythmbullet.util.RoundingResolutionHandler;
|
||||||
import zero1hd.rhythmbullet.util.TransitionAdapter;
|
import zero1hd.rhythmbullet.util.TransitionAdapter;
|
||||||
|
|
||||||
|
|
||||||
public class RhythmBullet extends Game {
|
public class RhythmBullet extends Game {
|
||||||
private boolean initComplete = false;
|
private boolean initComplete = false;
|
||||||
private boolean resizing;
|
private boolean resizing;
|
||||||
@ -58,6 +59,12 @@ public class RhythmBullet extends Game {
|
|||||||
Gdx.app.setLogLevel(Application.LOG_DEBUG);
|
Gdx.app.setLogLevel(Application.LOG_DEBUG);
|
||||||
prefs = Gdx.app.getPreferences("PolyJet_Preferences");
|
prefs = Gdx.app.getPreferences("PolyJet_Preferences");
|
||||||
|
|
||||||
|
if (getPrefs().getBoolean("fullscreen", true)) {
|
||||||
|
Gdx.graphics.setFullscreenMode(Gdx.graphics.getDisplayMode());
|
||||||
|
} else {
|
||||||
|
Gdx.graphics.setWindowedMode(getPrefs().getInteger("screen-width"), getPrefs().getInteger("screen-height"));
|
||||||
|
}
|
||||||
|
|
||||||
Resolution[] resolution = {
|
Resolution[] resolution = {
|
||||||
new Resolution(800, 480, "800x480"),
|
new Resolution(800, 480, "800x480"),
|
||||||
new Resolution(1280, 720, "1280x720"),
|
new Resolution(1280, 720, "1280x720"),
|
||||||
@ -69,19 +76,21 @@ public class RhythmBullet extends Game {
|
|||||||
new Resolution(3840, 2160, "3840x2160"),
|
new Resolution(3840, 2160, "3840x2160"),
|
||||||
};
|
};
|
||||||
InternalFileHandleResolver internalFileResolver = new InternalFileHandleResolver();
|
InternalFileHandleResolver internalFileResolver = new InternalFileHandleResolver();
|
||||||
|
|
||||||
rRHandler = new RoundingResolutionHandler(internalFileResolver, resolution);
|
rRHandler = new RoundingResolutionHandler(internalFileResolver, resolution);
|
||||||
GenericFileTypeHandler genericFileFinder = new GenericFileTypeHandler(internalFileResolver);
|
GenericFileTypeHandler genericFileFinder = new GenericFileTypeHandler(internalFileResolver);
|
||||||
assetManager.setLoader(TextureAtlas.class, new TextureAtlasLoader(rRHandler));
|
assetManager.setLoader(TextureAtlas.class, new TextureAtlasLoader(rRHandler));
|
||||||
assetManager.setLoader(Texture.class, new TextureLoader(rRHandler));
|
assetManager.setLoader(Texture.class, new TextureLoader(rRHandler));
|
||||||
assetManager.setLoader(ParticleEffect.class, new ParticleEffectLoader(genericFileFinder));
|
assetManager.setLoader(ParticleEffect.class, new ParticleEffectLoader(genericFileFinder));
|
||||||
assetManager.setLoader(Sound.class, new SoundLoader(genericFileFinder));
|
assetManager.setLoader(Sound.class, new SoundLoader(genericFileFinder));
|
||||||
|
|
||||||
resizing = false;
|
|
||||||
|
|
||||||
default_fontGenerator = new FreeTypeFontGenerator(Gdx.files.internal("fonts/Gasalt-Regular.ttf"));
|
default_fontGenerator = new FreeTypeFontGenerator(Gdx.files.internal("fonts/Gasalt-Regular.ttf"));
|
||||||
darktech_ldr_fontGenerator = new FreeTypeFontGenerator(Gdx.files.internal("fonts/darktech_ldr.ttf"));
|
darktech_ldr_fontGenerator = new FreeTypeFontGenerator(Gdx.files.internal("fonts/darktech_ldr.ttf"));
|
||||||
|
|
||||||
|
getrRHandler().setResolution(getPrefs().getInteger("screen-width"), getPrefs().getInteger("screen-height"));
|
||||||
|
|
||||||
|
Gdx.app.debug("Prelaunch Debug Info", "\ncurrent window size: "
|
||||||
|
+ Gdx.graphics.getWidth() + "x" + Gdx.graphics.getHeight() +"\n"
|
||||||
|
+ "Pixel density (PPI): " + Gdx.graphics.getDensity());
|
||||||
|
|
||||||
setScreen(new LoadingScreen(this));
|
setScreen(new LoadingScreen(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package zero1hd.rhythmbullet.screens;
|
package zero1hd.rhythmbullet.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;
|
||||||
@ -13,29 +14,25 @@ import com.badlogic.gdx.utils.viewport.ScreenViewport;
|
|||||||
|
|
||||||
import zero1hd.rhythmbullet.RhythmBullet;
|
import zero1hd.rhythmbullet.RhythmBullet;
|
||||||
|
|
||||||
public class LoadingScreen extends ScreenAdapter {
|
public class LoadingScreen extends ScreenAdapter implements ApplicationListener {
|
||||||
private Stage stage;
|
private Stage stage;
|
||||||
RhythmBullet core;
|
RhythmBullet core;
|
||||||
Image zero1HD;
|
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());
|
|
||||||
|
|
||||||
core.getAssetManager().load("splashlogo.png", Texture.class);
|
core.getAssetManager().load("splashlogo.png", Texture.class);
|
||||||
core.getAssetManager().finishLoading();
|
core.getAssetManager().finishLoading();
|
||||||
|
|
||||||
|
stage = new Stage(new ScreenViewport());
|
||||||
|
|
||||||
zero1HD = new Image(this.core.getAssetManager().get("splashlogo.png", Texture.class));
|
zero1HD = new Image(this.core.getAssetManager().get("splashlogo.png", Texture.class));
|
||||||
|
|
||||||
zero1HD.setColor(0f,1f,1f,0f);
|
zero1HD.setColor(0f,1f,1f,0f);
|
||||||
stage.addActor(zero1HD);
|
stage.addActor(zero1HD);
|
||||||
|
|
||||||
zero1HD.setPosition(stage.getWidth()/2 - zero1HD.getWidth()/2, stage.getHeight()/2 - zero1HD.getHeight()/2);
|
zero1HD.setPosition(stage.getWidth()/2 - zero1HD.getWidth()/2, stage.getHeight()/2 - zero1HD.getHeight()/2);
|
||||||
zero1HD.addAction(Actions.sequence(Actions.color(Color.WHITE, 1f), Actions.fadeOut(0.5f)));
|
zero1HD.addAction(Actions.sequence(Actions.color(Color.WHITE, 1f), Actions.fadeOut(0.5f)));
|
||||||
|
|
||||||
core.getrRHandler().setResolution(core.getPrefs().getInteger("screen-width"), core.getPrefs().getInteger("screen-height"));
|
|
||||||
|
|
||||||
core.queueAssets();
|
core.queueAssets();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,14 +63,6 @@ public class LoadingScreen extends ScreenAdapter {
|
|||||||
core.generateFonts(core.getPrefs().getInteger("screen-height"));
|
core.generateFonts(core.getPrefs().getInteger("screen-height"));
|
||||||
core.defineSkinStyles();
|
core.defineSkinStyles();
|
||||||
|
|
||||||
if (core.getPrefs().getBoolean("fullscreen", true)) {
|
|
||||||
Gdx.graphics.setFullscreenMode(Gdx.graphics.getDisplayMode());
|
|
||||||
} else {
|
|
||||||
Gdx.graphics.setWindowedMode(core.getPrefs().getInteger("screen-width"), core.getPrefs().getInteger("screen-height"));
|
|
||||||
}
|
|
||||||
Gdx.app.debug("Prelaunch Debug Info", "\ncurrent window size: "
|
|
||||||
+ Gdx.graphics.getWidth() + "x" + Gdx.graphics.getHeight() +"\n"
|
|
||||||
+ "Pixel density (PPI): " + Gdx.graphics.getDensity());
|
|
||||||
core.setScreen(new MainMenu(core));
|
core.setScreen(new MainMenu(core));
|
||||||
zero1HD.remove();
|
zero1HD.remove();
|
||||||
core.getAssetManager().unload("splashlogo.png");
|
core.getAssetManager().unload("splashlogo.png");
|
||||||
@ -92,4 +81,13 @@ public class LoadingScreen extends ScreenAdapter {
|
|||||||
core.setInitComplete();
|
core.setInitComplete();
|
||||||
super.hide();
|
super.hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void create() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void render() {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,17 +1,15 @@
|
|||||||
package zero1hd.rhythmbullet.desktop;
|
package zero1hd.rhythmbullet.desktop;
|
||||||
|
|
||||||
import com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application;
|
import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
|
||||||
import com.badlogic.gdx.backends.lwjgl3.Lwjgl3ApplicationConfiguration;
|
import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;
|
||||||
|
|
||||||
import zero1hd.rhythmbullet.RhythmBullet;
|
import zero1hd.rhythmbullet.RhythmBullet;
|
||||||
|
|
||||||
public class DesktopLauncher {
|
public class DesktopLauncher {
|
||||||
public static void main (String[] arg) {
|
public static void main (String[] arg) {
|
||||||
Lwjgl3ApplicationConfiguration config = new Lwjgl3ApplicationConfiguration();
|
LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
|
||||||
config.setTitle("Rhythm Bullet");
|
config.title = "Rhythm Bullet";
|
||||||
config.setResizable(false);
|
config.resizable = false;
|
||||||
config.setWindowSizeLimits(800, 480, 3840, 2160);
|
new LwjglApplication(new RhythmBullet(), config);
|
||||||
config.setWindowedMode(400, 400);
|
|
||||||
new Lwjgl3Application(new RhythmBullet(), config);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user