v0.8.0: streamlined some settings in the settings menu:

- removed quickslot selection, now always 4. Tweaked quickslot layout
- adjusted brightness, now 3 settings instead of 5
- adjusted visual grid, now 4 settings instead of 5
This commit is contained in:
Evan Debenham 2019-11-15 20:22:20 -05:00
parent 1d7bf8cfc9
commit ca0578a213
5 changed files with 104 additions and 110 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 186 B

After

Width:  |  Height:  |  Size: 158 B

View File

@ -111,7 +111,7 @@ public class SPDSettings extends GameSettings {
} }
public static int brightness() { public static int brightness() {
return getInt( KEY_BRIGHTNESS, 0, -2, 2 ); return getInt( KEY_BRIGHTNESS, 0, -1, 1 );
} }
public static void visualGrid( int value ){ public static void visualGrid( int value ){
@ -120,7 +120,7 @@ public class SPDSettings extends GameSettings {
} }
public static int visualGrid() { public static int visualGrid() {
return getInt( KEY_GRID, 0, -1, 3 ); return getInt( KEY_GRID, 0, -1, 2 );
} }
//Interface //Interface

View File

@ -37,24 +37,24 @@ public class FogOfWar extends Image {
//first index is visibility type, second is brightness level //first index is visibility type, second is brightness level
private static final int FOG_COLORS[][] = new int[][]{{ private static final int FOG_COLORS[][] = new int[][]{{
//visible //visible
0x55000000, 0x00000000, //-2 and -1 brightness 0x00000000, //-1 brightness
0x00000000, //0 brightness 0x00000000, //0 brightness
0x00000000, 0x00000000 //1 and 2 brightness 0x00000000, //1 brightness
}, { }, {
//visited //visited
0xDD000000, 0xBB000000, 0xCC000000,
0x99000000, 0x99000000,
0x77000000, 0x55000000 0x55000000
}, { }, {
//mapped //mapped
0xDD221108, 0xBB442211, 0xCC442211,
0x99663319, 0x99663319,
0x77884411, 0x55AA552A 0x55884422
}, { }, {
//invisible //invisible
0xFF000000, 0xFF000000,
0xFF000000, 0xFF000000,
0xFF000000, 0xFF000000 0xFF000000,
0xFF000000
}}; }};
private static final int VISIBLE = 0; private static final int VISIBLE = 0;
@ -170,7 +170,7 @@ public class FogOfWar extends Image {
this.visible = visible; this.visible = visible;
this.visited = visited; this.visited = visited;
this.mapped = mapped; this.mapped = mapped;
this.brightness = SPDSettings.brightness() + 2; this.brightness = SPDSettings.brightness() + 1;
moveToUpdating(); moveToUpdating();

View File

@ -73,6 +73,13 @@ public class Toolbar extends Component {
@Override @Override
protected void createChildren() { protected void createChildren() {
btnQuick = new QuickslotTool[4];
add( btnQuick[3] = new QuickslotTool(64, 0, 22, 24, 3) );
add( btnQuick[2] = new QuickslotTool(64, 0, 22, 24, 2) );
add( btnQuick[1] = new QuickslotTool(64, 0, 22, 24, 1) );
add( btnQuick[0] = new QuickslotTool(64, 0, 22, 24, 0) );
add(btnWait = new Tool(24, 0, 20, 26) { add(btnWait = new Tool(24, 0, 20, 26) {
@Override @Override
protected void onClick() { protected void onClick() {
@ -116,16 +123,6 @@ public class Toolbar extends Component {
} }
}); });
btnQuick = new QuickslotTool[4];
add( btnQuick[3] = new QuickslotTool( 64, 0, 22, 24, 3) );
add( btnQuick[2] = new QuickslotTool( 64, 0, 22, 24, 2) );
add(btnQuick[1] = new QuickslotTool(64, 0, 22, 24, 1));
add(btnQuick[0] = new QuickslotTool(64, 0, 22, 24, 0));
add(btnInventory = new Tool(0, 0, 24, 26) { add(btnInventory = new Tool(0, 0, 24, 26) {
private GoldIndicator gold; private GoldIndicator gold;
@ -166,44 +163,19 @@ public class Toolbar extends Component {
@Override @Override
protected void layout() { protected void layout() {
int[] visible = new int[4];
int slots = SPDSettings.quickSlots();
for(int i = 0; i <= 3; i++)
visible[i] = (int)((slots > i) ? y+2 : y+25);
for(int i = 0; i <= 3; i++) { for(int i = 0; i <= 3; i++) {
btnQuick[i].visible = btnQuick[i].active = slots > i; if (i == 0 && !SPDSettings.flipToolbar() ||
//decides on quickslot layout, depending on available screen size. i == 3 && SPDSettings.flipToolbar()){
if (slots == 4 && width < 152){ btnQuick[i].border(0, 2);
if (width < 138){ btnQuick[i].frame(106, 0, 19, 24);
if ((SPDSettings.flipToolbar() && i == 3) || } else if (i == 0 && SPDSettings.flipToolbar() ||
(!SPDSettings.flipToolbar() && i == 0)) { i == 3 && !SPDSettings.flipToolbar()){
btnQuick[i].border(0, 0); btnQuick[i].border(2, 1);
btnQuick[i].frame(88, 0, 17, 24); btnQuick[i].frame(86, 0, 20, 24);
} else {
btnQuick[i].border(0, 1);
btnQuick[i].frame(88, 0, 18, 24);
}
} else {
if (i == 0 && !SPDSettings.flipToolbar() ||
i == 3 && SPDSettings.flipToolbar()){
btnQuick[i].border(0, 2);
btnQuick[i].frame(106, 0, 19, 24);
} else if (i == 0 && SPDSettings.flipToolbar() ||
i == 3 && !SPDSettings.flipToolbar()){
btnQuick[i].border(2, 1);
btnQuick[i].frame(86, 0, 20, 24);
} else {
btnQuick[i].border(0, 1);
btnQuick[i].frame(88, 0, 18, 24);
}
}
} else { } else {
btnQuick[i].border(2, 2); btnQuick[i].border(0, 1);
btnQuick[i].frame(64, 0, 22, 24); btnQuick[i].frame(88, 0, 18, 24);
} }
} }
float right = width; float right = width;
@ -214,10 +186,19 @@ public class Toolbar extends Component {
btnInventory.setPos(right - btnInventory.width(), y); btnInventory.setPos(right - btnInventory.width(), y);
btnQuick[0].setPos(btnInventory.left() - btnQuick[0].width(), visible[0]); btnQuick[0].setPos(btnInventory.left() - btnQuick[0].width(), y+2);
btnQuick[1].setPos(btnQuick[0].left() - btnQuick[1].width(), visible[1]); btnQuick[1].setPos(btnQuick[0].left() - btnQuick[1].width(), y+2);
btnQuick[2].setPos(btnQuick[1].left() - btnQuick[2].width(), visible[2]); btnQuick[2].setPos(btnQuick[1].left() - btnQuick[2].width(), y+2);
btnQuick[3].setPos(btnQuick[2].left() - btnQuick[3].width(), visible[3]); btnQuick[3].setPos(btnQuick[2].left() - btnQuick[3].width(), y+2);
//center the quickslots if they
if (btnQuick[3].left() < btnSearch.right()){
float diff = Math.round(btnSearch.right() - btnQuick[3].left())/2;
for( int i = 0; i < 4; i++){
btnQuick[i].setPos( btnQuick[i].left()+diff, btnQuick[i].top() );
}
}
break; break;
//center = group but.. well.. centered, so all we need to do is pre-emptively set the right side further in. //center = group but.. well.. centered, so all we need to do is pre-emptively set the right side further in.
@ -233,10 +214,18 @@ public class Toolbar extends Component {
btnSearch.setPos(btnWait.left() - btnSearch.width(), y); btnSearch.setPos(btnWait.left() - btnSearch.width(), y);
btnInventory.setPos(btnSearch.left() - btnInventory.width(), y); btnInventory.setPos(btnSearch.left() - btnInventory.width(), y);
btnQuick[0].setPos(btnInventory.left() - btnQuick[0].width(), visible[0]); btnQuick[0].setPos(btnInventory.left() - btnQuick[0].width(), y+2);
btnQuick[1].setPos(btnQuick[0].left() - btnQuick[1].width(), visible[1]); btnQuick[1].setPos(btnQuick[0].left() - btnQuick[1].width(), y+2);
btnQuick[2].setPos(btnQuick[1].left() - btnQuick[2].width(), visible[2]); btnQuick[2].setPos(btnQuick[1].left() - btnQuick[2].width(), y+2);
btnQuick[3].setPos(btnQuick[2].left() - btnQuick[3].width(), visible[3]); btnQuick[3].setPos(btnQuick[2].left() - btnQuick[3].width(), y+2);
if (btnQuick[3].left() < 0){
float diff = -Math.round(btnQuick[3].left())/2;
for( int i = 0; i < 4; i++){
btnQuick[i].setPos( btnQuick[i].left()+diff, btnQuick[i].top() );
}
}
break; break;
} }
right = width; right = width;
@ -248,7 +237,7 @@ public class Toolbar extends Component {
btnInventory.setPos( (right - btnInventory.right()), y); btnInventory.setPos( (right - btnInventory.right()), y);
for(int i = 0; i <= 3; i++) { for(int i = 0; i <= 3; i++) {
btnQuick[i].setPos( right - btnQuick[i].right(), visible[i]); btnQuick[i].setPos( right - btnQuick[i].right(), y+2);
} }
} }

View File

@ -125,61 +125,67 @@ public class WndSettings extends WndTabbed {
add(scale); add(scale);
} }
CheckBox chkSaver = new CheckBox( Messages.get(this, "saver") ) { float bottom = scale.bottom();
@Override
protected void onClick() { if (!DeviceCompat.isDesktop()) {
super.onClick(); CheckBox chkSaver = new CheckBox( Messages.get( this, "saver" ) ) {
if (checked()) { @Override
checked(!checked()); protected void onClick() {
ShatteredPixelDungeon.scene().add(new WndOptions( super.onClick();
Messages.get(DisplayTab.class, "saver"), if (checked()) {
Messages.get(DisplayTab.class, "saver_desc"), checked( !checked() );
Messages.get(DisplayTab.class, "okay"), ShatteredPixelDungeon.scene().add( new WndOptions(
Messages.get(DisplayTab.class, "cancel")) { Messages.get( DisplayTab.class, "saver" ),
@Override Messages.get( DisplayTab.class, "saver_desc" ),
protected void onSelect(int index) { Messages.get( DisplayTab.class, "okay" ),
if (index == 0) { Messages.get( DisplayTab.class, "cancel" ) ) {
checked(!checked()); @Override
SPDSettings.powerSaver(checked()); protected void onSelect( int index ) {
if (index == 0) {
checked( !checked() );
SPDSettings.powerSaver( checked() );
}
} }
} } );
}); } else {
} else { SPDSettings.powerSaver( checked() );
SPDSettings.powerSaver(checked()); }
} }
};
if (PixelScene.maxScreenZoom >= 2) {
chkSaver.setRect( 0, scale.bottom() + GAP_TINY, WIDTH, BTN_HEIGHT );
chkSaver.checked( SPDSettings.powerSaver() );
add( chkSaver );
} }
};
if (PixelScene.maxScreenZoom >= 2) { //TODO also need to disable this in android splitscreen
chkSaver.setRect(0, scale.bottom() + GAP_TINY, WIDTH, BTN_HEIGHT); RedButton btnOrientation = new RedButton( PixelScene.landscape() ?
chkSaver.checked(SPDSettings.powerSaver()); Messages.get( this, "portrait" )
add(chkSaver); : Messages.get( this, "landscape" ) ) {
@Override
protected void onClick() {
SPDSettings.landscape( !PixelScene.landscape() );
}
};
btnOrientation.setRect( 0, chkSaver.bottom() + GAP_TINY, WIDTH, BTN_HEIGHT );
add( btnOrientation );
bottom = btnOrientation.bottom();
} }
//TODO need to disable this in some situations. (desktop, android splitscreen)
RedButton btnOrientation = new RedButton( PixelScene.landscape() ?
Messages.get(this, "portrait")
: Messages.get(this, "landscape") ) {
@Override
protected void onClick() {
SPDSettings.landscape(!PixelScene.landscape());
}
};
btnOrientation.setRect(0, chkSaver.bottom() + GAP_TINY, WIDTH, BTN_HEIGHT);
add( btnOrientation );
OptionSlider brightness = new OptionSlider(Messages.get(this, "brightness"), OptionSlider brightness = new OptionSlider(Messages.get(this, "brightness"),
Messages.get(this, "dark"), Messages.get(this, "bright"), -2, 2) { 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()); brightness.setSelectedValue(SPDSettings.brightness());
brightness.setRect(0, btnOrientation.bottom() + GAP_LRG, WIDTH, SLIDER_HEIGHT); brightness.setRect(0, bottom + GAP_LRG, WIDTH, SLIDER_HEIGHT);
add(brightness); add(brightness);
OptionSlider tileGrid = new OptionSlider(Messages.get(this, "visual_grid"), OptionSlider tileGrid = new OptionSlider(Messages.get(this, "visual_grid"),
Messages.get(this, "off"), Messages.get(this, "high"), -1, 3) { Messages.get(this, "off"), Messages.get(this, "high"), -1, 2) {
@Override @Override
protected void onChange() { protected void onChange() {
SPDSettings.visualGrid(getSelectedValue()); SPDSettings.visualGrid(getSelectedValue());
@ -189,7 +195,6 @@ public class WndSettings extends WndTabbed {
tileGrid.setRect(0, brightness.bottom() + GAP_TINY, WIDTH, SLIDER_HEIGHT); tileGrid.setRect(0, brightness.bottom() + GAP_TINY, WIDTH, SLIDER_HEIGHT);
add(tileGrid); add(tileGrid);
} }
} }
@ -257,7 +262,7 @@ public class WndSettings extends WndTabbed {
chkFlipTags.checked(SPDSettings.flipTags()); chkFlipTags.checked(SPDSettings.flipTags());
add(chkFlipTags); add(chkFlipTags);
OptionSlider slots = new OptionSlider(Messages.get(this, "quickslots"), "0", "4", 0, 4) { /*OptionSlider slots = new OptionSlider(Messages.get(this, "quickslots"), "0", "4", 0, 4) {
@Override @Override
protected void onChange() { protected void onChange() {
SPDSettings.quickSlots(getSelectedValue()); SPDSettings.quickSlots(getSelectedValue());
@ -266,7 +271,7 @@ public class WndSettings extends WndTabbed {
}; };
slots.setSelectedValue(SPDSettings.quickSlots()); slots.setSelectedValue(SPDSettings.quickSlots());
slots.setRect(0, chkFlipTags.bottom() + GAP_TINY, WIDTH, SLIDER_HEIGHT); slots.setRect(0, chkFlipTags.bottom() + GAP_TINY, WIDTH, SLIDER_HEIGHT);
add(slots); add(slots);*/
CheckBox chkFullscreen = new CheckBox( Messages.get(this, "fullscreen") ) { CheckBox chkFullscreen = new CheckBox( Messages.get(this, "fullscreen") ) {
@Override @Override
@ -275,7 +280,7 @@ public class WndSettings extends WndTabbed {
SPDSettings.fullscreen(checked()); SPDSettings.fullscreen(checked());
} }
}; };
chkFullscreen.setRect( 0, slots.bottom() + GAP_SML, WIDTH, BTN_HEIGHT ); chkFullscreen.setRect( 0, chkFlipTags.bottom() + GAP_LRG, WIDTH, BTN_HEIGHT );
chkFullscreen.checked(SPDSettings.fullscreen()); chkFullscreen.checked(SPDSettings.fullscreen());
chkFullscreen.enable(DeviceCompat.supportsFullScreen()); chkFullscreen.enable(DeviceCompat.supportsFullScreen());
add(chkFullscreen); add(chkFullscreen);