switched to lwjgl3, began changing way screen resize system works, minor bug fix with options screen
This commit is contained in:
parent
688c1acf96
commit
1af07188e6
Binary file not shown.
Before Width: | Height: | Size: 5.4 KiB After Width: | Height: | Size: 5.4 KiB |
BIN
android/assets/uiskin_legacyB.png
Executable file
BIN
android/assets/uiskin_legacyB.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 5.4 KiB |
@ -38,7 +38,7 @@ project(":desktop") {
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile project(":core")
|
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-platform:$gdxVersion:natives-desktop"
|
||||||
compile "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-desktop"
|
compile "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-desktop"
|
||||||
}
|
}
|
||||||
|
@ -32,12 +32,13 @@ 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.screens.LoadingScreen;
|
import zero1hd.rhythmbullet.screens.LoadingScreen;
|
||||||
import zero1hd.rhythmbullet.screens.MainMenu;
|
|
||||||
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;
|
||||||
|
|
||||||
public class RhythmBullet extends Game {
|
public class RhythmBullet extends Game {
|
||||||
private boolean initComplete = false;
|
private boolean initComplete = false;
|
||||||
|
private boolean resizing;
|
||||||
|
|
||||||
public static final int GAME_AREA_WIDTH = 64;
|
public static final int GAME_AREA_WIDTH = 64;
|
||||||
public static final int GAME_AREA_HEIGHT = 48;
|
public static final int GAME_AREA_HEIGHT = 48;
|
||||||
@ -56,18 +57,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");
|
||||||
|
|
||||||
setScreen(new MainMenu(this));
|
|
||||||
if (prefs.getBoolean("fullscreen", true)) {
|
if (prefs.getBoolean("fullscreen", true)) {
|
||||||
Gdx.graphics.setFullscreenMode(Gdx.graphics.getDisplayMode());
|
Gdx.graphics.setFullscreenMode(Gdx.graphics.getDisplayMode());
|
||||||
} else {
|
} else {
|
||||||
Gdx.graphics.setWindowedMode(prefs.getInteger("screen-width"), prefs.getInteger("screen-height"));
|
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 = {
|
Resolution[] resolution = {
|
||||||
new Resolution(800, 480, "800x480"),
|
new Resolution(800, 480, "800x480"),
|
||||||
new Resolution(1280, 720, "1280x720"),
|
new Resolution(1280, 720, "1280x720"),
|
||||||
@ -87,20 +82,40 @@ public class RhythmBullet extends Game {
|
|||||||
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"));
|
||||||
|
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
|
@Override
|
||||||
public void render() {
|
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();
|
super.render();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
if (skinAtlas != null) {
|
Gdx.app.debug("Core", "disposing...");
|
||||||
|
if (initComplete) {
|
||||||
skinAtlas.dispose();
|
skinAtlas.dispose();
|
||||||
getDefaultSkin().dispose();
|
getDefaultSkin().dispose();
|
||||||
default_fontGenerator.dispose();
|
default_fontGenerator.dispose();
|
||||||
@ -110,6 +125,47 @@ public class RhythmBullet extends Game {
|
|||||||
super.dispose();
|
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() {
|
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);
|
||||||
@ -138,11 +194,8 @@ public class RhythmBullet extends Game {
|
|||||||
assetManager.load("magic1.png", Texture.class);
|
assetManager.load("magic1.png", Texture.class);
|
||||||
}
|
}
|
||||||
public void generateFonts() {
|
public void generateFonts() {
|
||||||
initComplete = true;
|
|
||||||
defaultSkin = new Skin();
|
defaultSkin = new Skin();
|
||||||
|
|
||||||
Gdx.app.debug("Prelaunch Debug Info", "Generating fonts...");
|
Gdx.app.debug("Prelaunch Debug Info", "Generating fonts...");
|
||||||
|
|
||||||
skinAtlas = assetManager.get("uiskin.atlas", TextureAtlas.class);
|
skinAtlas = assetManager.get("uiskin.atlas", TextureAtlas.class);
|
||||||
getDefaultSkin().addRegions(skinAtlas);
|
getDefaultSkin().addRegions(skinAtlas);
|
||||||
|
|
||||||
@ -151,32 +204,26 @@ public class RhythmBullet extends Game {
|
|||||||
size = 18;
|
size = 18;
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
getDefaultSkin().add("sub-font", default_fontGenerator.generateFont(new FreeTypeFontParameter() {
|
getDefaultSkin().add("sub-font", default_fontGenerator.generateFont(new FreeTypeFontParameter() {
|
||||||
{
|
{
|
||||||
size = fontScale(0.04f);
|
size = fontScale(0.04f);
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
getDefaultSkin().add("default-font", default_fontGenerator.generateFont(new FreeTypeFontParameter() {
|
getDefaultSkin().add("default-font", default_fontGenerator.generateFont(new FreeTypeFontParameter() {
|
||||||
{
|
{
|
||||||
size = fontScale(0.07f);
|
size = fontScale(0.07f);
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
||||||
getDefaultSkin().add("large-font", default_fontGenerator.generateFont(new FreeTypeFontParameter() {
|
getDefaultSkin().add("large-font", default_fontGenerator.generateFont(new FreeTypeFontParameter() {
|
||||||
{
|
{
|
||||||
size = fontScale(0.085f);
|
size = fontScale(0.085f);
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
getDefaultSkin().add("special-font", darktech_ldr_fontGenerator.generateFont(new FreeTypeFontParameter() {
|
getDefaultSkin().add("special-font", darktech_ldr_fontGenerator.generateFont(new FreeTypeFontParameter() {
|
||||||
{
|
{
|
||||||
size = fontScale(0.075f);
|
size = fontScale(0.075f);
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void defineSkinStyles() {
|
public void defineSkinStyles() {
|
||||||
@ -260,34 +307,4 @@ public class RhythmBullet extends Game {
|
|||||||
|
|
||||||
Gdx.app.debug("Prelaunch Debug Info", "UI Skin has been defined.");
|
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -71,7 +71,7 @@ public class AudioAnalyzer {
|
|||||||
public void run() {
|
public void run() {
|
||||||
progress = 0;
|
progress = 0;
|
||||||
int tasksDone = 0;
|
int tasksDone = 0;
|
||||||
long totalTasks = audioData.getFrameCount()/audioData.getReadWindowSize();
|
long totalTasks = audioData.getSampleCount()/audioData.getReadWindowSize();
|
||||||
|
|
||||||
bassThresholdMultiplier = 1.5f;
|
bassThresholdMultiplier = 1.5f;
|
||||||
mThresholdMultiplier = 1.4f;
|
mThresholdMultiplier = 1.4f;
|
||||||
@ -158,6 +158,7 @@ public class AudioAnalyzer {
|
|||||||
shrinkData();
|
shrinkData();
|
||||||
containsData = true;
|
containsData = true;
|
||||||
Gdx.app.debug("Audio Analyzer", "USING SEED: " + PUID);
|
Gdx.app.debug("Audio Analyzer", "USING SEED: " + PUID);
|
||||||
|
progress = 100;
|
||||||
sender.send(MiniEvents.SPECTRAL_FLUX_DONE);
|
sender.send(MiniEvents.SPECTRAL_FLUX_DONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -42,9 +42,10 @@ public interface AudioData extends Disposable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* returns sample count
|
* returns sample count
|
||||||
|
* Can be inaccurate.
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public long getFrameCount();
|
public long getSampleCount();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* returns duration of song in seconds
|
* returns duration of song in seconds
|
||||||
|
@ -92,7 +92,7 @@ public class Mp3AudioData implements AudioData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long getFrameCount() {
|
public long getSampleCount() {
|
||||||
return sampleCount;
|
return sampleCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ public class WavAudioData implements AudioData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long getFrameCount() {
|
public long getSampleCount() {
|
||||||
return decoder.getFrameCount();
|
return decoder.getFrameCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ public class Shard extends Entity {
|
|||||||
maxHp = hp;
|
maxHp = hp;
|
||||||
this.angle = angle;
|
this.angle = angle;
|
||||||
setPosition(x-(getWidth()/2f), y-(getHeight()/2f));
|
setPosition(x-(getWidth()/2f), y-(getHeight()/2f));
|
||||||
|
hitbox.setSize(getWidth(), getHeight());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package zero1hd.rhythmbullet.screens;
|
package zero1hd.rhythmbullet.screens;
|
||||||
|
|
||||||
import com.badlogic.gdx.Gdx;
|
import com.badlogic.gdx.Gdx;
|
||||||
import com.badlogic.gdx.Screen;
|
|
||||||
import com.badlogic.gdx.ScreenAdapter;
|
import com.badlogic.gdx.ScreenAdapter;
|
||||||
import com.badlogic.gdx.graphics.Color;
|
import com.badlogic.gdx.graphics.Color;
|
||||||
import com.badlogic.gdx.graphics.GL20;
|
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 com.badlogic.gdx.utils.viewport.ScreenViewport;
|
||||||
|
|
||||||
import zero1hd.rhythmbullet.RhythmBullet;
|
import zero1hd.rhythmbullet.RhythmBullet;
|
||||||
import zero1hd.rhythmbullet.util.TransitionAdapter;
|
|
||||||
|
|
||||||
public class LoadingScreen extends ScreenAdapter {
|
public class LoadingScreen extends ScreenAdapter {
|
||||||
private Stage stage;
|
private Stage stage;
|
||||||
RhythmBullet core;
|
RhythmBullet core;
|
||||||
Image zero1HD;
|
Image zero1HD;
|
||||||
Screen gotoScreen;
|
|
||||||
boolean reInit;
|
|
||||||
|
|
||||||
public LoadingScreen(RhythmBullet core, Screen gotoScreen, boolean reInit, boolean timer) {
|
public LoadingScreen(RhythmBullet core) {
|
||||||
this.core = core;
|
this.core = core;
|
||||||
this.gotoScreen = gotoScreen;
|
|
||||||
this.reInit = reInit;
|
|
||||||
|
|
||||||
stage = new Stage(new ScreenViewport());
|
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();
|
||||||
|
|
||||||
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);
|
||||||
if (timer) {
|
zero1HD.addAction(Actions.sequence(Actions.color(Color.WHITE, 1f)));
|
||||||
zero1HD.addAction(Actions.sequence(Actions.color(Color.WHITE, 1f)));
|
|
||||||
}
|
|
||||||
core.queueAssets();
|
core.queueAssets();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void show() {
|
||||||
|
super.show();
|
||||||
|
}
|
||||||
|
|
||||||
float count = 0;
|
float count = 0;
|
||||||
@Override
|
@Override
|
||||||
public void render(float delta) {
|
public void render(float delta) {
|
||||||
@ -56,11 +55,8 @@ public class LoadingScreen extends ScreenAdapter {
|
|||||||
core.generateFonts();
|
core.generateFonts();
|
||||||
core.defineSkinStyles();
|
core.defineSkinStyles();
|
||||||
|
|
||||||
if (reInit) {
|
core.setScreen(new MainMenu(core));
|
||||||
((TransitionAdapter) gotoScreen).postTransition();
|
core.setInitComplete();
|
||||||
}
|
|
||||||
|
|
||||||
core.setScreen(gotoScreen);
|
|
||||||
core.getAssetManager().unload("splashlogo.png");
|
core.getAssetManager().unload("splashlogo.png");
|
||||||
core.getAssetManager().get("standard_thrust.p", ParticleEffect.class).flipY();
|
core.getAssetManager().get("standard_thrust.p", ParticleEffect.class).flipY();
|
||||||
}
|
}
|
||||||
@ -73,4 +69,9 @@ public class LoadingScreen extends ScreenAdapter {
|
|||||||
stage.getViewport().update(width, height, true);
|
stage.getViewport().update(width, height, true);
|
||||||
super.resize(width, height);
|
super.resize(width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void hide() {
|
||||||
|
super.hide();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,6 @@ package zero1hd.rhythmbullet.screens;
|
|||||||
|
|
||||||
import com.badlogic.gdx.Gdx;
|
import com.badlogic.gdx.Gdx;
|
||||||
import com.badlogic.gdx.Input.Keys;
|
import com.badlogic.gdx.Input.Keys;
|
||||||
import com.badlogic.gdx.Screen;
|
|
||||||
import com.badlogic.gdx.ScreenAdapter;
|
import com.badlogic.gdx.ScreenAdapter;
|
||||||
import com.badlogic.gdx.graphics.GL20;
|
import com.badlogic.gdx.graphics.GL20;
|
||||||
import com.badlogic.gdx.math.Vector3;
|
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.ui.pages.OptionsPage;
|
||||||
import zero1hd.rhythmbullet.util.TransitionAdapter;
|
import zero1hd.rhythmbullet.util.TransitionAdapter;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public class MainMenu extends ScreenAdapter implements TransitionAdapter {
|
public class MainMenu extends ScreenAdapter implements TransitionAdapter {
|
||||||
public Stage stage;
|
public Stage stage;
|
||||||
private Vector3 targetPosition;
|
private Vector3 targetPosition;
|
||||||
@ -32,15 +29,21 @@ public class MainMenu extends ScreenAdapter implements TransitionAdapter {
|
|||||||
|
|
||||||
private RhythmBullet core;
|
private RhythmBullet core;
|
||||||
|
|
||||||
|
private float lerpAlpha;
|
||||||
public MainMenu(final RhythmBullet core) {
|
public MainMenu(final RhythmBullet core) {
|
||||||
this.core = core;
|
this.core = core;
|
||||||
stage = new Stage(new ScreenViewport());
|
stage = new Stage(new ScreenViewport());
|
||||||
targetPosition = new Vector3(stage.getCamera().position);
|
targetPosition = new Vector3(stage.getCamera().position);
|
||||||
|
|
||||||
|
postTransition();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Screen postTransition() {
|
@Override
|
||||||
|
public void preTransition() {
|
||||||
stage.clear();
|
stage.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void postTransition() {
|
||||||
mainPage = new MainPage(core, targetPosition);
|
mainPage = new MainPage(core, targetPosition);
|
||||||
mainPage.setPosition(0, 0);
|
mainPage.setPosition(0, 0);
|
||||||
stage.addActor(mainPage);
|
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.");
|
Gdx.app.debug("Post Transition", "Beginning screen setup for Main menu.");
|
||||||
return this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void show() {
|
public void show() {
|
||||||
Gdx.input.setInputProcessor(stage);
|
Gdx.input.setInputProcessor(stage);
|
||||||
|
calcLerpAlpha(Gdx.graphics.getWidth());
|
||||||
super.show();
|
super.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -117,7 +120,8 @@ public class MainMenu extends ScreenAdapter implements TransitionAdapter {
|
|||||||
|
|
||||||
stage.draw();
|
stage.draw();
|
||||||
if (stage.getCamera().position.x != targetPosition.x || stage.getCamera().position.y != targetPosition.y) {
|
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);
|
super.render(delta);
|
||||||
@ -128,6 +132,7 @@ public class MainMenu extends ScreenAdapter implements TransitionAdapter {
|
|||||||
stage.getViewport().update(width, height, false);
|
stage.getViewport().update(width, height, false);
|
||||||
targetPosition.x = width/2;
|
targetPosition.x = width/2;
|
||||||
targetPosition.y = height/2;
|
targetPosition.y = height/2;
|
||||||
|
calcLerpAlpha(width);
|
||||||
super.resize(width, height);
|
super.resize(width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -136,4 +141,12 @@ public class MainMenu extends ScreenAdapter implements TransitionAdapter {
|
|||||||
stage.dispose();
|
stage.dispose();
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void calcLerpAlpha(int width) {
|
||||||
|
if (width >= 3835) {
|
||||||
|
lerpAlpha = 0.005f;
|
||||||
|
} else {
|
||||||
|
lerpAlpha = 0.25f;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -68,18 +68,21 @@ public class PreGameScreen extends ScreenAdapter implements TransitionAdapter, M
|
|||||||
if (cameraPos.x == 1.5f*Gdx.graphics.getWidth()) {
|
if (cameraPos.x == 1.5f*Gdx.graphics.getWidth()) {
|
||||||
cameraPos.x = 0.5f*Gdx.graphics.getWidth();
|
cameraPos.x = 0.5f*Gdx.graphics.getWidth();
|
||||||
} else {
|
} else {
|
||||||
core.setScreen(new MainMenu(core).postTransition());
|
core.setScreen(new MainMenu(core));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Screen postTransition() {
|
public void preTransition() {
|
||||||
stage.clear();
|
stage.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void postTransition() {
|
||||||
ms = new MusicSelectionPage(core);
|
ms = new MusicSelectionPage(core);
|
||||||
ms.miniSender.addListener(this);
|
ms.miniSender.addListener(this);
|
||||||
ms.beginMusicSearch();
|
ms.beginMusicSearch();
|
||||||
@ -89,7 +92,6 @@ public class PreGameScreen extends ScreenAdapter implements TransitionAdapter, M
|
|||||||
ap.miniSender.addListener(this);
|
ap.miniSender.addListener(this);
|
||||||
ap.setPosition(Gdx.graphics.getWidth(), ap.getY());
|
ap.setPosition(Gdx.graphics.getWidth(), ap.getY());
|
||||||
stage.addActor(ap);
|
stage.addActor(ap);
|
||||||
return this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPhase(int phase) {
|
public void setPhase(int phase) {
|
||||||
|
@ -55,7 +55,7 @@ public class GraphicsTable extends Table {
|
|||||||
add(fancySpriteShader).minHeight(shaders.getHeight());
|
add(fancySpriteShader).minHeight(shaders.getHeight());
|
||||||
row();
|
row();
|
||||||
|
|
||||||
resolutions = new Label("Optimized Resolutions", skin);
|
resolutions = new Label("Resolutions: ", skin);
|
||||||
add(resolutions).left();
|
add(resolutions).left();
|
||||||
row();
|
row();
|
||||||
|
|
||||||
|
@ -127,7 +127,7 @@ public class MusicSelectionPage extends Page {
|
|||||||
loadingWindow.setProgress(prog);
|
loadingWindow.setProgress(prog);
|
||||||
}
|
}
|
||||||
} else {
|
} 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.setSize(0.6f*getWidth(), 0.6f*getHeight());
|
||||||
notice.setPosition((getWidth()-notice.getWidth())/2f, (getHeight()-notice.getHeight())/2f);
|
notice.setPosition((getWidth()-notice.getWidth())/2f, (getHeight()-notice.getHeight())/2f);
|
||||||
notice.setModal(true);
|
notice.setModal(true);
|
||||||
@ -151,4 +151,9 @@ public class MusicSelectionPage extends Page {
|
|||||||
public AudioInfo getSelectedMusicInfo() {
|
public AudioInfo getSelectedMusicInfo() {
|
||||||
return selectedMusicInfo;
|
return selectedMusicInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public synchronized void addActor(Actor actor) {
|
||||||
|
super.addActor(actor);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,11 +25,8 @@ public class OptionsPage extends Page {
|
|||||||
private ProgressBar musicVolSlider;
|
private ProgressBar musicVolSlider;
|
||||||
private ProgressBar fxVolSlider;
|
private ProgressBar fxVolSlider;
|
||||||
private TextField directoryField;
|
private TextField directoryField;
|
||||||
private RhythmBullet core;
|
|
||||||
|
|
||||||
private byte goToScreen;
|
|
||||||
public OptionsPage(final RhythmBullet core, final Vector3 targetPosition, final MoreOptionsPage moreOptionsPage) {
|
public OptionsPage(final RhythmBullet core, final Vector3 targetPosition, final MoreOptionsPage moreOptionsPage) {
|
||||||
this.core = core;
|
|
||||||
optionsTable.defaults().spaceLeft(40f).padTop(5f).padBottom(5f).left();
|
optionsTable.defaults().spaceLeft(40f).padTop(5f).padBottom(5f).left();
|
||||||
|
|
||||||
Label optionGeneralTitle = new Label("General", core.getDefaultSkin(), "large-font", core.getDefaultSkin().getColor("default"));
|
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());
|
Label debugCodeLabel = new Label("Debug Code: ", core.getDefaultSkin());
|
||||||
optionsTable.add(debugCodeLabel).left();
|
optionsTable.add(debugCodeLabel).left();
|
||||||
final TextField debugCodeField = new TextField(null, core.getDefaultSkin());
|
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.add(debugCodeField).prefWidth(810).left();
|
||||||
|
|
||||||
optionsTable.top();
|
optionsTable.top();
|
||||||
@ -137,7 +121,19 @@ public class OptionsPage extends Page {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
optionsTable.add(graphicsSettings).colspan(2).fill();
|
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) {
|
public void saveOptions(Preferences prefs) {
|
||||||
@ -146,17 +142,4 @@ public class OptionsPage extends Page {
|
|||||||
prefs.putFloat("fx vol", fxVolSlider.getValue());
|
prefs.putFloat("fx vol", fxVolSlider.getValue());
|
||||||
prefs.putString("music dir", directoryField.getText());
|
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,13 @@
|
|||||||
package zero1hd.rhythmbullet.util;
|
package zero1hd.rhythmbullet.util;
|
||||||
|
|
||||||
import com.badlogic.gdx.Screen;
|
|
||||||
|
|
||||||
public interface TransitionAdapter {
|
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();
|
||||||
}
|
}
|
||||||
|
@ -1,23 +1,17 @@
|
|||||||
package zero1hd.rhythmbullet.desktop;
|
package zero1hd.rhythmbullet.desktop;
|
||||||
|
|
||||||
import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
|
import com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application;
|
||||||
import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;
|
import com.badlogic.gdx.backends.lwjgl3.Lwjgl3ApplicationConfiguration;
|
||||||
|
|
||||||
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) {
|
||||||
LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
|
Lwjgl3ApplicationConfiguration config = new Lwjgl3ApplicationConfiguration();
|
||||||
config.title = "Rhythm Bullet";
|
config.setTitle("Rhythm Bullet");
|
||||||
config.width = 800;
|
config.setResizable(false);
|
||||||
config.height = 480;
|
config.setWindowSizeLimits(800, 480, 3840, 2160);
|
||||||
|
|
||||||
config.resizable = false;
|
new Lwjgl3Application(new RhythmBullet(), config);
|
||||||
config.useHDPI = true;
|
|
||||||
// System.setProperty("org.lwjgl.opengl.Window.undecorated", "true");
|
|
||||||
|
|
||||||
|
|
||||||
new LwjglApplication(new RhythmBullet(), config);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user