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() {
return getInt( KEY_BRIGHTNESS, 0, -2, 2 );
return getInt( KEY_BRIGHTNESS, 0, -1, 1 );
}
public static void visualGrid( int value ){
@ -120,7 +120,7 @@ public class SPDSettings extends GameSettings {
}
public static int visualGrid() {
return getInt( KEY_GRID, 0, -1, 3 );
return getInt( KEY_GRID, 0, -1, 2 );
}
//Interface

View File

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

View File

@ -73,6 +73,13 @@ public class Toolbar extends Component {
@Override
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) {
@Override
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) {
private GoldIndicator gold;
@ -166,44 +163,19 @@ public class Toolbar extends Component {
@Override
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++) {
btnQuick[i].visible = btnQuick[i].active = slots > i;
//decides on quickslot layout, depending on available screen size.
if (slots == 4 && width < 152){
if (width < 138){
if ((SPDSettings.flipToolbar() && i == 3) ||
(!SPDSettings.flipToolbar() && i == 0)) {
btnQuick[i].border(0, 0);
btnQuick[i].frame(88, 0, 17, 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);
}
}
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(2, 2);
btnQuick[i].frame(64, 0, 22, 24);
btnQuick[i].border(0, 1);
btnQuick[i].frame(88, 0, 18, 24);
}
}
float right = width;
@ -214,10 +186,19 @@ public class Toolbar extends Component {
btnInventory.setPos(right - btnInventory.width(), y);
btnQuick[0].setPos(btnInventory.left() - btnQuick[0].width(), visible[0]);
btnQuick[1].setPos(btnQuick[0].left() - btnQuick[1].width(), visible[1]);
btnQuick[2].setPos(btnQuick[1].left() - btnQuick[2].width(), visible[2]);
btnQuick[3].setPos(btnQuick[2].left() - btnQuick[3].width(), visible[3]);
btnQuick[0].setPos(btnInventory.left() - btnQuick[0].width(), y+2);
btnQuick[1].setPos(btnQuick[0].left() - btnQuick[1].width(), y+2);
btnQuick[2].setPos(btnQuick[1].left() - btnQuick[2].width(), y+2);
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;
//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);
btnInventory.setPos(btnSearch.left() - btnInventory.width(), y);
btnQuick[0].setPos(btnInventory.left() - btnQuick[0].width(), visible[0]);
btnQuick[1].setPos(btnQuick[0].left() - btnQuick[1].width(), visible[1]);
btnQuick[2].setPos(btnQuick[1].left() - btnQuick[2].width(), visible[2]);
btnQuick[3].setPos(btnQuick[2].left() - btnQuick[3].width(), visible[3]);
btnQuick[0].setPos(btnInventory.left() - btnQuick[0].width(), y+2);
btnQuick[1].setPos(btnQuick[0].left() - btnQuick[1].width(), y+2);
btnQuick[2].setPos(btnQuick[1].left() - btnQuick[2].width(), y+2);
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;
}
right = width;
@ -248,7 +237,7 @@ public class Toolbar extends Component {
btnInventory.setPos( (right - btnInventory.right()), y);
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);
}
CheckBox chkSaver = new CheckBox( Messages.get(this, "saver") ) {
@Override
protected void onClick() {
super.onClick();
if (checked()) {
checked(!checked());
ShatteredPixelDungeon.scene().add(new WndOptions(
Messages.get(DisplayTab.class, "saver"),
Messages.get(DisplayTab.class, "saver_desc"),
Messages.get(DisplayTab.class, "okay"),
Messages.get(DisplayTab.class, "cancel")) {
@Override
protected void onSelect(int index) {
if (index == 0) {
checked(!checked());
SPDSettings.powerSaver(checked());
float bottom = scale.bottom();
if (!DeviceCompat.isDesktop()) {
CheckBox chkSaver = new CheckBox( Messages.get( this, "saver" ) ) {
@Override
protected void onClick() {
super.onClick();
if (checked()) {
checked( !checked() );
ShatteredPixelDungeon.scene().add( new WndOptions(
Messages.get( DisplayTab.class, "saver" ),
Messages.get( DisplayTab.class, "saver_desc" ),
Messages.get( DisplayTab.class, "okay" ),
Messages.get( DisplayTab.class, "cancel" ) ) {
@Override
protected void onSelect( int index ) {
if (index == 0) {
checked( !checked() );
SPDSettings.powerSaver( checked() );
}
}
}
});
} else {
SPDSettings.powerSaver(checked());
} );
} else {
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) {
chkSaver.setRect(0, scale.bottom() + GAP_TINY, WIDTH, BTN_HEIGHT);
chkSaver.checked(SPDSettings.powerSaver());
add(chkSaver);
//TODO also need to disable this in 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 );
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"),
Messages.get(this, "dark"), Messages.get(this, "bright"), -2, 2) {
Messages.get(this, "dark"), Messages.get(this, "bright"), -1, 1) {
@Override
protected void onChange() {
SPDSettings.brightness(getSelectedValue());
}
};
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);
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
protected void onChange() {
SPDSettings.visualGrid(getSelectedValue());
@ -189,7 +195,6 @@ public class WndSettings extends WndTabbed {
tileGrid.setRect(0, brightness.bottom() + GAP_TINY, WIDTH, SLIDER_HEIGHT);
add(tileGrid);
}
}
@ -257,7 +262,7 @@ public class WndSettings extends WndTabbed {
chkFlipTags.checked(SPDSettings.flipTags());
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
protected void onChange() {
SPDSettings.quickSlots(getSelectedValue());
@ -266,7 +271,7 @@ public class WndSettings extends WndTabbed {
};
slots.setSelectedValue(SPDSettings.quickSlots());
slots.setRect(0, chkFlipTags.bottom() + GAP_TINY, WIDTH, SLIDER_HEIGHT);
add(slots);
add(slots);*/
CheckBox chkFullscreen = new CheckBox( Messages.get(this, "fullscreen") ) {
@Override
@ -275,7 +280,7 @@ public class WndSettings extends WndTabbed {
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.enable(DeviceCompat.supportsFullScreen());
add(chkFullscreen);