v0.8.2: big code refactor on the settings window in prep for additions
This commit is contained in:
parent
0865333774
commit
0f836e5042
|
@ -34,16 +34,14 @@ import com.shatteredpixel.shatteredpixeldungeon.ui.RedButton;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.ui.RenderedTextBlock;
|
import com.shatteredpixel.shatteredpixeldungeon.ui.RenderedTextBlock;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.ui.Toolbar;
|
import com.shatteredpixel.shatteredpixeldungeon.ui.Toolbar;
|
||||||
import com.watabou.noosa.Game;
|
import com.watabou.noosa.Game;
|
||||||
import com.watabou.noosa.Group;
|
|
||||||
import com.watabou.noosa.audio.Sample;
|
import com.watabou.noosa.audio.Sample;
|
||||||
|
import com.watabou.noosa.ui.Component;
|
||||||
import com.watabou.utils.DeviceCompat;
|
import com.watabou.utils.DeviceCompat;
|
||||||
import com.watabou.utils.Random;
|
import com.watabou.utils.Random;
|
||||||
|
|
||||||
//TODO seeing as a fair bit of this is platform-dependant, might be better to have a per-platform wndsettings
|
|
||||||
public class WndSettings extends WndTabbed {
|
public class WndSettings extends WndTabbed {
|
||||||
|
|
||||||
private static final int WIDTH = 112;
|
private static final int WIDTH = 112;
|
||||||
private static final int HEIGHT = 138;
|
|
||||||
private static final int SLIDER_HEIGHT = 24;
|
private static final int SLIDER_HEIGHT = 24;
|
||||||
private static final int BTN_HEIGHT = 18;
|
private static final int BTN_HEIGHT = 18;
|
||||||
private static final int GAP_TINY = 2;
|
private static final int GAP_TINY = 2;
|
||||||
|
@ -59,15 +57,13 @@ public class WndSettings extends WndTabbed {
|
||||||
public WndSettings() {
|
public WndSettings() {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
|
float height;
|
||||||
|
|
||||||
display = new DisplayTab();
|
display = new DisplayTab();
|
||||||
|
display.setSize(WIDTH, 0);
|
||||||
|
height = display.height();
|
||||||
add( display );
|
add( display );
|
||||||
|
|
||||||
ui = new UITab();
|
|
||||||
add( ui );
|
|
||||||
|
|
||||||
audio = new AudioTab();
|
|
||||||
add( audio );
|
|
||||||
|
|
||||||
add( new IconTab(Icons.get(Icons.DISPLAY)){
|
add( new IconTab(Icons.get(Icons.DISPLAY)){
|
||||||
@Override
|
@Override
|
||||||
protected void select(boolean value) {
|
protected void select(boolean value) {
|
||||||
|
@ -77,6 +73,11 @@ public class WndSettings extends WndTabbed {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
ui = new UITab();
|
||||||
|
ui.setSize(WIDTH, 0);
|
||||||
|
height = Math.max(height, ui.height());
|
||||||
|
add( ui );
|
||||||
|
|
||||||
add( new IconTab(Icons.get(Icons.PREFS)){
|
add( new IconTab(Icons.get(Icons.PREFS)){
|
||||||
@Override
|
@Override
|
||||||
protected void select(boolean value) {
|
protected void select(boolean value) {
|
||||||
|
@ -86,6 +87,11 @@ public class WndSettings extends WndTabbed {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
audio = new AudioTab();
|
||||||
|
audio.setSize(WIDTH, 0);
|
||||||
|
height = Math.max(height, audio.height());
|
||||||
|
add( audio );
|
||||||
|
|
||||||
add( new IconTab(Icons.get(Icons.AUDIO)){
|
add( new IconTab(Icons.get(Icons.AUDIO)){
|
||||||
@Override
|
@Override
|
||||||
protected void select(boolean value) {
|
protected void select(boolean value) {
|
||||||
|
@ -95,7 +101,7 @@ public class WndSettings extends WndTabbed {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
resize(WIDTH, HEIGHT);
|
resize(WIDTH, (int)Math.ceil(height));
|
||||||
|
|
||||||
layoutTabs();
|
layoutTabs();
|
||||||
|
|
||||||
|
@ -103,12 +109,19 @@ public class WndSettings extends WndTabbed {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private class DisplayTab extends Group {
|
private class DisplayTab extends Component {
|
||||||
|
|
||||||
public DisplayTab() {
|
OptionSlider optScale;
|
||||||
super();
|
CheckBox chkSaver;
|
||||||
|
RedButton btnOrientation;
|
||||||
|
|
||||||
OptionSlider scale = new OptionSlider(Messages.get(this, "scale"),
|
OptionSlider optBrightness;
|
||||||
|
OptionSlider optVisGrid;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void createChildren() {
|
||||||
|
if ((int)Math.ceil(2* Game.density) < PixelScene.maxDefaultZoom) {
|
||||||
|
optScale = new OptionSlider(Messages.get(this, "scale"),
|
||||||
(int)Math.ceil(2* Game.density)+ "X",
|
(int)Math.ceil(2* Game.density)+ "X",
|
||||||
PixelScene.maxDefaultZoom + "X",
|
PixelScene.maxDefaultZoom + "X",
|
||||||
(int)Math.ceil(2* Game.density),
|
(int)Math.ceil(2* Game.density),
|
||||||
|
@ -121,16 +134,11 @@ public class WndSettings extends WndTabbed {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if ((int)Math.ceil(2* Game.density) < PixelScene.maxDefaultZoom) {
|
add(optScale);
|
||||||
scale.setSelectedValue(PixelScene.defaultZoom);
|
|
||||||
scale.setRect(0, 0, WIDTH, SLIDER_HEIGHT);
|
|
||||||
add(scale);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
float bottom = scale.bottom();
|
if (!DeviceCompat.isDesktop() && PixelScene.maxScreenZoom >= 2) {
|
||||||
|
chkSaver = new CheckBox(Messages.get(this, "saver")) {
|
||||||
if (!DeviceCompat.isDesktop()) {
|
|
||||||
CheckBox chkSaver = new CheckBox( Messages.get( this, "saver" ) ) {
|
|
||||||
@Override
|
@Override
|
||||||
protected void onClick() {
|
protected void onClick() {
|
||||||
super.onClick();
|
super.onClick();
|
||||||
|
@ -154,14 +162,12 @@ public class WndSettings extends WndTabbed {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if (PixelScene.maxScreenZoom >= 2) {
|
|
||||||
chkSaver.setRect( 0, scale.bottom() + GAP_TINY, WIDTH, BTN_HEIGHT );
|
|
||||||
chkSaver.checked( SPDSettings.powerSaver() );
|
chkSaver.checked( SPDSettings.powerSaver() );
|
||||||
add( chkSaver );
|
add( chkSaver );
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO also need to disable this in android splitscreen
|
if (!DeviceCompat.isDesktop()) {
|
||||||
RedButton btnOrientation = new RedButton( PixelScene.landscape() ?
|
btnOrientation = new RedButton(PixelScene.landscape() ?
|
||||||
Messages.get(this, "portrait")
|
Messages.get(this, "portrait")
|
||||||
: Messages.get(this, "landscape")) {
|
: Messages.get(this, "landscape")) {
|
||||||
@Override
|
@Override
|
||||||
|
@ -169,78 +175,104 @@ public class WndSettings extends WndTabbed {
|
||||||
SPDSettings.landscape(!PixelScene.landscape());
|
SPDSettings.landscape(!PixelScene.landscape());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
btnOrientation.setRect( 0, chkSaver.bottom() + GAP_TINY, WIDTH, BTN_HEIGHT );
|
|
||||||
add(btnOrientation);
|
add(btnOrientation);
|
||||||
|
|
||||||
bottom = btnOrientation.bottom();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
OptionSlider brightness = new OptionSlider(Messages.get(this, "brightness"),
|
optBrightness = new OptionSlider(Messages.get(this, "brightness"),
|
||||||
Messages.get(this, "dark"), Messages.get(this, "bright"), -1, 1) {
|
Messages.get(this, "dark"), Messages.get(this, "bright"), -1, 1) {
|
||||||
@Override
|
@Override
|
||||||
protected void onChange() {
|
protected void onChange() {
|
||||||
SPDSettings.brightness(getSelectedValue());
|
SPDSettings.brightness(getSelectedValue());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
brightness.setSelectedValue(SPDSettings.brightness());
|
optBrightness.setSelectedValue(SPDSettings.brightness());
|
||||||
brightness.setRect(0, bottom + GAP_LRG, WIDTH, SLIDER_HEIGHT);
|
add(optBrightness);
|
||||||
add(brightness);
|
|
||||||
|
|
||||||
OptionSlider tileGrid = new OptionSlider(Messages.get(this, "visual_grid"),
|
optVisGrid = new OptionSlider(Messages.get(this, "visual_grid"),
|
||||||
Messages.get(this, "off"), Messages.get(this, "high"), -1, 2) {
|
Messages.get(this, "off"), Messages.get(this, "high"), -1, 2) {
|
||||||
@Override
|
@Override
|
||||||
protected void onChange() {
|
protected void onChange() {
|
||||||
SPDSettings.visualGrid(getSelectedValue());
|
SPDSettings.visualGrid(getSelectedValue());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
tileGrid.setSelectedValue(SPDSettings.visualGrid());
|
optVisGrid.setSelectedValue(SPDSettings.visualGrid());
|
||||||
tileGrid.setRect(0, brightness.bottom() + GAP_TINY, WIDTH, SLIDER_HEIGHT);
|
add(optVisGrid);
|
||||||
add(tileGrid);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void layout() {
|
||||||
|
|
||||||
|
float bottom = 0;
|
||||||
|
|
||||||
|
if (optScale != null){
|
||||||
|
optScale.setRect(0, 0, width, SLIDER_HEIGHT);
|
||||||
|
bottom = optScale.bottom();
|
||||||
}
|
}
|
||||||
|
|
||||||
private class UITab extends Group {
|
if (chkSaver != null){
|
||||||
|
chkSaver.setRect( 0, bottom + GAP_TINY, width, BTN_HEIGHT );
|
||||||
|
bottom = chkSaver.bottom();
|
||||||
|
}
|
||||||
|
|
||||||
public UITab(){
|
if (btnOrientation != null){
|
||||||
super();
|
btnOrientation.setRect( 0, bottom + GAP_TINY, width, BTN_HEIGHT );
|
||||||
|
bottom = btnOrientation.bottom();
|
||||||
|
}
|
||||||
|
|
||||||
RenderedTextBlock barDesc = PixelScene.renderTextBlock(Messages.get(this, "mode"), 9);
|
optBrightness.setRect(0, bottom + GAP_LRG, width, SLIDER_HEIGHT);
|
||||||
barDesc.setPos((WIDTH-barDesc.width())/2f, GAP_TINY);
|
optVisGrid.setRect(0, optBrightness.bottom() + GAP_TINY, width, SLIDER_HEIGHT);
|
||||||
PixelScene.align(barDesc);
|
|
||||||
|
height = optVisGrid.bottom();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private class UITab extends Component {
|
||||||
|
|
||||||
|
RenderedTextBlock barDesc;
|
||||||
|
RedButton btnSplit; RedButton btnGrouped; RedButton btnCentered;
|
||||||
|
CheckBox chkFlipToolbar;
|
||||||
|
CheckBox chkFlipTags;
|
||||||
|
|
||||||
|
CheckBox chkFullscreen;
|
||||||
|
CheckBox chkFont;
|
||||||
|
|
||||||
|
RedButton btnKeyBindings;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void createChildren() {
|
||||||
|
barDesc = PixelScene.renderTextBlock(Messages.get(this, "mode"), 9);
|
||||||
add(barDesc);
|
add(barDesc);
|
||||||
|
|
||||||
RedButton btnSplit = new RedButton(Messages.get(this, "split")){
|
btnSplit = new RedButton(Messages.get(this, "split")){
|
||||||
@Override
|
@Override
|
||||||
protected void onClick() {
|
protected void onClick() {
|
||||||
SPDSettings.toolbarMode(Toolbar.Mode.SPLIT.name());
|
SPDSettings.toolbarMode(Toolbar.Mode.SPLIT.name());
|
||||||
Toolbar.updateLayout();
|
Toolbar.updateLayout();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
btnSplit.setRect( 0, barDesc.bottom() + GAP_TINY, 36, 16);
|
|
||||||
add(btnSplit);
|
add(btnSplit);
|
||||||
|
|
||||||
RedButton btnGrouped = new RedButton(Messages.get(this, "group")){
|
btnGrouped = new RedButton(Messages.get(this, "group")){
|
||||||
@Override
|
@Override
|
||||||
protected void onClick() {
|
protected void onClick() {
|
||||||
SPDSettings.toolbarMode(Toolbar.Mode.GROUP.name());
|
SPDSettings.toolbarMode(Toolbar.Mode.GROUP.name());
|
||||||
Toolbar.updateLayout();
|
Toolbar.updateLayout();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
btnGrouped.setRect( btnSplit.right()+GAP_TINY, btnSplit.top(), 36, 16);
|
|
||||||
add(btnGrouped);
|
add(btnGrouped);
|
||||||
|
|
||||||
RedButton btnCentered = new RedButton(Messages.get(this, "center")){
|
btnCentered = new RedButton(Messages.get(this, "center")){
|
||||||
@Override
|
@Override
|
||||||
protected void onClick() {
|
protected void onClick() {
|
||||||
SPDSettings.toolbarMode(Toolbar.Mode.CENTER.name());
|
SPDSettings.toolbarMode(Toolbar.Mode.CENTER.name());
|
||||||
Toolbar.updateLayout();
|
Toolbar.updateLayout();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
btnCentered.setRect(btnGrouped.right()+GAP_TINY, btnSplit.top(), 36, 16);
|
|
||||||
add(btnCentered);
|
add(btnCentered);
|
||||||
|
|
||||||
CheckBox chkFlipToolbar = new CheckBox(Messages.get(this, "flip_toolbar")){
|
chkFlipToolbar = new CheckBox(Messages.get(this, "flip_toolbar")){
|
||||||
@Override
|
@Override
|
||||||
protected void onClick() {
|
protected void onClick() {
|
||||||
super.onClick();
|
super.onClick();
|
||||||
|
@ -248,11 +280,10 @@ public class WndSettings extends WndTabbed {
|
||||||
Toolbar.updateLayout();
|
Toolbar.updateLayout();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
chkFlipToolbar.setRect(0, btnGrouped.bottom() + GAP_TINY, WIDTH, BTN_HEIGHT);
|
|
||||||
chkFlipToolbar.checked(SPDSettings.flipToolbar());
|
chkFlipToolbar.checked(SPDSettings.flipToolbar());
|
||||||
add(chkFlipToolbar);
|
add(chkFlipToolbar);
|
||||||
|
|
||||||
final CheckBox chkFlipTags = new CheckBox(Messages.get(this, "flip_indicators")){
|
chkFlipTags = new CheckBox(Messages.get(this, "flip_indicators")){
|
||||||
@Override
|
@Override
|
||||||
protected void onClick() {
|
protected void onClick() {
|
||||||
super.onClick();
|
super.onClick();
|
||||||
|
@ -260,34 +291,21 @@ public class WndSettings extends WndTabbed {
|
||||||
GameScene.layoutTags();
|
GameScene.layoutTags();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
chkFlipTags.setRect(0, chkFlipToolbar.bottom() + GAP_TINY, WIDTH, BTN_HEIGHT);
|
|
||||||
chkFlipTags.checked(SPDSettings.flipTags());
|
chkFlipTags.checked(SPDSettings.flipTags());
|
||||||
add(chkFlipTags);
|
add(chkFlipTags);
|
||||||
|
|
||||||
/*OptionSlider slots = new OptionSlider(Messages.get(this, "quickslots"), "0", "4", 0, 4) {
|
chkFullscreen = new CheckBox( Messages.get(this, "fullscreen") ) {
|
||||||
@Override
|
|
||||||
protected void onChange() {
|
|
||||||
SPDSettings.quickSlots(getSelectedValue());
|
|
||||||
Toolbar.updateLayout();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
slots.setSelectedValue(SPDSettings.quickSlots());
|
|
||||||
slots.setRect(0, chkFlipTags.bottom() + GAP_TINY, WIDTH, SLIDER_HEIGHT);
|
|
||||||
add(slots);*/
|
|
||||||
|
|
||||||
CheckBox chkFullscreen = new CheckBox( Messages.get(this, "fullscreen") ) {
|
|
||||||
@Override
|
@Override
|
||||||
protected void onClick() {
|
protected void onClick() {
|
||||||
super.onClick();
|
super.onClick();
|
||||||
SPDSettings.fullscreen(checked());
|
SPDSettings.fullscreen(checked());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
chkFullscreen.setRect( 0, chkFlipTags.bottom() + GAP_SML, WIDTH, BTN_HEIGHT );
|
|
||||||
chkFullscreen.checked(SPDSettings.fullscreen());
|
chkFullscreen.checked(SPDSettings.fullscreen());
|
||||||
chkFullscreen.enable(DeviceCompat.supportsFullScreen());
|
chkFullscreen.enable(DeviceCompat.supportsFullScreen());
|
||||||
add(chkFullscreen);
|
add(chkFullscreen);
|
||||||
|
|
||||||
CheckBox chkFont = new CheckBox(Messages.get(this, "system_font")){
|
chkFont = new CheckBox(Messages.get(this, "system_font")){
|
||||||
@Override
|
@Override
|
||||||
protected void onClick() {
|
protected void onClick() {
|
||||||
super.onClick();
|
super.onClick();
|
||||||
|
@ -304,12 +322,12 @@ public class WndSettings extends WndTabbed {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
chkFont.setRect(0, chkFullscreen.bottom() + GAP_TINY, WIDTH, BTN_HEIGHT);
|
|
||||||
chkFont.checked(SPDSettings.systemFont());
|
chkFont.checked(SPDSettings.systemFont());
|
||||||
add(chkFont);
|
add(chkFont);
|
||||||
|
|
||||||
if (DeviceCompat.hasHardKeyboard()){
|
if (DeviceCompat.hasHardKeyboard()){
|
||||||
RedButton btnKeyBindings = new RedButton(Messages.get(this, "key_bindings")){
|
btnKeyBindings = new RedButton(Messages.get(this, "key_bindings")){
|
||||||
@Override
|
@Override
|
||||||
protected void onClick() {
|
protected void onClick() {
|
||||||
super.onClick();
|
super.onClick();
|
||||||
|
@ -317,39 +335,67 @@ public class WndSettings extends WndTabbed {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
btnKeyBindings.setRect(0, chkFont.bottom() + GAP_SML, WIDTH, BTN_HEIGHT);
|
|
||||||
add(btnKeyBindings);
|
add(btnKeyBindings);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void layout() {
|
||||||
|
barDesc.setPos((width-barDesc.width())/2f, GAP_TINY);
|
||||||
|
PixelScene.align(barDesc);
|
||||||
|
|
||||||
|
int btnWidth = (int)(width - 2*GAP_TINY)/3;
|
||||||
|
btnSplit.setRect(0, barDesc.bottom() + GAP_TINY, btnWidth, 16);
|
||||||
|
btnGrouped.setRect(btnSplit.right()+GAP_TINY, btnSplit.top(), btnWidth, 16);
|
||||||
|
btnCentered.setRect(btnGrouped.right()+GAP_TINY, btnSplit.top(), btnWidth, 16);
|
||||||
|
|
||||||
|
chkFlipToolbar.setRect(0, btnGrouped.bottom() + GAP_TINY, width, BTN_HEIGHT);
|
||||||
|
chkFlipTags.setRect(0, chkFlipToolbar.bottom() + GAP_TINY, width, BTN_HEIGHT);
|
||||||
|
|
||||||
|
chkFullscreen.setRect(0, chkFlipTags.bottom() + GAP_SML, width, BTN_HEIGHT);
|
||||||
|
|
||||||
|
chkFont.setRect(0, chkFullscreen.bottom() + GAP_TINY, width, BTN_HEIGHT);
|
||||||
|
|
||||||
|
if (btnKeyBindings != null){
|
||||||
|
btnKeyBindings.setRect(0, chkFont.bottom() + GAP_SML, width, BTN_HEIGHT);
|
||||||
|
height = btnKeyBindings.bottom();
|
||||||
|
} else {
|
||||||
|
height = chkFont.bottom();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class AudioTab extends Group {
|
}
|
||||||
|
|
||||||
public AudioTab() {
|
private class AudioTab extends Component {
|
||||||
OptionSlider musicVol = new OptionSlider(Messages.get(this, "music_vol"), "0", "10", 0, 10) {
|
|
||||||
|
OptionSlider optMusic;
|
||||||
|
CheckBox chkMusicMute;
|
||||||
|
|
||||||
|
OptionSlider optSFX;
|
||||||
|
CheckBox chkMuteSFX;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void createChildren() {
|
||||||
|
optMusic = new OptionSlider(Messages.get(this, "music_vol"), "0", "10", 0, 10) {
|
||||||
@Override
|
@Override
|
||||||
protected void onChange() {
|
protected void onChange() {
|
||||||
SPDSettings.musicVol(getSelectedValue());
|
SPDSettings.musicVol(getSelectedValue());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
musicVol.setSelectedValue(SPDSettings.musicVol());
|
optMusic.setSelectedValue(SPDSettings.musicVol());
|
||||||
musicVol.setRect(0, 0, WIDTH, SLIDER_HEIGHT);
|
add(optMusic);
|
||||||
add(musicVol);
|
|
||||||
|
|
||||||
CheckBox musicMute = new CheckBox(Messages.get(this, "music_mute")){
|
chkMusicMute = new CheckBox(Messages.get(this, "music_mute")){
|
||||||
@Override
|
@Override
|
||||||
protected void onClick() {
|
protected void onClick() {
|
||||||
super.onClick();
|
super.onClick();
|
||||||
SPDSettings.music(!checked());
|
SPDSettings.music(!checked());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
musicMute.setRect(0, musicVol.bottom() + GAP_TINY, WIDTH, BTN_HEIGHT);
|
chkMusicMute.checked(!SPDSettings.music());
|
||||||
musicMute.checked(!SPDSettings.music());
|
add(chkMusicMute);
|
||||||
add(musicMute);
|
|
||||||
|
|
||||||
|
optSFX = new OptionSlider(Messages.get(this, "sfx_vol"), "0", "10", 0, 10) {
|
||||||
OptionSlider SFXVol = new OptionSlider(Messages.get(this, "sfx_vol"), "0", "10", 0, 10) {
|
|
||||||
@Override
|
@Override
|
||||||
protected void onChange() {
|
protected void onChange() {
|
||||||
SPDSettings.SFXVol(getSelectedValue());
|
SPDSettings.SFXVol(getSelectedValue());
|
||||||
|
@ -365,11 +411,10 @@ public class WndSettings extends WndTabbed {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
SFXVol.setSelectedValue(SPDSettings.SFXVol());
|
optSFX.setSelectedValue(SPDSettings.SFXVol());
|
||||||
SFXVol.setRect(0, musicMute.bottom() + GAP_LRG, WIDTH, SLIDER_HEIGHT);
|
add(optSFX);
|
||||||
add(SFXVol);
|
|
||||||
|
|
||||||
CheckBox btnSound = new CheckBox( Messages.get(this, "sfx_mute") ) {
|
chkMuteSFX = new CheckBox( Messages.get(this, "sfx_mute") ) {
|
||||||
@Override
|
@Override
|
||||||
protected void onClick() {
|
protected void onClick() {
|
||||||
super.onClick();
|
super.onClick();
|
||||||
|
@ -377,11 +422,19 @@ public class WndSettings extends WndTabbed {
|
||||||
Sample.INSTANCE.play( Assets.Sounds.CLICK );
|
Sample.INSTANCE.play( Assets.Sounds.CLICK );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
btnSound.setRect(0, SFXVol.bottom() + GAP_TINY, WIDTH, BTN_HEIGHT);
|
chkMuteSFX.checked(!SPDSettings.soundFx());
|
||||||
btnSound.checked(!SPDSettings.soundFx());
|
add( chkMuteSFX );
|
||||||
add( btnSound );
|
}
|
||||||
|
|
||||||
resize( WIDTH, (int)btnSound.bottom());
|
@Override
|
||||||
|
protected void layout() {
|
||||||
|
optMusic.setRect(0, 0, width, SLIDER_HEIGHT);
|
||||||
|
chkMusicMute.setRect(0, optMusic.bottom() + GAP_TINY, width, BTN_HEIGHT);
|
||||||
|
|
||||||
|
optSFX.setRect(0, chkMusicMute.bottom() + GAP_LRG, width, SLIDER_HEIGHT);
|
||||||
|
chkMuteSFX.setRect(0, optSFX.bottom() + GAP_TINY, width, BTN_HEIGHT);
|
||||||
|
|
||||||
|
height = chkMuteSFX.bottom();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user