temporarily finished loading window, polished options page a little

This commit is contained in:
Harrison Deng 2017-05-08 22:20:24 -05:00
parent fa2a843eb4
commit 58e41189eb
6 changed files with 65 additions and 22 deletions

View File

@ -178,6 +178,14 @@ default-window
orig: 27, 29
offset: 0, 0
index: -1
tinted-window
rotate: false
xy: 154, 5
size: 27, 29
split: 4, 3, 20, 3
orig: 27, 29
offset: 0, 0
index: -1
selection
rotate: false
xy: 174, 48

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

View File

@ -198,6 +198,11 @@ public class Polyjet extends Game {
WindowStyle defaultWindow = new WindowStyle(defaultSkin.getFont("window-font"), defaultSkin.getColor("default"), defaultSkin.getDrawable("default-window"));
defaultSkin.add("default", defaultWindow);
WindowStyle tintedWindow = new WindowStyle(defaultWindow);
tintedWindow.titleFontColor = defaultSkin.getColor("inverse");
tintedWindow.background = defaultSkin.getDrawable("tinted-window");
defaultSkin.add("tinted", tintedWindow);
ListStyle defaultList = new ListStyle(defaultSkin.getFont("sub-font"), defaultSkin.getColor("inverse"), defaultSkin.getColor("default"), defaultSkin.getDrawable("selection"));
defaultSkin.add("default", defaultList);

View File

@ -5,7 +5,6 @@ import java.io.FilenameFilter;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Preferences;
import com.badlogic.gdx.audio.Sound;
import com.badlogic.gdx.files.FileHandle;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.scenes.scene2d.Actor;
@ -44,10 +43,12 @@ public class MusicSelectionPage extends Page {
});
addActor(back);
loadingWindow = new LoadingWindow(core.defaultSkin, true, core.assetManager.get("sounds/SFX_open.ogg", Sound.class), core.assetManager.get("sounds/SFX_close.ogg", Sound.class), core.prefs.getFloat("fx vol"));
loadingWindow = new LoadingWindow(core.defaultSkin, "tinted", true, core.assetManager, core.prefs.getFloat("fx vol"));
loadingWindow.setPosition((getWidth()-loadingWindow.getWidth())/2f, (getHeight()-loadingWindow.getHeight())/2f);
addActor(loadingWindow);
loadingWindow.playOpenSound();
loadingWindow.setMovable(false);
loadingWindow.setModal(true);
musicChoices = new Table();
musicChoices.defaults().pad(10f);
@ -57,6 +58,8 @@ public class MusicSelectionPage extends Page {
musicChoiceScroller.debug();
addActor(musicChoiceScroller);
loadingWindow.toFront();
}
@Override

View File

