cleaning and minor progress on recreation of pre game screen
This commit is contained in:
parent
52cd737c3a
commit
bb40cd230d
@ -43,10 +43,10 @@ public class Polyjet extends Game {
|
|||||||
|
|
||||||
private AssetManager assetManager = new AssetManager();
|
private AssetManager assetManager = new AssetManager();
|
||||||
private Skin defaultSkin = new Skin();
|
private Skin defaultSkin = new Skin();
|
||||||
public FreeTypeFontGenerator default_fontGenerator;
|
private FreeTypeFontGenerator default_fontGenerator;
|
||||||
public FreeTypeFontGenerator darktech_ldr_fontGenerator;
|
private FreeTypeFontGenerator darktech_ldr_fontGenerator;
|
||||||
TextureAtlas skinAtlas;
|
TextureAtlas skinAtlas;
|
||||||
public Preferences prefs;
|
private Preferences prefs;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void create() {
|
public void create() {
|
||||||
@ -253,4 +253,8 @@ public class Polyjet extends Game {
|
|||||||
public Skin getDefaultSkin() {
|
public Skin getDefaultSkin() {
|
||||||
return defaultSkin;
|
return defaultSkin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Preferences getPrefs() {
|
||||||
|
return prefs;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -95,7 +95,7 @@ public class MainMenu extends ScreenAdapter implements TransitionAdapter {
|
|||||||
@Override
|
@Override
|
||||||
public void hide() {
|
public void hide() {
|
||||||
if (optionsPage != null) {
|
if (optionsPage != null) {
|
||||||
optionsPage.saveOptions(core.prefs);
|
optionsPage.saveOptions(core.getPrefs());
|
||||||
}
|
}
|
||||||
super.hide();
|
super.hide();
|
||||||
}
|
}
|
||||||
|
@ -2,8 +2,10 @@ package zero1hd.polyjet.screens;
|
|||||||
|
|
||||||
import com.badlogic.gdx.Gdx;
|
import com.badlogic.gdx.Gdx;
|
||||||
import com.badlogic.gdx.ScreenAdapter;
|
import com.badlogic.gdx.ScreenAdapter;
|
||||||
|
import com.badlogic.gdx.assets.AssetManager;
|
||||||
import com.badlogic.gdx.math.Vector3;
|
import com.badlogic.gdx.math.Vector3;
|
||||||
import com.badlogic.gdx.scenes.scene2d.Stage;
|
import com.badlogic.gdx.scenes.scene2d.Stage;
|
||||||
|
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
|
||||||
|
|
||||||
import zero1hd.polyjet.util.MiniEvents;
|
import zero1hd.polyjet.util.MiniEvents;
|
||||||
import zero1hd.polyjet.util.MiniListener;
|
import zero1hd.polyjet.util.MiniListener;
|
||||||
@ -15,7 +17,7 @@ public class PreGameScreen extends ScreenAdapter implements TransitionAdapter, M
|
|||||||
|
|
||||||
Vector3 cameraPos;
|
Vector3 cameraPos;
|
||||||
|
|
||||||
public PreGameScreen() {
|
public PreGameScreen(Skin skin, AssetManager assets) {
|
||||||
stage = new Stage();
|
stage = new Stage();
|
||||||
cameraPos = new Vector3();
|
cameraPos = new Vector3();
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,6 @@ import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
|
|||||||
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
|
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
|
||||||
|
|
||||||
import zero1hd.polyjet.Polyjet;
|
import zero1hd.polyjet.Polyjet;
|
||||||
import zero1hd.polyjet.screens.MainMenu;
|
|
||||||
import zero1hd.polyjet.screens.PreGameScreen;
|
import zero1hd.polyjet.screens.PreGameScreen;
|
||||||
|
|
||||||
public class MainPage extends Page {
|
public class MainPage extends Page {
|
||||||
@ -100,7 +99,7 @@ public class MainPage extends Page {
|
|||||||
Actions.run(new Runnable() {
|
Actions.run(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
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))));
|
}), Actions.parallel(Actions.scaleTo(1, 1), Actions.alpha(0.6f))));
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,7 @@ public class MoreOptionsPage extends Page {
|
|||||||
addActor(controlsScroller);
|
addActor(controlsScroller);
|
||||||
controlsScroller.setVisible(false);
|
controlsScroller.setVisible(false);
|
||||||
|
|
||||||
graphicsSettings = new GraphicsTable(core.getDefaultSkin(), core.prefs);
|
graphicsSettings = new GraphicsTable(core.getDefaultSkin(), core.getPrefs());
|
||||||
graphicsScroller = new ScrollPane(graphicsSettings, core.getDefaultSkin());
|
graphicsScroller = new ScrollPane(graphicsSettings, core.getDefaultSkin());
|
||||||
graphicsScroller.setFadeScrollBars(false);
|
graphicsScroller.setFadeScrollBars(false);
|
||||||
graphicsScroller.setSize(getWidth()-backArrow.getWidth()-backArrow.getX()-10, getHeight());
|
graphicsScroller.setSize(getWidth()-backArrow.getWidth()-backArrow.getX()-10, getHeight());
|
||||||
|
@ -53,7 +53,7 @@ public class MusicSelectionPage extends Page {
|
|||||||
});
|
});
|
||||||
addActor(back);
|
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);
|
loadingWindow.setPosition((getWidth()-loadingWindow.getWidth())/2f, (getHeight()-loadingWindow.getHeight())/2f);
|
||||||
addActor(loadingWindow);
|
addActor(loadingWindow);
|
||||||
@ -87,7 +87,7 @@ public class MusicSelectionPage extends Page {
|
|||||||
public void run() {
|
public void run() {
|
||||||
Logger.getLogger("org.jaudiotagger").setLevel(Level.SEVERE);
|
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
|
@Override
|
||||||
public boolean accept(File dir, String name) {
|
public boolean accept(File dir, String name) {
|
||||||
if (name.endsWith("mp3") || name.endsWith("wav")) {
|
if (name.endsWith("mp3") || name.endsWith("wav")) {
|
||||||
@ -131,7 +131,7 @@ public class MusicSelectionPage extends Page {
|
|||||||
loadingWindow.remove();
|
loadingWindow.remove();
|
||||||
|
|
||||||
} else {
|
} 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.setSize(0.6f*getWidth(), 0.6f*getHeight());
|
||||||
notice.setPosition((getWidth()-notice.getWidth())/2f, (getHeight()-notice.getHeight())/2f);
|
notice.setPosition((getWidth()-notice.getWidth())/2f, (getHeight()-notice.getHeight())/2f);
|
||||||
notice.setModal(true);
|
notice.setModal(true);
|
||||||
|
@ -40,7 +40,7 @@ public class OptionsPage extends Page {
|
|||||||
Label musicVolSliderLabel = new Label("Music Volume: ", core.getDefaultSkin());
|
Label musicVolSliderLabel = new Label("Music Volume: ", core.getDefaultSkin());
|
||||||
optionsTable.add(musicVolSliderLabel).padRight(12f).left();
|
optionsTable.add(musicVolSliderLabel).padRight(12f).left();
|
||||||
musicVolSlider = new Slider(0, 100, 0.1f, false, core.getDefaultSkin());
|
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();
|
optionsTable.add(musicVolSlider).prefWidth(790).left();
|
||||||
final Label musicVolPercentage = new Label(MathUtils.round(musicVolSlider.getValue()) + "%", core.getDefaultSkin());
|
final Label musicVolPercentage = new Label(MathUtils.round(musicVolSlider.getValue()) + "%", core.getDefaultSkin());
|
||||||
musicVolSlider.addListener(new ChangeListener() {
|
musicVolSlider.addListener(new ChangeListener() {
|
||||||
@ -56,7 +56,7 @@ public class OptionsPage extends Page {
|
|||||||
Label fxVolSliderLabel = new Label("FX Volume: ", core.getDefaultSkin());
|
Label fxVolSliderLabel = new Label("FX Volume: ", core.getDefaultSkin());
|
||||||
optionsTable.add(fxVolSliderLabel).padRight(12f).left();
|
optionsTable.add(fxVolSliderLabel).padRight(12f).left();
|
||||||
fxVolSlider = new Slider(0, 100, 1, false, core.getDefaultSkin());
|
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);
|
optionsTable.add(fxVolSlider).prefWidth(790);
|
||||||
final Label fxVolPercentage = new Label(MathUtils.round(fxVolSlider.getValue()) + "%", core.getDefaultSkin());
|
final Label fxVolPercentage = new Label(MathUtils.round(fxVolSlider.getValue()) + "%", core.getDefaultSkin());
|
||||||
fxVolSlider.addListener(new ChangeListener() {
|
fxVolSlider.addListener(new ChangeListener() {
|
||||||
@ -73,7 +73,7 @@ public class OptionsPage extends Page {
|
|||||||
Label musicDirectoryLabel = new Label("Music Directory: ", core.getDefaultSkin());
|
Label musicDirectoryLabel = new Label("Music Directory: ", core.getDefaultSkin());
|
||||||
optionsTable.add(musicDirectoryLabel).left();
|
optionsTable.add(musicDirectoryLabel).left();
|
||||||
directoryField = new TextField(null, core.getDefaultSkin());
|
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.add(directoryField).prefWidth(810).left();
|
||||||
|
|
||||||
optionsTable.row();
|
optionsTable.row();
|
||||||
|
@ -15,7 +15,6 @@ import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
|
|||||||
|
|
||||||
import zero1hd.polyjet.Polyjet;
|
import zero1hd.polyjet.Polyjet;
|
||||||
import zero1hd.polyjet.audio.AudioAnalyzer;
|
import zero1hd.polyjet.audio.AudioAnalyzer;
|
||||||
import zero1hd.polyjet.audio.AudioData;
|
|
||||||
import zero1hd.polyjet.screens.MainMenu;
|
import zero1hd.polyjet.screens.MainMenu;
|
||||||
import zero1hd.polyjet.ui.windows.BeatViewer;
|
import zero1hd.polyjet.ui.windows.BeatViewer;
|
||||||
import zero1hd.polyjet.ui.windows.FPSWindow;
|
import zero1hd.polyjet.ui.windows.FPSWindow;
|
||||||
@ -44,7 +43,7 @@ public class CreativeStage extends Stage implements MiniListener {
|
|||||||
analyzer = new AudioAnalyzer();
|
analyzer = new AudioAnalyzer();
|
||||||
analyzer.sender.addListener(this);
|
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.miniSender.addListener(this);
|
||||||
musicSelector.postInit();
|
musicSelector.postInit();
|
||||||
musicSelector.refresh();
|
musicSelector.refresh();
|
||||||
@ -54,7 +53,7 @@ public class CreativeStage extends Stage implements MiniListener {
|
|||||||
beatViewer = new BeatViewer("Beat", core.getDefaultSkin(), core, analyzer);
|
beatViewer = new BeatViewer("Beat", core.getDefaultSkin(), core, analyzer);
|
||||||
|
|
||||||
graphViewer = new GraphWindow("Peak Values", core.getDefaultSkin());
|
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
|
//Back button
|
||||||
TextButton backButton = new TextButton("Back", core.getDefaultSkin());
|
TextButton backButton = new TextButton("Back", core.getDefaultSkin());
|
||||||
|
@ -44,13 +44,6 @@ public class MusicController extends Window {
|
|||||||
togglePlay = new Image(skin.getDrawable("loading")) {
|
togglePlay = new Image(skin.getDrawable("loading")) {
|
||||||
@Override
|
@Override
|
||||||
public void act(float delta) {
|
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);
|
super.act(delta);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user