From 810ce1b8e49fa686f5880b68a38d1e3bed73828d Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Sat, 21 Feb 2015 21:07:30 -0500 Subject: [PATCH] v0.2.4: tweaked some windows --- .../windows/WndInfoPlant.java | 29 ++----------------- .../windows/WndStory.java | 10 +++++-- 2 files changed, 10 insertions(+), 29 deletions(-) diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndInfoPlant.java b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndInfoPlant.java index a55c01398..cb6bb4f82 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndInfoPlant.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndInfoPlant.java @@ -17,37 +17,14 @@ */ package com.shatteredpixel.shatteredpixeldungeon.windows; -import com.watabou.noosa.BitmapTextMultiline; import com.shatteredpixel.shatteredpixeldungeon.plants.Plant; -import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene; import com.shatteredpixel.shatteredpixeldungeon.sprites.PlantSprite; -import com.shatteredpixel.shatteredpixeldungeon.ui.Window; -public class WndInfoPlant extends Window { - - private static final float GAP = 2; - - private static final int WIDTH = 120; +public class WndInfoPlant extends WndTitledMessage { public WndInfoPlant( Plant plant ) { - super(); - - IconTitle titlebar = new IconTitle(); - titlebar.icon( new PlantSprite( plant.image ) ); - titlebar.label( plant.plantName ); - titlebar.setRect( 0, 0, WIDTH, 0 ); - add( titlebar ); - - BitmapTextMultiline info = PixelScene.createMultiline( 6 ); - add( info ); - - info.text( plant.desc() ); - info.maxWidth = WIDTH; - info.measure(); - info.x = titlebar.left(); - info.y = titlebar.bottom() + GAP; - - resize( WIDTH, (int)(info.y + info.height()) ); + super(new PlantSprite( plant.image ), plant.plantName, plant.desc()); + } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndStory.java b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndStory.java index 67b2d4f25..d01cf4709 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndStory.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndStory.java @@ -17,6 +17,7 @@ */ package com.shatteredpixel.shatteredpixeldungeon.windows; +import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; import com.watabou.input.Touchscreen.Touch; import com.watabou.noosa.BitmapTextMultiline; import com.watabou.noosa.Game; @@ -29,8 +30,9 @@ import com.watabou.utils.SparseArray; public class WndStory extends Window { - private static final int WIDTH = 120; - private static final int MARGIN = 6; + private static final int WIDTH_P = 120; + private static final int WIDTH_L = 144; + private static final int MARGIN = 6; private static final float bgR = 0.77f; private static final float bgG = 0.73f; @@ -83,7 +85,9 @@ public class WndStory extends Window { super( 0, 0, Chrome.get( Chrome.Type.SCROLL ) ); tf = PixelScene.createMultiline( text, 7 ); - tf.maxWidth = WIDTH - MARGIN * 2; + tf.maxWidth = ShatteredPixelDungeon.landscape() ? + WIDTH_L - MARGIN * 2: + WIDTH_P - MARGIN *2; tf.measure(); tf.ra = bgR; tf.ga = bgG;