cleaning and minor progress on recreation of pre game screen

This commit is contained in:
Harrison Deng 2017-05-24 00:03:29 -05:00
parent 52cd737c3a
commit bb40cd230d
9 changed files with 21 additions and 24 deletions

View File

@ -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;
}
}

View File

@ -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();
}

View File

@ -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();
}

View File

@ -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))));
}

View File

@ -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());

View File

@ -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);

View File

@ -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();

View File

@ -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());

View File

@ -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);
}
};