From bb40cd230dea74fd63958d1a9439151fdf453e25 Mon Sep 17 00:00:00 2001 From: Recrown Date: Wed, 24 May 2017 00:03:29 -0500 Subject: [PATCH] cleaning and minor progress on recreation of pre game screen --- core/src/zero1hd/polyjet/Polyjet.java | 10 +++++++--- core/src/zero1hd/polyjet/screens/MainMenu.java | 2 +- core/src/zero1hd/polyjet/screens/PreGameScreen.java | 4 +++- core/src/zero1hd/polyjet/ui/pages/MainPage.java | 3 +-- core/src/zero1hd/polyjet/ui/pages/MoreOptionsPage.java | 2 +- .../zero1hd/polyjet/ui/pages/MusicSelectionPage.java | 6 +++--- core/src/zero1hd/polyjet/ui/pages/OptionsPage.java | 6 +++--- core/src/zero1hd/polyjet/ui/stages/CreativeStage.java | 5 ++--- .../zero1hd/polyjet/ui/windows/MusicController.java | 7 ------- 9 files changed, 21 insertions(+), 24 deletions(-) diff --git a/core/src/zero1hd/polyjet/Polyjet.java b/core/src/zero1hd/polyjet/Polyjet.java index 95124a7..6161248 100755 --- a/core/src/zero1hd/polyjet/Polyjet.java +++ b/core/src/zero1hd/polyjet/Polyjet.java @@ -43,10 +43,10 @@ public class Polyjet extends Game { private AssetManager assetManager = new AssetManager(); private Skin defaultSkin = new Skin(); - public FreeTypeFontGenerator default_fontGenerator; - public FreeTypeFontGenerator darktech_ldr_fontGenerator; + private FreeTypeFontGenerator default_fontGenerator; + private FreeTypeFontGenerator darktech_ldr_fontGenerator; TextureAtlas skinAtlas; - public Preferences prefs; + private Preferences prefs; @Override public void create() { @@ -253,4 +253,8 @@ public class Polyjet extends Game { public Skin getDefaultSkin() { return defaultSkin; } + + public Preferences getPrefs() { + return prefs; + } } diff --git a/core/src/zero1hd/polyjet/screens/MainMenu.java b/core/src/zero1hd/polyjet/screens/MainMenu.java index 83048f8..56c8d44 100755 --- a/core/src/zero1hd/polyjet/screens/MainMenu.java +++ b/core/src/zero1hd/polyjet/screens/MainMenu.java @@ -95,7 +95,7 @@ public class MainMenu extends ScreenAdapter implements TransitionAdapter { @Override public void hide() { if (optionsPage != null) { - optionsPage.saveOptions(core.prefs); + optionsPage.saveOptions(core.getPrefs()); } super.hide(); } diff --git a/core/src/zero1hd/polyjet/screens/PreGameScreen.java b/core/src/zero1hd/polyjet/screens/PreGameScreen.java index d6e6cd2..40db4ef 100755 --- a/core/src/zero1hd/polyjet/screens/PreGameScreen.java +++ b/core/src/zero1hd/polyjet/screens/PreGameScreen.java @@ -2,8 +2,10 @@ package zero1hd.polyjet.screens; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.ScreenAdapter; +import com.badlogic.gdx.assets.AssetManager; import com.badlogic.gdx.math.Vector3; import com.badlogic.gdx.scenes.scene2d.Stage; +import com.badlogic.gdx.scenes.scene2d.ui.Skin; import zero1hd.polyjet.util.MiniEvents; import zero1hd.polyjet.util.MiniListener; @@ -15,7 +17,7 @@ public class PreGameScreen extends ScreenAdapter implements TransitionAdapter, M Vector3 cameraPos; - public PreGameScreen() { + public PreGameScreen(Skin skin, AssetManager assets) { stage = new Stage(); cameraPos = new Vector3(); } diff --git a/core/src/zero1hd/polyjet/ui/pages/MainPage.java b/core/src/zero1hd/polyjet/ui/pages/MainPage.java index ce56b4a..bd214c2 100755 --- a/core/src/zero1hd/polyjet/ui/pages/MainPage.java +++ b/core/src/zero1hd/polyjet/ui/pages/MainPage.java @@ -14,7 +14,6 @@ import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener; import com.badlogic.gdx.scenes.scene2d.utils.ClickListener; import zero1hd.polyjet.Polyjet; -import zero1hd.polyjet.screens.MainMenu; import zero1hd.polyjet.screens.PreGameScreen; public class MainPage extends Page { @@ -100,7 +99,7 @@ public class MainPage extends Page { Actions.run(new Runnable() { @Override public void run() { - core.setScreen(new PreGameScreen(core, (MainMenu) core.getScreen())); + core.setScreen(new PreGameScreen(core.getDefaultSkin(), core.getAssetManager())); } }), Actions.parallel(Actions.scaleTo(1, 1), Actions.alpha(0.6f)))); } diff --git a/core/src/zero1hd/polyjet/ui/pages/MoreOptionsPage.java b/core/src/zero1hd/polyjet/ui/pages/MoreOptionsPage.java index a9929d1..2e6312d 100755 --- a/core/src/zero1hd/polyjet/ui/pages/MoreOptionsPage.java +++ b/core/src/zero1hd/polyjet/ui/pages/MoreOptionsPage.java @@ -42,7 +42,7 @@ public class MoreOptionsPage extends Page { addActor(controlsScroller); controlsScroller.setVisible(false); - graphicsSettings = new GraphicsTable(core.getDefaultSkin(), core.prefs); + graphicsSettings = new GraphicsTable(core.getDefaultSkin(), core.getPrefs()); graphicsScroller = new ScrollPane(graphicsSettings, core.getDefaultSkin()); graphicsScroller.setFadeScrollBars(false); graphicsScroller.setSize(getWidth()-backArrow.getWidth()-backArrow.getX()-10, getHeight()); diff --git a/core/src/zero1hd/polyjet/ui/pages/MusicSelectionPage.java b/core/src/zero1hd/polyjet/ui/pages/MusicSelectionPage.java index 6a5c203..6e8bc00 100755 --- a/core/src/zero1hd/polyjet/ui/pages/MusicSelectionPage.java +++ b/core/src/zero1hd/polyjet/ui/pages/MusicSelectionPage.java @@ -53,7 +53,7 @@ public class MusicSelectionPage extends Page { }); addActor(back); - loadingWindow = new LoadingWindow(core.getDefaultSkin(), "tinted", true, core.getAssetManager(), core.prefs.getFloat("fx vol")); + loadingWindow = new LoadingWindow(core.getDefaultSkin(), "tinted", true, core.getAssetManager(), core.getPrefs().getFloat("fx vol")); loadingWindow.setPosition((getWidth()-loadingWindow.getWidth())/2f, (getHeight()-loadingWindow.getHeight())/2f); addActor(loadingWindow); @@ -87,7 +87,7 @@ public class MusicSelectionPage extends Page { public void run() { Logger.getLogger("org.jaudiotagger").setLevel(Level.SEVERE); - FileHandle[] musicFiles = new FileHandle(core.prefs.getString("music dir")).list(new FilenameFilter() { + FileHandle[] musicFiles = new FileHandle(core.getPrefs().getString("music dir")).list(new FilenameFilter() { @Override public boolean accept(File dir, String name) { if (name.endsWith("mp3") || name.endsWith("wav")) { @@ -131,7 +131,7 @@ public class MusicSelectionPage extends Page { loadingWindow.remove(); } else { - NoticeWindow notice = new NoticeWindow(core.getDefaultSkin(), "default", "No song's found in:\n\"" + core.prefs.getString("music dir") + "\"\nTo change the search directory, go to game options."); + 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."); notice.setSize(0.6f*getWidth(), 0.6f*getHeight()); notice.setPosition((getWidth()-notice.getWidth())/2f, (getHeight()-notice.getHeight())/2f); notice.setModal(true); diff --git a/core/src/zero1hd/polyjet/ui/pages/OptionsPage.java b/core/src/zero1hd/polyjet/ui/pages/OptionsPage.java index 7acd4f7..ef4be80 100755 --- a/core/src/zero1hd/polyjet/ui/pages/OptionsPage.java +++ b/core/src/zero1hd/polyjet/ui/pages/OptionsPage.java @@ -40,7 +40,7 @@ public class OptionsPage extends Page { Label musicVolSliderLabel = new Label("Music Volume: ", core.getDefaultSkin()); optionsTable.add(musicVolSliderLabel).padRight(12f).left(); musicVolSlider = new Slider(0, 100, 0.1f, false, core.getDefaultSkin()); - musicVolSlider.setValue(core.prefs.getFloat("music vol", 100f)); + musicVolSlider.setValue(core.getPrefs().getFloat("music vol", 100f)); optionsTable.add(musicVolSlider).prefWidth(790).left(); final Label musicVolPercentage = new Label(MathUtils.round(musicVolSlider.getValue()) + "%", core.getDefaultSkin()); musicVolSlider.addListener(new ChangeListener() { @@ -56,7 +56,7 @@ public class OptionsPage extends Page { Label fxVolSliderLabel = new Label("FX Volume: ", core.getDefaultSkin()); optionsTable.add(fxVolSliderLabel).padRight(12f).left(); fxVolSlider = new Slider(0, 100, 1, false, core.getDefaultSkin()); - fxVolSlider.setValue(core.prefs.getFloat("fx vol", 100f)); + fxVolSlider.setValue(core.getPrefs().getFloat("fx vol", 100f)); optionsTable.add(fxVolSlider).prefWidth(790); final Label fxVolPercentage = new Label(MathUtils.round(fxVolSlider.getValue()) + "%", core.getDefaultSkin()); fxVolSlider.addListener(new ChangeListener() { @@ -73,7 +73,7 @@ public class OptionsPage extends Page { Label musicDirectoryLabel = new Label("Music Directory: ", core.getDefaultSkin()); optionsTable.add(musicDirectoryLabel).left(); directoryField = new TextField(null, core.getDefaultSkin()); - directoryField.setText(core.prefs.getString("music dir", System.getProperty("user.home")+System.getProperty("file.separator")+"Music")); + directoryField.setText(core.getPrefs().getString("music dir", System.getProperty("user.home")+System.getProperty("file.separator")+"Music")); optionsTable.add(directoryField).prefWidth(810).left(); optionsTable.row(); diff --git a/core/src/zero1hd/polyjet/ui/stages/CreativeStage.java b/core/src/zero1hd/polyjet/ui/stages/CreativeStage.java index 6403928..34a7e9a 100755 --- a/core/src/zero1hd/polyjet/ui/stages/CreativeStage.java +++ b/core/src/zero1hd/polyjet/ui/stages/CreativeStage.java @@ -15,7 +15,6 @@ import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener; import zero1hd.polyjet.Polyjet; import zero1hd.polyjet.audio.AudioAnalyzer; -import zero1hd.polyjet.audio.AudioData; import zero1hd.polyjet.screens.MainMenu; import zero1hd.polyjet.ui.windows.BeatViewer; import zero1hd.polyjet.ui.windows.FPSWindow; @@ -44,7 +43,7 @@ public class CreativeStage extends Stage implements MiniListener { analyzer = new AudioAnalyzer(); analyzer.sender.addListener(this); - musicSelector = new MusicSelector("Select Audio File", core.getDefaultSkin(), core.prefs.getString("music dir"), "default"); + musicSelector = new MusicSelector("Select Audio File", core.getDefaultSkin(), core.getPrefs().getString("music dir"), "default"); musicSelector.miniSender.addListener(this); musicSelector.postInit(); musicSelector.refresh(); @@ -54,7 +53,7 @@ public class CreativeStage extends Stage implements MiniListener { beatViewer = new BeatViewer("Beat", core.getDefaultSkin(), core, analyzer); graphViewer = new GraphWindow("Peak Values", core.getDefaultSkin()); - volumeWindow = new VolumeWindow("Volume adjustments", core.getDefaultSkin(), core.prefs); + volumeWindow = new VolumeWindow("Volume adjustments", core.getDefaultSkin(), core.getPrefs()); //Back button TextButton backButton = new TextButton("Back", core.getDefaultSkin()); diff --git a/core/src/zero1hd/polyjet/ui/windows/MusicController.java b/core/src/zero1hd/polyjet/ui/windows/MusicController.java index 284de15..bbd4b1c 100755 --- a/core/src/zero1hd/polyjet/ui/windows/MusicController.java +++ b/core/src/zero1hd/polyjet/ui/windows/MusicController.java @@ -44,13 +44,6 @@ public class MusicController extends Window { togglePlay = new Image(skin.getDrawable("loading")) { @Override public void act(float delta) { -// if (audiofile != null) { -// if (audiofile.getPlaybackMusic().isPlaying()) { -// setDrawable(skin.getDrawable("pause")); -// } else if (!audiofile.getPlaybackMusic().isPlaying() && audiofile != null) { -// setDrawable(skin.getDrawable("arrow")); -// } -// } super.act(delta); } };