temporarily finished loading window, polished options page a little
This commit is contained in:
parent
fa2a843eb4
commit
58e41189eb
@ -178,6 +178,14 @@ default-window
|
|||||||
orig: 27, 29
|
orig: 27, 29
|
||||||
offset: 0, 0
|
offset: 0, 0
|
||||||
index: -1
|
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
|
selection
|
||||||
rotate: false
|
rotate: false
|
||||||
xy: 174, 48
|
xy: 174, 48
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.3 KiB |
@ -198,6 +198,11 @@ public class Polyjet extends Game {
|
|||||||
WindowStyle defaultWindow = new WindowStyle(defaultSkin.getFont("window-font"), defaultSkin.getColor("default"), defaultSkin.getDrawable("default-window"));
|
WindowStyle defaultWindow = new WindowStyle(defaultSkin.getFont("window-font"), defaultSkin.getColor("default"), defaultSkin.getDrawable("default-window"));
|
||||||
defaultSkin.add("default", defaultWindow);
|
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"));
|
ListStyle defaultList = new ListStyle(defaultSkin.getFont("sub-font"), defaultSkin.getColor("inverse"), defaultSkin.getColor("default"), defaultSkin.getDrawable("selection"));
|
||||||
defaultSkin.add("default", defaultList);
|
defaultSkin.add("default", defaultList);
|
||||||
|
|
||||||
|
@ -5,7 +5,6 @@ import java.io.FilenameFilter;
|
|||||||
|
|
||||||
import com.badlogic.gdx.Gdx;
|
import com.badlogic.gdx.Gdx;
|
||||||
import com.badlogic.gdx.Preferences;
|
import com.badlogic.gdx.Preferences;
|
||||||
import com.badlogic.gdx.audio.Sound;
|
|
||||||
import com.badlogic.gdx.files.FileHandle;
|
import com.badlogic.gdx.files.FileHandle;
|
||||||
import com.badlogic.gdx.graphics.Texture;
|
import com.badlogic.gdx.graphics.Texture;
|
||||||
import com.badlogic.gdx.scenes.scene2d.Actor;
|
import com.badlogic.gdx.scenes.scene2d.Actor;
|
||||||
@ -44,10 +43,12 @@ public class MusicSelectionPage extends Page {
|
|||||||
});
|
});
|
||||||
addActor(back);
|
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);
|
loadingWindow.setPosition((getWidth()-loadingWindow.getWidth())/2f, (getHeight()-loadingWindow.getHeight())/2f);
|
||||||
addActor(loadingWindow);
|
addActor(loadingWindow);
|
||||||
loadingWindow.playOpenSound();
|
loadingWindow.playOpenSound();
|
||||||
|
loadingWindow.setMovable(false);
|
||||||
|
loadingWindow.setModal(true);
|
||||||
|
|
||||||
musicChoices = new Table();
|
musicChoices = new Table();
|
||||||
musicChoices.defaults().pad(10f);
|
musicChoices.defaults().pad(10f);
|
||||||
@ -57,6 +58,8 @@ public class MusicSelectionPage extends Page {
|
|||||||
|
|
||||||
musicChoiceScroller.debug();
|
musicChoiceScroller.debug();
|
||||||
addActor(musicChoiceScroller);
|
addActor(musicChoiceScroller);
|
||||||
|
|
||||||
|
loadingWindow.toFront();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -30,7 +30,7 @@ public class OptionsPage extends Page {
|
|||||||
private byte goToScreen;
|
private byte goToScreen;
|
||||||
public OptionsPage(final Polyjet core, final Vector3 targetPosition, final MoreOptionsPage moreOptionsPage) {
|
public OptionsPage(final Polyjet core, final Vector3 targetPosition, final MoreOptionsPage moreOptionsPage) {
|
||||||
this.core = core;
|
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"));
|
Label optionGeneralTitle = new Label("General", core.defaultSkin, "large-font", core.defaultSkin.getColor("default"));
|
||||||
optionsTable.add(optionGeneralTitle).left().spaceBottom(10f);
|
optionsTable.add(optionGeneralTitle).left().spaceBottom(10f);
|
||||||
@ -38,10 +38,10 @@ public class OptionsPage extends Page {
|
|||||||
optionsTable.row();
|
optionsTable.row();
|
||||||
|
|
||||||
Label musicVolSliderLabel = new Label("Music Volume: ", core.defaultSkin);
|
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 = new Slider(0, 100, 0.1f, false, core.defaultSkin);
|
||||||
musicVolSlider.setValue(core.prefs.getFloat("music vol", 100f));
|
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);
|
final Label musicVolPercentage = new Label(MathUtils.round(musicVolSlider.getValue()) + "%", core.defaultSkin);
|
||||||
musicVolSlider.addListener(new ChangeListener() {
|
musicVolSlider.addListener(new ChangeListener() {
|
||||||
@Override
|
@Override
|
||||||
@ -49,12 +49,12 @@ public class OptionsPage extends Page {
|
|||||||
musicVolPercentage.setText(MathUtils.round(musicVolSlider.getValue()) + "%");
|
musicVolPercentage.setText(MathUtils.round(musicVolSlider.getValue()) + "%");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
optionsTable.add(musicVolPercentage).right();
|
optionsTable.add(musicVolPercentage).expandX();
|
||||||
|
|
||||||
optionsTable.row();
|
optionsTable.row();
|
||||||
|
|
||||||
Label fxVolSliderLabel = new Label("FX Volume: ", core.defaultSkin);
|
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 = new Slider(0, 100, 1, false, core.defaultSkin);
|
||||||
fxVolSlider.setValue(core.prefs.getFloat("fx vol", 100f));
|
fxVolSlider.setValue(core.prefs.getFloat("fx vol", 100f));
|
||||||
optionsTable.add(fxVolSlider).prefWidth(790);
|
optionsTable.add(fxVolSlider).prefWidth(790);
|
||||||
@ -66,7 +66,7 @@ public class OptionsPage extends Page {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
optionsTable.add(fxVolPercentage).right();
|
optionsTable.add(fxVolPercentage);
|
||||||
|
|
||||||
optionsTable.row();
|
optionsTable.row();
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package zero1hd.polyjet.ui.windows;
|
package zero1hd.polyjet.ui.windows;
|
||||||
|
|
||||||
|
import com.badlogic.gdx.assets.AssetManager;
|
||||||
import com.badlogic.gdx.audio.Sound;
|
import com.badlogic.gdx.audio.Sound;
|
||||||
import com.badlogic.gdx.scenes.scene2d.actions.Actions;
|
import com.badlogic.gdx.scenes.scene2d.actions.Actions;
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.Image;
|
import com.badlogic.gdx.scenes.scene2d.ui.Image;
|
||||||
@ -13,34 +14,60 @@ public class LoadingWindow extends Window {
|
|||||||
private Sound closeSound;
|
private Sound closeSound;
|
||||||
private Sound openSound;
|
private Sound openSound;
|
||||||
private float vol;
|
private float vol;
|
||||||
public LoadingWindow(Skin skin, boolean progress, Sound openSound, Sound closeSound, float vol) {
|
public LoadingWindow(Skin skin, boolean progress, AssetManager assets, float vol) {
|
||||||
super("loading", skin);
|
super("loading...", skin);
|
||||||
this.closeSound = closeSound;
|
|
||||||
this.openSound = openSound;
|
this.openSound = assets.get("sounds/SFX_open.ogg", Sound.class);
|
||||||
|
this.closeSound = assets.get("sounds/SFX_close.ogg", Sound.class);
|
||||||
this.vol = vol;
|
this.vol = vol;
|
||||||
Image loading = new Image(skin, "loading");
|
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)));
|
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) {
|
if (progress) {
|
||||||
status = new Label("[ ]", skin);
|
status = new Label("[ ]", skin, "sub-font", skin.getColor("default"));
|
||||||
setSize(loading.getWidth() + status.getWidth() + 45f, status.getHeight() >= loading.getHeight() ? status.getHeight() : loading.getHeight());
|
add(status).spaceLeft(10f).expandX().right();
|
||||||
|
setSize(getWidth() + status.getWidth() + 45f, (loading.getHeight() >= status.getHeight() ? loading.getHeight() : status.getHeight()) + 74);
|
||||||
|
}
|
||||||
add(status).expandX().right();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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() {
|
public void playOpenSound() {
|
||||||
openSound.play(vol/100f);
|
openSound.play(vol/100f);
|
||||||
System.out.println(vol);
|
System.out.println(vol);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user