switched to lwjgl3, began changing way screen resize system works, minor bug fix with options screen
This commit is contained in:
		
										
											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 {
 | 
			
		||||
        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"
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -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);
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
 
 | 
			
		||||
@@ -92,7 +92,7 @@ public class Mp3AudioData implements AudioData {
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public long getFrameCount() {
 | 
			
		||||
	public long getSampleCount() {
 | 
			
		||||
		return sampleCount;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -69,7 +69,7 @@ public class WavAudioData implements AudioData {
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public long getFrameCount() {
 | 
			
		||||
	public long getSampleCount() {
 | 
			
		||||
		return decoder.getFrameCount();
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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());
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	/**
 | 
			
		||||
 
 | 
			
		||||
@@ -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();
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -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) {
 | 
			
		||||
 
 | 
			
		||||
@@ -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();
 | 
			
		||||
		
 | 
			
		||||
 
 | 
			
		||||
@@ -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);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -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);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -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();
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -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);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user