Merging 1.9.1 source: window changes

This commit is contained in:
Evan Debenham
2015-11-10 02:15:11 -05:00
parent 46a0f2b319
commit e35573883b
6 changed files with 33 additions and 69 deletions
@@ -21,10 +21,9 @@
package com.shatteredpixel.shatteredpixeldungeon.windows;
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
import com.watabou.noosa.BitmapTextMultiline;
import com.shatteredpixel.shatteredpixeldungeon.ui.HighlightedText;
import com.watabou.noosa.Image;
import com.watabou.noosa.ui.Component;
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
public class WndTitledMessage extends Window {
@@ -40,37 +39,19 @@ public class WndTitledMessage extends Window {
}
public WndTitledMessage( Component titlebar, String message ) {
super();
int width = ShatteredPixelDungeon.landscape() ? WIDTH_L : WIDTH_P;
titlebar.setRect( 0, 0, width, 0 );
add( titlebar );
Highlighter hl = new Highlighter( message );
add(titlebar);
BitmapTextMultiline normal = PixelScene.createMultiline(hl.text, 6);
normal.maxWidth = width;
normal.measure();
normal.x = titlebar.left();
normal.y = titlebar.bottom() + GAP;
add(normal);
if (hl.isHighlighted()) {
normal.mask = hl.inverted();
HighlightedText text = new HighlightedText( 6 );
text.text( message, width );
text.setPos( titlebar.left(), titlebar.bottom() + GAP );
add( text );
BitmapTextMultiline highlighted = PixelScene.createMultiline(hl.text, 6);
highlighted.maxWidth = normal.maxWidth;
highlighted.measure();
highlighted.x = normal.x;
highlighted.y = normal.y;
add(highlighted);
highlighted.mask = hl.mask;
highlighted.hardlight(TITLE_COLOR);
}
resize( width, (int)(normal.y + normal.height()) );
resize( width, (int)text.bottom() );
}
}