diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/Preferences.java b/src/com/shatteredpixel/shatteredpixeldungeon/Preferences.java index 1eb023ec8..5dad37002 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/Preferences.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/Preferences.java @@ -39,7 +39,8 @@ enum Preferences { public static final String KEY_LAST_CLASS = "last_class"; public static final String KEY_CHALLENGES = "challenges"; public static final String KEY_QUICKSLOTS = "quickslots"; - public static final String KEY_FLIPPEDUI = "flipped_ui"; + public static final String KEY_FLIPTOOLBAR = "flipped_ui"; + public static final String KEY_FLIPTAGS = "flip_tags"; public static final String KEY_BARMODE = "toolbar_mode"; public static final String KEY_INTRO = "intro"; public static final String KEY_BRIGHTNESS = "brightness"; diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/ShatteredPixelDungeon.java b/src/com/shatteredpixel/shatteredpixeldungeon/ShatteredPixelDungeon.java index a378bd37e..ac3e615ee 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/ShatteredPixelDungeon.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/ShatteredPixelDungeon.java @@ -337,10 +337,17 @@ public class ShatteredPixelDungeon extends Game { public static int quickSlots(){ return Preferences.INSTANCE.getInt( Preferences.KEY_QUICKSLOTS, 4); } - public static void flippedUI( boolean value) { - Preferences.INSTANCE.put(Preferences.KEY_FLIPPEDUI, value ); } + public static void flipToolbar( boolean value) { + Preferences.INSTANCE.put(Preferences.KEY_FLIPTOOLBAR, value ); + } - public static boolean flippedUI(){ return Preferences.INSTANCE.getBoolean(Preferences.KEY_FLIPPEDUI, false); } + public static boolean flipToolbar(){ return Preferences.INSTANCE.getBoolean(Preferences.KEY_FLIPTOOLBAR, false); } + + public static void flipTags( boolean value) { + Preferences.INSTANCE.put(Preferences.KEY_FLIPTAGS, value ); + } + + public static boolean flipTags(){ return Preferences.INSTANCE.getBoolean(Preferences.KEY_FLIPTAGS, false); } public static void toolbarMode( String value ) { Preferences.INSTANCE.put( Preferences.KEY_BARMODE, value ); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java b/src/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java index 131ff77e8..44858c3ba 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java @@ -240,9 +240,6 @@ public class GameScene extends PixelScene { attack = new AttackIndicator(); attack.camera = uiCamera; - attack.setPos( - uiCamera.width - attack.width(), - toolbar.top() - attack.height() ); add( attack ); loot = new LootIndicator(); @@ -253,12 +250,11 @@ public class GameScene extends PixelScene { resume.camera = uiCamera; add( resume ); - layoutTags(); - log = new GameLog(); log.camera = uiCamera; - log.setRect( 0, toolbar.top(), attack.left(), 0 ); add( log ); + + layoutTags(); if (Dungeon.depth < Statistics.deepestFloor) { GLog.i(TXT_WELCOME_BACK, Dungeon.depth); @@ -410,17 +406,33 @@ public class GameScene extends PixelScene { private boolean tagLoot = false; private boolean tagResume = false; - private void layoutTags() { + public static void layoutTags() { - float pos = tagAttack ? attack.top() : toolbar.top(); + float tagLeft = ShatteredPixelDungeon.flipTags() ? 0 : uiCamera.width - scene.attack.width(); - if (tagLoot) { - loot.setPos( uiCamera.width - loot.width(), pos - loot.height() ); - pos = loot.top(); + if (ShatteredPixelDungeon.flipTags()) { + scene.log.setRect(scene.attack.width(), scene.toolbar.top(), uiCamera.width - scene.attack.width(), 0); + } else { + scene.log.setRect(0, scene.toolbar.top(), scene.attack.left(), 0 ); } - if (tagResume) { - resume.setPos( uiCamera.width - resume.width(), pos - resume.height() ); + float pos = scene.toolbar.top(); + + if (scene.tagAttack){ + scene.attack.setPos( tagLeft, pos - scene.attack.height()); + scene.attack.flip(tagLeft == 0); + pos = scene.attack.top(); + } + + if (scene.tagLoot) { + scene.loot.setPos( tagLeft, pos - scene.loot.height() ); + scene.loot.flip(tagLeft == 0); + pos = scene.loot.top(); + } + + if (scene.tagResume) { + scene.resume.setPos( tagLeft, pos - scene.resume.height() ); + scene.resume.flip(tagLeft == 0); } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/ui/Tag.java b/src/com/shatteredpixel/shatteredpixeldungeon/ui/Tag.java index 19270f4de..5186cf755 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/ui/Tag.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/ui/Tag.java @@ -64,6 +64,10 @@ public class Tag extends Button { public void flash() { lightness = 1f; } + + public void flip(boolean value){ + bg.flipHorizontal(value); + } @Override public void update() { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/ui/Toolbar.java b/src/com/shatteredpixel/shatteredpixeldungeon/ui/Toolbar.java index e41b51a83..2e796bff2 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/ui/Toolbar.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/ui/Toolbar.java @@ -208,7 +208,7 @@ public class Toolbar extends Component { } right = width; - if (ShatteredPixelDungeon.flippedUI()) { + if (ShatteredPixelDungeon.flipToolbar()) { btnWait.setPos( (right - btnWait.right()), y); btnSearch.setPos( (right - btnSearch.right()), y); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndSettings.java b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndSettings.java index 41d93d31e..589de0a8c 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndSettings.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndSettings.java @@ -22,6 +22,7 @@ package com.shatteredpixel.shatteredpixeldungeon.windows; import com.shatteredpixel.shatteredpixeldungeon.Assets; import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; +import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene; import com.shatteredpixel.shatteredpixeldungeon.ui.CheckBox; import com.shatteredpixel.shatteredpixeldungeon.ui.OptionSlider; @@ -202,17 +203,29 @@ public class WndSettings extends WndTabbed { slots.setRect(0, btnGrouped.bottom() + GAP_LRG, WIDTH, SLIDER_HEIGHT); add(slots); - CheckBox chkFlip = new CheckBox("Flip Toolbar"){ + CheckBox chkFlipToolbar = new CheckBox("Flip Toolbar"){ @Override protected void onClick() { super.onClick(); - ShatteredPixelDungeon.flippedUI(checked()); + ShatteredPixelDungeon.flipToolbar(checked()); Toolbar.updateLayout(); } }; - chkFlip.setRect(0, slots.bottom() + GAP_LRG, WIDTH, BTN_HEIGHT); - chkFlip.checked(ShatteredPixelDungeon.flippedUI()); - add(chkFlip); + chkFlipToolbar.setRect(0, slots.bottom() + GAP_LRG, WIDTH, BTN_HEIGHT); + chkFlipToolbar.checked(ShatteredPixelDungeon.flipToolbar()); + add(chkFlipToolbar); + + CheckBox chkFlipTags = new CheckBox("Flip Indicators"){ + @Override + protected void onClick() { + super.onClick(); + ShatteredPixelDungeon.flipTags(checked()); + GameScene.layoutTags(); + } + }; + chkFlipTags.setRect(0, chkFlipToolbar.bottom() + GAP_SML, WIDTH, BTN_HEIGHT); + chkFlipTags.checked(ShatteredPixelDungeon.flipTags()); + add(chkFlipTags); } }