@ -30,7 +30,7 @@ public class OptionsPage extends Page {
private byte goToScreen;
public OptionsPage(final Polyjet core, final Vector3 targetPosition, final MoreOptionsPage moreOptionsPage) {
this.core = core;
optionsTable.defaults().padTop(5f).padBottom(5f);
optionsTable.defaults().spaceLeft(40f).padTop(5f).padBottom(5f).left();
Label optionGeneralTitle = new Label("General", core.defaultSkin, "large-font", core.defaultSkin.getColor("default"));
optionsTable.add(optionGeneralTitle).left().spaceBottom(10f);
@ -38,10 +38,10 @@ public class OptionsPage extends Page {
optionsTable.row();
Label musicVolSliderLabel = new Label("Music Volume: ", core.defaultSkin);
optionsTable.add(musicVolSliderLabel).spaceRight(12f).left();
optionsTable.add(musicVolSliderLabel).padRight(12f).left();
musicVolSlider = new Slider(0, 100, 0.1f, false, core.defaultSkin);
musicVolSlider.setValue(core.prefs.getFloat("music vol", 100f));
optionsTable.add(musicVolSlider).prefWidth(790);
optionsTable.add(musicVolSlider).prefWidth(790).left();
final Label musicVolPercentage = new Label(MathUtils.round(musicVolSlider.getValue()) + "%", core.defaultSkin);
musicVolSlider.addListener(new ChangeListener() {
@Override
@ -49,12 +49,12 @@ public class OptionsPage extends Page {
musicVolPercentage.setText(MathUtils.round(musicVolSlider.getValue()) + "%");
}
});
optionsTable.add(musicVolPercentage).right();
optionsTable.add(musicVolPercentage).expandX();
optionsTable.row();
Label fxVolSliderLabel = new Label("FX Volume: ", core.defaultSkin);
optionsTable.add(fxVolSliderLabel).spaceRight(12f).left();
optionsTable.add(fxVolSliderLabel).padRight(12f).left();
fxVolSlider = new Slider(0, 100, 1, false, core.defaultSkin);
fxVolSlider.setValue(core.prefs.getFloat("fx vol", 100f));
optionsTable.add(fxVolSlider).prefWidth(790);
@ -66,7 +66,7 @@ public class OptionsPage extends Page {
}
});
optionsTable.add(fxVolPercentage).right();
optionsTable.add(fxVolPercentage);
optionsTable.row();

View File

@ -1,5 +1,6 @@
package zero1hd.polyjet.ui.windows;
import com.badlogic.gdx.assets.AssetManager;
import com.badlogic.gdx.audio.Sound;
import com.badlogic.gdx.scenes.scene2d.actions.Actions;
import com.badlogic.gdx.scenes.scene2d.ui.Image;
@ -13,34 +14,60 @@ public class LoadingWindow extends Window {
private Sound closeSound;
private Sound openSound;
private float vol;
public LoadingWindow(Skin skin, boolean progress, Sound openSound, Sound closeSound, float vol) {
super("loading", skin);
this.closeSound = closeSound;
this.openSound = openSound;
public LoadingWindow(Skin skin, boolean progress, AssetManager assets, float vol) {
super("loading...", skin);
this.openSound = assets.get("sounds/SFX_open.ogg", Sound.class);
this.closeSound = assets.get("sounds/SFX_close.ogg", Sound.class);
this.vol = vol;
Image loading = new Image(skin, "loading");
loading.setPosition((getWidth()-loading.getWidth())/2, getHeight()-loading.getHeight() - 32f);
loading.setOrigin(loading.getWidth()/2, loading.getHeight()/2);
loading.addAction(Actions.forever(Actions.rotateBy(-360f, 2f)));
add(loading).size(loading.getHeight()).spaceRight(15f).left();
add(loading).left();
System.out.println(loading.getHeight());
setSize(loading.getWidth()+20f, loading.getHeight()+40f);
loading.setOrigin(loading.getWidth()/2, loading.getHeight()/2);
setSize(loading.getWidth(), loading.getHeight()+25f);
if (progress) {
status = new Label("[ ]", skin);
setSize(loading.getWidth() + status.getWidth() + 45f, status.getHeight() >= loading.getHeight() ? status.getHeight() : loading.getHeight());
add(status).expandX().right();
status = new Label("[ ]", skin, "sub-font", skin.getColor("default"));
add(status).spaceLeft(10f).expandX().right();
setSize(getWidth() + status.getWidth() + 45f, (loading.getHeight() >= status.getHeight() ? loading.getHeight() : status.getHeight()) + 74);
}
}
public LoadingWindow(Skin skin, String styleName, boolean progress, AssetManager assets, float vol) {
super("loading...", skin, styleName);
this.openSound = assets.get("sounds/SFX_open.ogg", Sound.class);
this.closeSound = assets.get("sounds/SFX_close.ogg", Sound.class);
this.vol = vol;
Image loading = new Image(skin, "loading");
loading.addAction(Actions.forever(Actions.rotateBy(-360f, 2f)));
add(loading).left();
System.out.println(loading.getHeight());
setSize(loading.getWidth()+20f, loading.getHeight()+40f);
loading.setOrigin(loading.getWidth()/2, loading.getHeight()/2);
if (progress) {
status = new Label("[ ]", skin, "sub-font", skin.getColor("default"));
add(status).spaceLeft(10f).expandX().right();
setSize(getWidth() + status.getWidth() + 45f, (loading.getHeight() >= status.getHeight() ? loading.getHeight() : status.getHeight()) + 74);
}
}
public void playOpenSound() {
openSound.play(vol/100f);
System.out.println(vol);
}
@Override