v0.3.2: added a window class for a forced notification

This commit is contained in:
Evan Debenham
2015-11-03 22:03:13 -05:00
parent 6cc42aa0fa
commit ca4f25fe49
2 changed files with 67 additions and 14 deletions
@@ -29,13 +29,10 @@ import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
public class WndTitledMessage extends Window {
private static final int WIDTH_P = 120;
private static final int WIDTH_L = 144;
private static final int GAP = 2;
private BitmapTextMultiline normal;
private BitmapTextMultiline highlighted;
protected static final int WIDTH_P = 120;
protected static final int WIDTH_L = 144;
protected static final int GAP = 2;
public WndTitledMessage( Image icon, String title, String message ) {
this( new IconTitle( icon, title ), message );
@@ -52,26 +49,26 @@ public class WndTitledMessage extends Window {
add( titlebar );
Highlighter hl = new Highlighter( message );
normal = PixelScene.createMultiline( hl.text, 6 );
BitmapTextMultiline normal = PixelScene.createMultiline(hl.text, 6);
normal.maxWidth = width;
normal.measure();
normal.x = titlebar.left();
normal.y = titlebar.bottom() + GAP;
add( normal );
add(normal);
if (hl.isHighlighted()) {
normal.mask = hl.inverted();
highlighted = PixelScene.createMultiline( hl.text, 6 );
BitmapTextMultiline highlighted = PixelScene.createMultiline(hl.text, 6);
highlighted.maxWidth = normal.maxWidth;
highlighted.measure();
highlighted.x = normal.x;
highlighted.y = normal.y;
add( highlighted );
add(highlighted);
highlighted.mask = hl.mask;
highlighted.hardlight( TITLE_COLOR );
highlighted.hardlight(TITLE_COLOR);
}
resize( width, (int)(normal.y + normal.height()) );