fixed issue with not displaying song info after resize
This commit is contained in:
		@@ -1,5 +1,8 @@
 | 
				
			|||||||
package zero1hd.rhythmbullet.desktop;
 | 
					package zero1hd.rhythmbullet.desktop;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.util.logging.Level;
 | 
				
			||||||
 | 
					import java.util.logging.Logger;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
 | 
					import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
 | 
				
			||||||
import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;
 | 
					import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -8,6 +11,8 @@ import zero1hd.rhythmbullet.desktop.screens.LoadingScreen;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
public class DesktopLauncher {
 | 
					public class DesktopLauncher {
 | 
				
			||||||
	public static void main (String[] arg) {
 | 
						public static void main (String[] arg) {
 | 
				
			||||||
 | 
							Logger.getLogger("org.jaudiotagger").setLevel(Level.OFF);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		RhythmBullet core;
 | 
							RhythmBullet core;
 | 
				
			||||||
		LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
 | 
							LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
 | 
				
			||||||
		config.title = "Rhythm Bullet";
 | 
							config.title = "Rhythm Bullet";
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -5,8 +5,6 @@ import java.util.concurrent.ExecutorService;
 | 
				
			|||||||
import java.util.concurrent.Executors;
 | 
					import java.util.concurrent.Executors;
 | 
				
			||||||
import java.util.concurrent.TimeUnit;
 | 
					import java.util.concurrent.TimeUnit;
 | 
				
			||||||
import java.util.concurrent.locks.ReentrantLock;
 | 
					import java.util.concurrent.locks.ReentrantLock;
 | 
				
			||||||
import java.util.logging.Level;
 | 
					 | 
				
			||||||
import java.util.logging.Logger;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
import org.jaudiotagger.audio.exceptions.InvalidAudioFrameException;
 | 
					import org.jaudiotagger.audio.exceptions.InvalidAudioFrameException;
 | 
				
			||||||
import org.jaudiotagger.audio.exceptions.ReadOnlyFileException;
 | 
					import org.jaudiotagger.audio.exceptions.ReadOnlyFileException;
 | 
				
			||||||
@@ -60,7 +58,6 @@ public class Mp3Manager implements MusicManager {
 | 
				
			|||||||
		exec = Executors.newSingleThreadExecutor();
 | 
							exec = Executors.newSingleThreadExecutor();
 | 
				
			||||||
		exec.submit(() -> {
 | 
							exec.submit(() -> {
 | 
				
			||||||
			lock.lock();
 | 
								lock.lock();
 | 
				
			||||||
			Logger.getLogger("org.jaudiotagger").setLevel(Level.OFF);
 | 
					 | 
				
			||||||
			try {
 | 
								try {
 | 
				
			||||||
				MP3File mp3File = new MP3File(audioFile.file());
 | 
									MP3File mp3File = new MP3File(audioFile.file());
 | 
				
			||||||
				sampleRate = mp3File.getMP3AudioHeader().getSampleRateAsNumber();
 | 
									sampleRate = mp3File.getMP3AudioHeader().getSampleRateAsNumber();
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,5 @@
 | 
				
			|||||||
package zero1hd.rhythmbullet.desktop.graphics.ui.components;
 | 
					package zero1hd.rhythmbullet.desktop.graphics.ui.components;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.badlogic.gdx.Gdx;
 | 
					 | 
				
			||||||
import com.badlogic.gdx.files.FileHandle;
 | 
					import com.badlogic.gdx.files.FileHandle;
 | 
				
			||||||
import com.badlogic.gdx.graphics.g2d.Batch;
 | 
					import com.badlogic.gdx.graphics.g2d.Batch;
 | 
				
			||||||
import com.badlogic.gdx.scenes.scene2d.InputEvent;
 | 
					import com.badlogic.gdx.scenes.scene2d.InputEvent;
 | 
				
			||||||
@@ -54,7 +53,6 @@ public class MusicSelectable extends WidgetGroup implements Disposable {
 | 
				
			|||||||
	 * @param musicInfo the music information for this song.
 | 
						 * @param musicInfo the music information for this song.
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	public void updateInfo(MusicInfo musicInfo) {
 | 
						public void updateInfo(MusicInfo musicInfo) {
 | 
				
			||||||
		Gdx.app.debug("MusicSelectable", "Updating info for: " + getName());
 | 
					 | 
				
			||||||
		this.musicInfo = musicInfo;
 | 
							this.musicInfo = musicInfo;
 | 
				
			||||||
		displayName.setOriginalText(musicInfo.getMusicName());
 | 
							displayName.setOriginalText(musicInfo.getMusicName());
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -93,12 +93,6 @@ public class MainPage extends Page implements Observer {
 | 
				
			|||||||
		scrollText.setWidth(0.5f*getWidth());
 | 
							scrollText.setWidth(0.5f*getWidth());
 | 
				
			||||||
		scrollText.setPosition(15, getHeight() - scrollText.getHeight()-25f);
 | 
							scrollText.setPosition(15, getHeight() - scrollText.getHeight()-25f);
 | 
				
			||||||
		addActor(scrollText);
 | 
							addActor(scrollText);
 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		if (mlc.getMusicList().isSearched() && mlc.getCurrentMusicManager() != null) {
 | 
					 | 
				
			||||||
			MusicManager mManager = mlc.getCurrentMusicManager();
 | 
					 | 
				
			||||||
			updateVisualsForDifferentSong(mManager);
 | 
					 | 
				
			||||||
			mMenu.getMusicSelectionPage().refreshUIList();
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	@Override
 | 
						@Override
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -65,12 +65,12 @@ public class MusicSelectionPage extends Page implements Observer {
 | 
				
			|||||||
	private int uiSongInfoCount;
 | 
						private int uiSongInfoCount;
 | 
				
			||||||
	private float scrollTimer, scrollDelay = 0.2f, scrollDelMod, songSelectionTimer;
 | 
						private float scrollTimer, scrollDelay = 0.2f, scrollDelMod, songSelectionTimer;
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	public MusicSelectionPage(Skin skin, MusicListController musicListController, AssetManager assetManager, final Vector3 cameraTarget, final AnalysisPage ap) {
 | 
						public MusicSelectionPage(Skin skin, MusicListController musicListController, MusicInfoController musicInfoController, AssetManager assetManager, final Vector3 cameraTarget, final AnalysisPage ap) {
 | 
				
			||||||
		setTextureBackground(assetManager.get("gradients.atlas", TextureAtlas.class).findRegion("red-round"));
 | 
							setTextureBackground(assetManager.get("gradients.atlas", TextureAtlas.class).findRegion("red-round"));
 | 
				
			||||||
		this.assets = assetManager;
 | 
							this.assets = assetManager;
 | 
				
			||||||
		this.skin = skin;
 | 
							this.skin = skin;
 | 
				
			||||||
		this.mc = musicListController;
 | 
							this.mc = musicListController;
 | 
				
			||||||
		mic = new MusicInfoController(mc.getMusicList());
 | 
							this.mic = musicInfoController;
 | 
				
			||||||
		musicFileAnnotation = Gdx.app.getPreferences("music_file_annotation");
 | 
							musicFileAnnotation = Gdx.app.getPreferences("music_file_annotation");
 | 
				
			||||||
		musicTable = new Table();
 | 
							musicTable = new Table();
 | 
				
			||||||
		musicTableScrollPane = new ScrollPane(musicTable, skin);
 | 
							musicTableScrollPane = new ScrollPane(musicTable, skin);
 | 
				
			||||||
@@ -132,6 +132,7 @@ public class MusicSelectionPage extends Page implements Observer {
 | 
				
			|||||||
		previousTop = new Label(null, skin, "sub-font", skin.getColor("default"));
 | 
							previousTop = new Label(null, skin, "sub-font", skin.getColor("default"));
 | 
				
			||||||
		ratedDifficulty = new Label(null, skin, "sub-font", skin.getColor("default"));
 | 
							ratedDifficulty = new Label(null, skin, "sub-font", skin.getColor("default"));
 | 
				
			||||||
		albumCover = new Image(assetManager.get("defaultCover.png", Texture.class));
 | 
							albumCover = new Image(assetManager.get("defaultCover.png", Texture.class));
 | 
				
			||||||
 | 
							
 | 
				
			||||||
		beginButton = new TextButton("Begin", skin);
 | 
							beginButton = new TextButton("Begin", skin);
 | 
				
			||||||
		beginButton.addListener(new ChangeListener() {
 | 
							beginButton.addListener(new ChangeListener() {
 | 
				
			||||||
			@Override
 | 
								@Override
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -19,6 +19,7 @@ import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
 | 
				
			|||||||
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.desktop.audio.MusicInfoController;
 | 
				
			||||||
import zero1hd.rhythmbullet.desktop.audio.MusicList;
 | 
					import zero1hd.rhythmbullet.desktop.audio.MusicList;
 | 
				
			||||||
import zero1hd.rhythmbullet.desktop.audio.MusicListController;
 | 
					import zero1hd.rhythmbullet.desktop.audio.MusicListController;
 | 
				
			||||||
import zero1hd.rhythmbullet.desktop.graphics.ui.pages.AnalysisPage;
 | 
					import zero1hd.rhythmbullet.desktop.graphics.ui.pages.AnalysisPage;
 | 
				
			||||||
@@ -29,6 +30,7 @@ import zero1hd.rhythmbullet.desktop.graphics.ui.pages.MusicSelectionPage;
 | 
				
			|||||||
import zero1hd.rhythmbullet.desktop.graphics.ui.pages.OptionsPage;
 | 
					import zero1hd.rhythmbullet.desktop.graphics.ui.pages.OptionsPage;
 | 
				
			||||||
import zero1hd.rhythmbullet.desktop.graphics.ui.pages.VideoOptionsPage;
 | 
					import zero1hd.rhythmbullet.desktop.graphics.ui.pages.VideoOptionsPage;
 | 
				
			||||||
import zero1hd.rhythmbullet.util.AdvancedResizeScreen;
 | 
					import zero1hd.rhythmbullet.util.AdvancedResizeScreen;
 | 
				
			||||||
 | 
					import zero1hd.rhythmbullet.util.MusicManager;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class MainMenu extends ScreenAdapter implements AdvancedResizeScreen {
 | 
					public class MainMenu extends ScreenAdapter implements AdvancedResizeScreen {
 | 
				
			||||||
	public Stage stage;
 | 
						public Stage stage;
 | 
				
			||||||
@@ -44,6 +46,7 @@ public class MainMenu extends ScreenAdapter implements AdvancedResizeScreen {
 | 
				
			|||||||
	private RhythmBullet core;
 | 
						private RhythmBullet core;
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	private MusicListController mlc;
 | 
						private MusicListController mlc;
 | 
				
			||||||
 | 
						private MusicInfoController mic;
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	private float lerpAlpha;
 | 
						private float lerpAlpha;
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
@@ -70,12 +73,13 @@ public class MainMenu extends ScreenAdapter implements AdvancedResizeScreen {
 | 
				
			|||||||
		mlc = new MusicListController(musicList, core.getPrefs());
 | 
							mlc = new MusicListController(musicList, core.getPrefs());
 | 
				
			||||||
		mlc.setAutoPlay(true);
 | 
							mlc.setAutoPlay(true);
 | 
				
			||||||
		mlc.setShuffle(true);
 | 
							mlc.setShuffle(true);
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							mic = new MusicInfoController(musicList);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	@Override
 | 
						@Override
 | 
				
			||||||
	public void postAssetLoad() {
 | 
						public void postAssetLoad() {
 | 
				
			||||||
		attemptLoadShaders();
 | 
							attemptLoadShaders();
 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		mainPage = new MainPage(core, cameraPosition, mlc, this);
 | 
							mainPage = new MainPage(core, cameraPosition, mlc, this);
 | 
				
			||||||
		mainPage.setPosition(0, 0);
 | 
							mainPage.setPosition(0, 0);
 | 
				
			||||||
		stage.addActor(mainPage);
 | 
							stage.addActor(mainPage);
 | 
				
			||||||
@@ -102,7 +106,7 @@ public class MainMenu extends ScreenAdapter implements AdvancedResizeScreen {
 | 
				
			|||||||
		analysisPage.setPosition(2*Gdx.graphics.getWidth(), 0f);
 | 
							analysisPage.setPosition(2*Gdx.graphics.getWidth(), 0f);
 | 
				
			||||||
		stage.addActor(analysisPage);
 | 
							stage.addActor(analysisPage);
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		musicSelectionPage = new MusicSelectionPage(core.getDefaultSkin(), mlc, core.getAssetManager(), cameraPosition, analysisPage);
 | 
							musicSelectionPage = new MusicSelectionPage(core.getDefaultSkin(), mlc, mic, core.getAssetManager(), cameraPosition, analysisPage);
 | 
				
			||||||
		musicSelectionPage.setPosition(1f*Gdx.graphics.getWidth(), 0f);
 | 
							musicSelectionPage.setPosition(1f*Gdx.graphics.getWidth(), 0f);
 | 
				
			||||||
		stage.addActor(musicSelectionPage);
 | 
							stage.addActor(musicSelectionPage);
 | 
				
			||||||
		stage.addListener(new InputListener() {
 | 
							stage.addListener(new InputListener() {
 | 
				
			||||||
@@ -136,6 +140,11 @@ public class MainMenu extends ScreenAdapter implements AdvancedResizeScreen {
 | 
				
			|||||||
		mlc.addObserver(mainPage);
 | 
							mlc.addObserver(mainPage);
 | 
				
			||||||
		mlc.getMusicList().addObserver(mainPage);
 | 
							mlc.getMusicList().addObserver(mainPage);
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
 | 
							if (mlc.getMusicList().isSearched() && mlc.getCurrentMusicManager() != null) {
 | 
				
			||||||
 | 
								MusicManager mManager = mlc.getCurrentMusicManager();
 | 
				
			||||||
 | 
								mainPage.updateVisualsForDifferentSong(mManager);
 | 
				
			||||||
 | 
								musicSelectionPage.refreshUIList();
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	@Override
 | 
						@Override
 | 
				
			||||||
@@ -217,6 +226,7 @@ public class MainMenu extends ScreenAdapter implements AdvancedResizeScreen {
 | 
				
			|||||||
		optionsPage.dispose();
 | 
							optionsPage.dispose();
 | 
				
			||||||
		creditsPage.dispose();
 | 
							creditsPage.dispose();
 | 
				
			||||||
		keybindPage.dispose();
 | 
							keybindPage.dispose();
 | 
				
			||||||
 | 
							musicSelectionPage.dispose();
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	@Override
 | 
						@Override
 | 
				
			||||||
@@ -252,6 +262,7 @@ public class MainMenu extends ScreenAdapter implements AdvancedResizeScreen {
 | 
				
			|||||||
	public void dispose() {
 | 
						public void dispose() {
 | 
				
			||||||
		stage.dispose();
 | 
							stage.dispose();
 | 
				
			||||||
		unloadShaders();
 | 
							unloadShaders();
 | 
				
			||||||
 | 
							mic.dispose();
 | 
				
			||||||
		super.dispose();
 | 
							super.dispose();
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
@@ -293,10 +304,6 @@ public class MainMenu extends ScreenAdapter implements AdvancedResizeScreen {
 | 
				
			|||||||
		return cameraPosition;
 | 
							return cameraPosition;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	public MainPage getMainPage() {
 | 
					 | 
				
			||||||
		return mainPage;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	public CreditsPage getCreditsPage() {
 | 
						public CreditsPage getCreditsPage() {
 | 
				
			||||||
		return creditsPage;
 | 
							return creditsPage;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user