splash screen more reasonable; resizing now functions as intended;
This commit is contained in:
parent
24dcabfb51
commit
eba5459ab3
BIN
android/assets/splash_texture.png
Executable file
BIN
android/assets/splash_texture.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 35 KiB |
Binary file not shown.
Before Width: | Height: | Size: 31 KiB |
@ -32,7 +32,7 @@ public class RhythmBullet extends Game {
|
|||||||
public static final int SPAWN_CIRCLE_RADIUS = 6;
|
public static final int SPAWN_CIRCLE_RADIUS = 6;
|
||||||
public static int pixels_per_unit;
|
public static int pixels_per_unit;
|
||||||
private boolean initiated;
|
private boolean initiated;
|
||||||
private boolean resizing;
|
private boolean resizing, simpleResizeOnce;
|
||||||
private int screenWidth, screenHeight;
|
private int screenWidth, screenHeight;
|
||||||
public static final String VERSION = "(1.0.0) R1-PreAlpha";
|
public static final String VERSION = "(1.0.0) R1-PreAlpha";
|
||||||
|
|
||||||
@ -53,15 +53,25 @@ public class RhythmBullet extends Game {
|
|||||||
this.initialScreen = initialScreen;
|
this.initialScreen = initialScreen;
|
||||||
this.assetPack = assetPack;
|
this.assetPack = assetPack;
|
||||||
this.screenConfiguration = screenConfiguration;
|
this.screenConfiguration = screenConfiguration;
|
||||||
|
screenConfiguration.queueBorderless(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void create() {
|
public void create() {
|
||||||
Gdx.app.setLogLevel(Application.LOG_DEBUG);
|
|
||||||
initialScreen.init();
|
|
||||||
setScreen(initialScreen);
|
setScreen(initialScreen);
|
||||||
|
Gdx.app.setLogLevel(Application.LOG_DEBUG);
|
||||||
|
screenWidth = Gdx.graphics.getWidth();
|
||||||
|
screenHeight = Gdx.graphics.getHeight();
|
||||||
|
initialScreen.init();
|
||||||
|
initialLoad();
|
||||||
|
}
|
||||||
|
|
||||||
assetPack.initiateResources();
|
private void initialLoad() {
|
||||||
|
if (initiated) throw new IllegalStateException("Initiation cannot occur more than once.");
|
||||||
|
|
||||||
|
simpleResizeOnce = true;
|
||||||
|
skin = new Skin();
|
||||||
|
assetPack.initiate();
|
||||||
|
|
||||||
preferences = Gdx.app.getPreferences("RhythmBullet Preferences");
|
preferences = Gdx.app.getPreferences("RhythmBullet Preferences");
|
||||||
|
|
||||||
@ -84,18 +94,23 @@ public class RhythmBullet extends Game {
|
|||||||
assetManager.setLoader(Sound.class, new SoundLoader(genericFileFinder));
|
assetManager.setLoader(Sound.class, new SoundLoader(genericFileFinder));
|
||||||
|
|
||||||
rRHandler.setResolution(getPreferences().getInteger("screen-width"), getPreferences().getInteger("screen-height"));
|
rRHandler.setResolution(getPreferences().getInteger("screen-width"), getPreferences().getInteger("screen-height"));
|
||||||
|
queueAssets();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initialLoadComplete() {
|
||||||
|
screenConfiguration.queueBorderless(preferences.getBoolean("borderless", false));
|
||||||
|
|
||||||
screenWidth = Gdx.graphics.getWidth();
|
skin.addRegions(assetManager.get("uiskin.atlas", TextureAtlas.class));
|
||||||
screenHeight = Gdx.graphics.getHeight();
|
|
||||||
|
|
||||||
pixels_per_unit = (int) (Float.valueOf(screenHeight)/Float.valueOf(WORLD_HEIGHT));
|
pixels_per_unit = (int) (Float.valueOf(screenHeight)/Float.valueOf(WORLD_HEIGHT));
|
||||||
|
|
||||||
if (getPreferences().getBoolean("fullscreen", true)) {
|
if (getPreferences().getBoolean("fullscreen", true)) {
|
||||||
Gdx.graphics.setFullscreenMode(Gdx.graphics.getDisplayMode());
|
Gdx.graphics.setFullscreenMode(Gdx.graphics.getDisplayMode());
|
||||||
} else {
|
} else {
|
||||||
Gdx.graphics.setWindowedMode(getPreferences().getInteger("screen-width"), getPreferences().getInteger("screen-height"));
|
Gdx.graphics.setWindowedMode(getPreferences().getInteger("screen-width"), getPreferences().getInteger("screen-height"));
|
||||||
}
|
}
|
||||||
|
assetPack.generateFonts(skin);
|
||||||
|
assetPack.setupSkin(skin);
|
||||||
|
assetPack.complete(assetManager);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -110,8 +125,7 @@ public class RhythmBullet extends Game {
|
|||||||
Gdx.app.debug("Resize", "Post resize is starting...");
|
Gdx.app.debug("Resize", "Post resize is starting...");
|
||||||
if (skin != null) skin.dispose();
|
if (skin != null) skin.dispose();
|
||||||
skin = new Skin();
|
skin = new Skin();
|
||||||
skinAtlas = assetManager.get("uiskin.atlas", TextureAtlas.class);
|
skin.addRegions(assetManager.get("uiskin.atlas", TextureAtlas.class));
|
||||||
getSkin().addRegions(skinAtlas);
|
|
||||||
|
|
||||||
assetPack.generateFonts(skin);
|
assetPack.generateFonts(skin);
|
||||||
assetPack.setupSkin(skin);
|
assetPack.setupSkin(skin);
|
||||||
@ -119,15 +133,14 @@ public class RhythmBullet extends Game {
|
|||||||
if (getScreen() instanceof ResizeReadyScreen) {
|
if (getScreen() instanceof ResizeReadyScreen) {
|
||||||
((ResizeReadyScreen) getScreen()).postAssetLoad();
|
((ResizeReadyScreen) getScreen()).postAssetLoad();
|
||||||
} else {
|
} else {
|
||||||
throw new IllegalStateException("Cannot perform window resize on a screen that isn't using a resize ready screen.");
|
throw new IllegalStateException("Cannot perform window resize on a screen that isn't resize ready.");
|
||||||
}
|
}
|
||||||
Gdx.app.debug("Resize", "Post resize has ended.");
|
Gdx.app.debug("Resize", "Post resize has ended.");
|
||||||
|
|
||||||
if (!initiated) {
|
|
||||||
setScreen(((InitialScreen) initialScreen).createMainScreen(this));
|
|
||||||
initiated = true;
|
|
||||||
}
|
|
||||||
resizing = false;
|
resizing = false;
|
||||||
|
} else if (!initiated) {
|
||||||
|
initiated = true;
|
||||||
|
initialLoadComplete();
|
||||||
|
setScreen(((InitialScreen) initialScreen).advance(this));
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -142,6 +155,7 @@ public class RhythmBullet extends Game {
|
|||||||
try {
|
try {
|
||||||
advancedResizeScreen.preAssetLoad();
|
advancedResizeScreen.preAssetLoad();
|
||||||
} catch (NullPointerException cleanScreen) {
|
} catch (NullPointerException cleanScreen) {
|
||||||
|
Gdx.app.debug("Screen", "clean screen: " + advancedResizeScreen.getClass().getSimpleName());
|
||||||
//Tried to perform pre-asset reload, but had uninitialized objects, meaning this is a new screen, or "clean" screen.
|
//Tried to perform pre-asset reload, but had uninitialized objects, meaning this is a new screen, or "clean" screen.
|
||||||
} finally {
|
} finally {
|
||||||
advancedResizeScreen.postAssetLoad();
|
advancedResizeScreen.postAssetLoad();
|
||||||
@ -152,25 +166,30 @@ public class RhythmBullet extends Game {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void resize(int width, int height) {
|
public void resize(int width, int height) {
|
||||||
|
if (screenWidth != width || screenHeight != height) {
|
||||||
Gdx.app.debug("resize", "Current size:" + screenWidth + "x" + screenHeight + " new size: " + width + "x" + height);
|
Gdx.app.debug("resize", "Current size:" + screenWidth + "x" + screenHeight + " new size: " + width + "x" + height);
|
||||||
if (width != screenWidth || height != screenHeight) {
|
screenWidth = width;
|
||||||
screenWidth = Gdx.graphics.getWidth();
|
screenHeight = height;
|
||||||
screenHeight = Gdx.graphics.getHeight();
|
|
||||||
|
|
||||||
pixels_per_unit = (int) (Float.valueOf(screenHeight)/Float.valueOf(WORLD_HEIGHT));
|
pixels_per_unit = (int) (Float.valueOf(screenHeight)/Float.valueOf(WORLD_HEIGHT));
|
||||||
Gdx.app.debug("Resize", "Pre-resize is happening. Resizing to " + width + "x" + height);
|
|
||||||
rRHandler.setResolution(width, height);
|
rRHandler.setResolution(width, height);
|
||||||
|
preferences.putInteger("screen-width", width);
|
||||||
|
preferences.putInteger("screen-height", height);
|
||||||
|
preferences.flush();
|
||||||
|
|
||||||
|
if (!simpleResizeOnce) {
|
||||||
|
Gdx.app.debug("Resize", "complex pre-resize is happening. Resizing to " + width + "x" + height);
|
||||||
if (getScreen() instanceof ResizeReadyScreen) {
|
if (getScreen() instanceof ResizeReadyScreen) {
|
||||||
((ResizeReadyScreen) getScreen()).preAssetLoad();
|
((ResizeReadyScreen) getScreen()).preAssetLoad();
|
||||||
} else {
|
} else {
|
||||||
throw new IllegalStateException("Cannot perform window resize on a screen that isn't using a resize ready screen.");
|
throw new IllegalStateException("Cannot perform window resize on a screen that isn't using a resize ready screen.");
|
||||||
}
|
}
|
||||||
preferences.putInteger("screen-width", width);
|
|
||||||
preferences.putInteger("screen-height", height);
|
|
||||||
preferences.flush();
|
|
||||||
resizing = true;
|
resizing = true;
|
||||||
assetManager.clear();
|
assetManager.clear();
|
||||||
queueAssets();
|
queueAssets();
|
||||||
|
} else {
|
||||||
|
simpleResizeOnce = false;
|
||||||
|
}
|
||||||
super.resize(width, height);
|
super.resize(width, height);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -43,11 +43,11 @@ public class MusicList extends Observable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Wrapper method that uses async refresh.
|
* Asynchronous recursive search on music directory.
|
||||||
* Also notifies listeners that are on the main thread.
|
* Also notifies listeners that are on the main thread.
|
||||||
* @param refresh does a search whether or not path has changed and whether or not this list has searched before this.
|
* @param refresh does a search whether or not path has changed and whether or not this list has searched before this.
|
||||||
*/
|
*/
|
||||||
public void asyncSearch(boolean refresh) {
|
public void attemptAsyncSearch(boolean refresh) {
|
||||||
if (refresh) {
|
if (refresh) {
|
||||||
notifyObservers(states.LOADING);
|
notifyObservers(states.LOADING);
|
||||||
if (searchThread != null) {
|
if (searchThread != null) {
|
||||||
@ -62,7 +62,7 @@ public class MusicList extends Observable {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!searched || hasChanged()) {
|
if (!searched || hasChanged()) {
|
||||||
asyncSearch(true);
|
attemptAsyncSearch(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -147,6 +147,10 @@ public class DoubleHorizontalVisualizer implements Disposable {
|
|||||||
return y;
|
return y;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void updateMusic() {
|
||||||
|
pcm.updateMusic();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
pcm.dispose();
|
pcm.dispose();
|
||||||
|
@ -7,4 +7,6 @@ public interface PCMSystem extends Disposable {
|
|||||||
float[] getFrequencyBins();
|
float[] getFrequencyBins();
|
||||||
|
|
||||||
int getWindowSize();
|
int getWindowSize();
|
||||||
|
|
||||||
|
void updateMusic();
|
||||||
}
|
}
|
@ -9,7 +9,7 @@ public interface AssetPack extends Disposable {
|
|||||||
/**
|
/**
|
||||||
* Called right after the game instance is created and passed to LWJGL. This method is called once for you to instantiate things for later use but require Libgdx functions.
|
* Called right after the game instance is created and passed to LWJGL. This method is called once for you to instantiate things for later use but require Libgdx functions.
|
||||||
*/
|
*/
|
||||||
public void initiateResources();
|
public void initiate();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Game manager calls this when it needs to load textures.
|
* Game manager calls this when it needs to load textures.
|
||||||
|
@ -6,11 +6,12 @@ import zero1hd.rhythmbullet.RhythmBullet;
|
|||||||
|
|
||||||
public interface InitialScreen extends ResizeReadyScreen {
|
public interface InitialScreen extends ResizeReadyScreen {
|
||||||
/**
|
/**
|
||||||
|
* Called when everythings loaded and ready to advance.
|
||||||
* Screen should be created on platform.
|
* Screen should be created on platform.
|
||||||
* @param gameManager the game manager.
|
* @param gameManager the game manager.
|
||||||
* @return the screen that is created.
|
* @return the screen that is created.
|
||||||
*/
|
*/
|
||||||
public Screen createMainScreen(RhythmBullet gameManager);
|
public Screen advance(RhythmBullet gameManager);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Immediately called after the LibGDX instance has been instantiated.
|
* Immediately called after the LibGDX instance has been instantiated.
|
||||||
|
@ -26,5 +26,5 @@ public interface ScreenConfiguration {
|
|||||||
|
|
||||||
public void setWindowLocation(int x, int y);
|
public void setWindowLocation(int x, int y);
|
||||||
|
|
||||||
public void setWindowBorderless(boolean borderless);
|
public void queueBorderless(boolean borderless);
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ public class DesktopAssetPack implements AssetPack {
|
|||||||
private FreeTypeFontGenerator darktech_ldr_fontGenerator;
|
private FreeTypeFontGenerator darktech_ldr_fontGenerator;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initiateResources() {
|
public void initiate() {
|
||||||
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"));
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,8 @@ public class DesktopLauncher {
|
|||||||
config.resizable = false;
|
config.resizable = false;
|
||||||
config.useHDPI = true;
|
config.useHDPI = true;
|
||||||
config.samples = 2;
|
config.samples = 2;
|
||||||
|
config.width = 320;
|
||||||
|
config.height = 320;
|
||||||
config.allowSoftwareMode = true;
|
config.allowSoftwareMode = true;
|
||||||
core = new RhythmBullet();
|
core = new RhythmBullet();
|
||||||
core.setup(new SplashScreen(), new DesktopAssetPack(), screenConfig);
|
core.setup(new SplashScreen(), new DesktopAssetPack(), screenConfig);
|
||||||
|
@ -73,9 +73,7 @@ public class DesktopScreenConfiguration implements ScreenConfiguration {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setWindowBorderless(boolean borderless) {
|
public void queueBorderless(boolean borderless) {
|
||||||
if (borderless) {
|
|
||||||
System.setProperty("org.lwjgl.opengl.Window.undecorated", String.valueOf(borderless));
|
System.setProperty("org.lwjgl.opengl.Window.undecorated", String.valueOf(borderless));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -120,7 +120,8 @@ public class PCMObtainer implements Observer, PCMSystem {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setMusic() {
|
@Override
|
||||||
|
public void updateMusic() {
|
||||||
Gdx.app.debug("PCMObtainer", "music set.");
|
Gdx.app.debug("PCMObtainer", "music set.");
|
||||||
sourceID = -1;
|
sourceID = -1;
|
||||||
|
|
||||||
@ -128,6 +129,8 @@ public class PCMObtainer implements Observer, PCMSystem {
|
|||||||
sampleRate = mc.getCurrentMusicHeader().getSampleRate();
|
sampleRate = mc.getCurrentMusicHeader().getSampleRate();
|
||||||
String millisPerWindowF = df.format(windowSize/(float) sampleRate);
|
String millisPerWindowF = df.format(windowSize/(float) sampleRate);
|
||||||
millisPerWindow = (long) (Float.valueOf(millisPerWindowF)*1000);
|
millisPerWindow = (long) (Float.valueOf(millisPerWindowF)*1000);
|
||||||
|
|
||||||
|
attemptToSync();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -223,8 +226,15 @@ public class PCMObtainer implements Observer, PCMSystem {
|
|||||||
public void update(Observable o, Object arg) {
|
public void update(Observable o, Object arg) {
|
||||||
if (o == mc) {
|
if (o == mc) {
|
||||||
if (arg == mc.states.LOADED) {
|
if (arg == mc.states.LOADED) {
|
||||||
setMusic();
|
updateMusic();
|
||||||
} else if (arg == mc.states.PLAYING) {
|
} else if (arg == mc.states.PLAYING) {
|
||||||
|
attemptToSync();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void attemptToSync() {
|
||||||
|
if (mc.isPlaying()) {
|
||||||
if (sourceID == -1) {
|
if (sourceID == -1) {
|
||||||
try {
|
try {
|
||||||
Field sourceIDField = ClassReflection.getDeclaredField(OpenALMusic.class, "sourceID");
|
Field sourceIDField = ClassReflection.getDeclaredField(OpenALMusic.class, "sourceID");
|
||||||
@ -237,7 +247,6 @@ public class PCMObtainer implements Observer, PCMSystem {
|
|||||||
streamReadThread.start();
|
streamReadThread.start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
|
@ -3,10 +3,8 @@ package zero1hd.rhythmbullet.desktop.screens;
|
|||||||
import com.badlogic.gdx.Gdx;
|
import com.badlogic.gdx.Gdx;
|
||||||
import com.badlogic.gdx.Screen;
|
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.GL20;
|
import com.badlogic.gdx.graphics.GL20;
|
||||||
import com.badlogic.gdx.graphics.Texture;
|
import com.badlogic.gdx.graphics.Texture;
|
||||||
import com.badlogic.gdx.graphics.g2d.Sprite;
|
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
|
||||||
|
|
||||||
import zero1hd.rhythmbullet.RhythmBullet;
|
import zero1hd.rhythmbullet.RhythmBullet;
|
||||||
@ -14,18 +12,13 @@ import zero1hd.rhythmbullet.desktop.screens.main.MainScreen;
|
|||||||
import zero1hd.rhythmbullet.util.InitialScreen;
|
import zero1hd.rhythmbullet.util.InitialScreen;
|
||||||
|
|
||||||
public class SplashScreen extends ScreenAdapter implements InitialScreen {
|
public class SplashScreen extends ScreenAdapter implements InitialScreen {
|
||||||
private Sprite splashSprite;
|
private Texture splashTexture;
|
||||||
private SpriteBatch batch;
|
private SpriteBatch batch;
|
||||||
private Color color = new Color(1f, 1f, 1f, 1f);
|
|
||||||
private float fadeTime = 1.5f;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init() {
|
public void init() {
|
||||||
batch = new SpriteBatch();
|
batch = new SpriteBatch();
|
||||||
splashSprite = new Sprite(new Texture(Gdx.files.internal("splashlogo.png")));
|
splashTexture = new Texture(Gdx.files.internal("splash_texture.png"));
|
||||||
float scale = (Gdx.graphics.getHeight()/3f)/splashSprite.getHeight();
|
|
||||||
splashSprite.setSize(scale*splashSprite.getWidth(), scale*splashSprite.getHeight());
|
|
||||||
splashSprite.setPosition((Gdx.graphics.getWidth()-splashSprite.getWidth())/2f, (Gdx.graphics.getHeight()-splashSprite.getHeight())/2f);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -33,10 +26,7 @@ public class SplashScreen extends ScreenAdapter implements InitialScreen {
|
|||||||
Gdx.gl.glClearColor(1f, 1f, 1f, 1f);
|
Gdx.gl.glClearColor(1f, 1f, 1f, 1f);
|
||||||
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
|
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
|
||||||
batch.begin();
|
batch.begin();
|
||||||
float change = delta/fadeTime;
|
batch.draw(splashTexture, 0, 0);
|
||||||
color.a -= change;
|
|
||||||
splashSprite.setColor(color);
|
|
||||||
splashSprite.draw(batch);
|
|
||||||
batch.end();
|
batch.end();
|
||||||
|
|
||||||
super.render(delta);
|
super.render(delta);
|
||||||
@ -44,7 +34,7 @@ public class SplashScreen extends ScreenAdapter implements InitialScreen {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void hide() {
|
public void hide() {
|
||||||
splashSprite.getTexture().dispose();
|
splashTexture.dispose();
|
||||||
super.hide();
|
super.hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,7 +52,7 @@ public class SplashScreen extends ScreenAdapter implements InitialScreen {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Screen createMainScreen(RhythmBullet game) {
|
public Screen advance(RhythmBullet game) {
|
||||||
return new MainScreen(game);
|
return new MainScreen(game);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -101,6 +101,12 @@ public class MainPage extends Page implements Observer {
|
|||||||
scrollText.setWidth(0.5f*getWidth());
|
scrollText.setWidth(0.5f*getWidth());
|
||||||
scrollText.setPosition(15, getHeight() - scrollText.getHeight()-30f);
|
scrollText.setPosition(15, getHeight() - scrollText.getHeight()-30f);
|
||||||
addActor(scrollText);
|
addActor(scrollText);
|
||||||
|
|
||||||
|
if (mc.getMusicList().isSearched() && amc.isSameSizeMusicList()) {
|
||||||
|
scrollText.setText("Currently playing: " + amc.getAudioMetadata(mc.getCurrentMusicFileHandle()).getTitle(), null);
|
||||||
|
dhv.updateMusic();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -145,7 +151,7 @@ public class MainPage extends Page implements Observer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (o == amc) {
|
} else if (o == amc) {
|
||||||
if (amc.size() != 0) {
|
if (amc.isSameSizeMusicList()) {
|
||||||
scrollText.setText("Currently playing: " + amc.getAudioMetadata(mc.getCurrentMusicFileHandle()).getTitle(), null);
|
scrollText.setText("Currently playing: " + amc.getAudioMetadata(mc.getCurrentMusicFileHandle()).getTitle(), null);
|
||||||
}
|
}
|
||||||
} else if (o == mc.getMusicList()) {
|
} else if (o == mc.getMusicList()) {
|
||||||
|
@ -44,6 +44,7 @@ public class MainScreen extends ScreenAdapter implements ResizeReadyScreen {
|
|||||||
private Texture background;
|
private Texture background;
|
||||||
|
|
||||||
private Batch screenBatch;
|
private Batch screenBatch;
|
||||||
|
private boolean resizing;
|
||||||
|
|
||||||
public MainScreen(RhythmBullet core) {
|
public MainScreen(RhythmBullet core) {
|
||||||
this.rhythmBullet = core;
|
this.rhythmBullet = core;
|
||||||
@ -64,6 +65,8 @@ public class MainScreen extends ScreenAdapter implements ResizeReadyScreen {
|
|||||||
public void render(float delta) {
|
public void render(float delta) {
|
||||||
Gdx.gl.glClearColor(0f, 0f, 0f, 1f);
|
Gdx.gl.glClearColor(0f, 0f, 0f, 1f);
|
||||||
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
|
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
|
||||||
|
|
||||||
|
if (!resizing) {
|
||||||
stage.act(delta);
|
stage.act(delta);
|
||||||
if (bloomShader != null) {
|
if (bloomShader != null) {
|
||||||
bloomShader.begin();
|
bloomShader.begin();
|
||||||
@ -77,6 +80,7 @@ public class MainScreen extends ScreenAdapter implements ResizeReadyScreen {
|
|||||||
stage.getCamera().position.lerp(cameraPosition, 0.15f);
|
stage.getCamera().position.lerp(cameraPosition, 0.15f);
|
||||||
stage.getViewport().apply();
|
stage.getViewport().apply();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
super.render(delta);
|
super.render(delta);
|
||||||
}
|
}
|
||||||
@ -91,6 +95,7 @@ public class MainScreen extends ScreenAdapter implements ResizeReadyScreen {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void preAssetLoad() {
|
public void preAssetLoad() {
|
||||||
|
resizing = true;
|
||||||
stage.clear();
|
stage.clear();
|
||||||
if (bloomShader != null) {
|
if (bloomShader != null) {
|
||||||
bloomShader.dispose();
|
bloomShader.dispose();
|
||||||
@ -103,7 +108,7 @@ public class MainScreen extends ScreenAdapter implements ResizeReadyScreen {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void postAssetLoad() {
|
public void postAssetLoad() {
|
||||||
|
resizing = false;
|
||||||
bloomShader = new BloomShader(screenBatch);
|
bloomShader = new BloomShader(screenBatch);
|
||||||
|
|
||||||
background = rhythmBullet.getAssetManager().get("backgrounds/mainBG.png", Texture.class);
|
background = rhythmBullet.getAssetManager().get("backgrounds/mainBG.png", Texture.class);
|
||||||
@ -130,7 +135,7 @@ public class MainScreen extends ScreenAdapter implements ResizeReadyScreen {
|
|||||||
analysisPage = new AnalysisPage(rhythmBullet.getSkin(), listeners.returnToMainPageListener, listeners.confirmedSongListener);
|
analysisPage = new AnalysisPage(rhythmBullet.getSkin(), listeners.returnToMainPageListener, listeners.confirmedSongListener);
|
||||||
stage.addActor(analysisPage);
|
stage.addActor(analysisPage);
|
||||||
|
|
||||||
musicController.getMusicList().asyncSearch(false);
|
musicController.getMusicList().attemptAsyncSearch(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -124,6 +124,8 @@ public class MusicSelectionPage extends Page implements Observer {
|
|||||||
mc.addObserver(this);
|
mc.addObserver(this);
|
||||||
mc.getMusicList().addObserver(this);
|
mc.getMusicList().addObserver(this);
|
||||||
selectionLoaderThread = new musicSelectionLoaderThread();
|
selectionLoaderThread = new musicSelectionLoaderThread();
|
||||||
|
|
||||||
|
musicInfoTable.setToDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -93,7 +93,7 @@ public class OptionsPage extends Page {
|
|||||||
musicSearchTimer -= delta;
|
musicSearchTimer -= delta;
|
||||||
if (musicSearchTimer <= 0) {
|
if (musicSearchTimer <= 0) {
|
||||||
musicController.getMusicList().setSearchPath(directoryField.getText());
|
musicController.getMusicList().setSearchPath(directoryField.getText());
|
||||||
musicController.getMusicList().asyncSearch(false);
|
musicController.getMusicList().attemptAsyncSearch(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
super.act(delta);
|
super.act(delta);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user