diff --git a/core/src/main/assets/visual_grid.png b/core/src/main/assets/visual_grid.png index 4f513567e..d659ff323 100644 Binary files a/core/src/main/assets/visual_grid.png and b/core/src/main/assets/visual_grid.png differ diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/SPDSettings.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/SPDSettings.java index ed27d92c8..6665c8c39 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/SPDSettings.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/SPDSettings.java @@ -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 diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/tiles/FogOfWar.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/tiles/FogOfWar.java index db9dda3c3..5819c6c44 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/tiles/FogOfWar.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/tiles/FogOfWar.java @@ -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(); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/Toolbar.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/Toolbar.java index a706f11c4..8f2152ac1 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/Toolbar.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/Toolbar.java @@ -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() { @@ -115,16 +122,6 @@ public class Toolbar extends Component { return true; } }); - - 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); } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndSettings.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndSettings.java index a593d8c2a..129e7f07f 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndSettings.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndSettings.java @@ -124,62 +124,68 @@ public class WndSettings extends WndTabbed { scale.setRect(0, 0, WIDTH, SLIDER_HEIGHT); add(scale); } + + float bottom = scale.bottom(); - 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()); + 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);