Java Code Examples for com.watabou.noosa.BitmapTextMultiline#hardlight()
The following examples show how to use
com.watabou.noosa.BitmapTextMultiline#hardlight() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WndOptions.java From unleashed-pixel-dungeon with GNU General Public License v3.0 | 5 votes |
public WndOptions( String title, String message, String... options ) { super(); BitmapTextMultiline tfTitle = PixelScene.createMultiline( title, 9 ); tfTitle.hardlight( TITLE_COLOR ); tfTitle.x = tfTitle.y = MARGIN; tfTitle.maxWidth = WIDTH - MARGIN * 2; tfTitle.measure(); add( tfTitle ); BitmapTextMultiline tfMesage = PixelScene.createMultiline( message, 8 ); tfMesage.maxWidth = WIDTH - MARGIN * 2; tfMesage.measure(); tfMesage.x = MARGIN; tfMesage.y = tfTitle.y + tfTitle.height() + MARGIN; add( tfMesage ); float pos = tfMesage.y + tfMesage.height() + MARGIN; for (int i=0; i < options.length; i++) { final int index = i; RedButton btn = new RedButton( options[i] ) { @Override protected void onClick() { hide(); onSelect( index ); } }; btn.setRect( MARGIN, pos, WIDTH - MARGIN * 2, BUTTON_HEIGHT ); add( btn ); pos += BUTTON_HEIGHT + MARGIN; } resize( WIDTH, (int)pos ); }
Example 2
Source File: WndOptions.java From pixel-dungeon with GNU General Public License v3.0 | 5 votes |
public WndOptions( String title, String message, String... options ) { super(); BitmapTextMultiline tfTitle = PixelScene.createMultiline( title, 9 ); tfTitle.hardlight( TITLE_COLOR ); tfTitle.x = tfTitle.y = MARGIN; tfTitle.maxWidth = WIDTH - MARGIN * 2; tfTitle.measure(); add( tfTitle ); BitmapTextMultiline tfMesage = PixelScene.createMultiline( message, 8 ); tfMesage.maxWidth = WIDTH - MARGIN * 2; tfMesage.measure(); tfMesage.x = MARGIN; tfMesage.y = tfTitle.y + tfTitle.height() + MARGIN; add( tfMesage ); float pos = tfMesage.y + tfMesage.height() + MARGIN; for (int i=0; i < options.length; i++) { final int index = i; RedButton btn = new RedButton( options[i] ) { @Override protected void onClick() { hide(); onSelect( index ); } }; btn.setRect( MARGIN, pos, WIDTH - MARGIN * 2, BUTTON_HEIGHT ); add( btn ); pos += BUTTON_HEIGHT + MARGIN; } resize( WIDTH, (int)pos ); }
Example 3
Source File: AboutScene.java From YetAnotherPixelDungeon with GNU General Public License v3.0 | 4 votes |
@Override public void create() { super.create(); boolean landscape = YetAnotherPixelDungeon.landscape(); Image yapd = Icons.YAPD.get(); yapd.scale = new PointF( 1.5f, 1.5f ); yapd.x = align( ( Camera.main.width - yapd.width()) / 2 ); yapd.y = align( (Camera.main.height / 3 - yapd.height()) / 2 ); add( yapd ); new Flare( 7, 64 ).color( 0x332211, true ).show( yapd, 0 ).angularSpeed = +20; BitmapTextMultiline title1 = createMultiline( TITLE, landscape ? 10 : 8 ); title1.maxWidth = Math.min(Camera.main.width, 120); title1.hardlight(Window.TITLE_COLOR); title1.measure(); title1.x = align( ( Camera.main.width - title1.width() ) / 2 ); title1.y = align( landscape ? ( ( Camera.main.height / 3 - title1.height() ) / 2 ) : ((Camera.main.height / 3 - title1.height()) / 2 ) ); add(title1); BitmapTextMultiline text1 = createMultiline( TXT_PART1, landscape ? 8 : 6 ); text1.measure(); text1.width = Math.min( Camera.main.width, landscape ? 120 : 200 ); text1.x = align( landscape ? (Camera.main.width / 2 - text1.width()) / 2 : (Camera.main.width - text1.width()) / 2 ); text1.y = align( landscape ? (Camera.main.height - text1.height()) / 2 : Camera.main.height * 2 / 7 ); add(text1); BitmapTextMultiline text2 = createMultiline( TXT_PART2, landscape ? 8 : 6 ); text2.measure(); text2.width = Math.min( Camera.main.width, landscape ? 120 : 200 ); text2.x = align( landscape ? (text1.x + Camera.main.width / 2) : (Camera.main.width - text2.width()) / 2 ); text2.y = align( landscape ? (Camera.main.height - text2.height()) / 2 : (text1.y + text1.height() + 8 ) ); add(text2); Archs archs = new Archs(); archs.setSize( Camera.main.width, Camera.main.height ); addToBack( archs ); ExitButton btnExit = new ExitButton(); btnExit.setPos( Camera.main.width - btnExit.width(), 0 ); add( btnExit ); fadeIn(); }
Example 4
Source File: WndOptions.java From YetAnotherPixelDungeon with GNU General Public License v3.0 | 4 votes |
public WndOptions( String title, String message, String... options ) { super(); this.disabled = disabled(); BitmapTextMultiline tfTitle = PixelScene.createMultiline( title, 9 ); tfTitle.hardlight( TITLE_COLOR ); tfTitle.x = tfTitle.y = MARGIN; tfTitle.maxWidth = WIDTH - MARGIN * 2; tfTitle.measure(); add( tfTitle ); BitmapTextMultiline tfMessage = PixelScene.createMultiline( message, 7 ); tfMessage.maxWidth = WIDTH - MARGIN * 2; tfMessage.measure(); tfMessage.x = MARGIN; tfMessage.y = tfTitle.y + tfTitle.height() + MARGIN; add( tfMessage ); float pos = tfMessage.y + tfMessage.height() + MARGIN; for (int i=0; i < options.length; i++) { final int index = i; RedButton btn = new RedButton( options[i] ) { @Override protected void onClick() { hide(); onSelect( index ); } }; if( disabled != null && disabled.contains( index ) ) { btn.textColor( DISABLED_COLOR ); } btn.setRect( MARGIN, pos, WIDTH - MARGIN * 2, BUTTON_HEIGHT ); add( btn ); pos += BUTTON_HEIGHT + MARGIN; } resize( WIDTH, (int)pos ); }
Example 5
Source File: WndChooseWay.java From YetAnotherPixelDungeon with GNU General Public License v3.0 | 4 votes |
public WndChooseWay( final TomeOfMastery tome, final HeroSubClass way1, final HeroSubClass way2 ) { super(); IconTitle titlebar = new IconTitle(); titlebar.icon( new ItemSprite( tome.image(), null ) ); titlebar.label( tome.name() ); titlebar.setRect( 0, 0, WIDTH, 0 ); add( titlebar ); Highlighter hl = new Highlighter( way1.desc() + "\n\n" + way2.desc() + "\n\n" + TXT_MESSAGE ); 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(); 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 ); } RedButton btnWay1 = new RedButton( Utils.capitalize( way1.title() ) ) { @Override protected void onClick() { hide(); tome.choose( way1 ); } }; btnWay1.setRect( 0, normal.y + normal.height() + GAP, (WIDTH - GAP) / 2, BTN_HEIGHT ); add( btnWay1 ); RedButton btnWay2 = new RedButton( Utils.capitalize( way2.title() ) ) { @Override protected void onClick() { hide(); tome.choose( way2 ); } }; btnWay2.setRect( btnWay1.right() + GAP, btnWay1.top(), btnWay1.width(), BTN_HEIGHT ); add( btnWay2 ); RedButton btnCancel = new RedButton( TXT_CANCEL ) { @Override protected void onClick() { hide(); } }; btnCancel.setRect( 0, btnWay2.bottom() + GAP, WIDTH, BTN_HEIGHT ); add( btnCancel ); resize( WIDTH, (int)btnCancel.bottom() ); }
Example 6
Source File: WelcomeScene.java From unleashed-pixel-dungeon with GNU General Public License v3.0 | 4 votes |
@Override public void create() { super.create(); final int gameversion = ShatteredPixelDungeon.version(); BitmapTextMultiline title; BitmapTextMultiline text; if (gameversion == 0) { text = createMultiline(TXT_Welcome, 8); title = createMultiline(TTL_Welcome, 16); } else if (gameversion <= Game.versionCode) { text = createMultiline(TXT_Update, 6 ); title = createMultiline(TTL_Update, 9 ); } else { text = createMultiline( TXT_Future, 8 ); title = createMultiline( TTL_Future, 16 ); } int w = Camera.main.width; int h = Camera.main.height; int pw = w - 10; int ph = h - 50; title.maxWidth = pw; title.measure(); title.hardlight(Window.SHPX_COLOR); title.x = align( (w - title.width()) / 2 ); title.y = align( 8 ); add( title ); NinePatch panel = Chrome.get(Chrome.Type.WINDOW); panel.size( pw, ph ); panel.x = (w - pw) / 2; panel.y = (h - ph) / 2; add( panel ); ScrollPane list = new ScrollPane( new Component() ); add( list ); list.setRect( panel.x + panel.marginLeft(), panel.y + panel.marginTop(), panel.innerWidth(), panel.innerHeight()); list.scrollTo( 0, 0 ); Component content = list.content(); content.clear(); text.maxWidth = (int) panel.innerWidth(); text.measure(); content.add(text); content.setSize( panel.innerWidth(), text.height() ); RedButton okay = new RedButton("Okay!") { @Override protected void onClick() { ShatteredPixelDungeon.version(Game.versionCode); Game.switchScene(TitleScene.class); } }; /* okay.setRect(text.x, text.y + text.height() + 5, 55, 18); add(okay); RedButton changes = new RedButton("Changes") { @Override protected void onClick() { parent.add(new WndChanges()); } }; changes.setRect(text.x + 65, text.y + text.height() + 5, 55, 18); add(changes);*/ okay.setRect((w - pw) / 2, h - 22, pw, 18); add(okay); Archs archs = new Archs(); archs.setSize( Camera.main.width, Camera.main.height ); addToBack( archs ); fadeIn(); }
Example 7
Source File: WndChooseWay.java From unleashed-pixel-dungeon with GNU General Public License v3.0 | 4 votes |
public WndChooseWay( final TomeOfMastery tome, final HeroSubClass way1, final HeroSubClass way2 ) { super(); IconTitle titlebar = new IconTitle(); titlebar.icon( new ItemSprite( tome.image(), null ) ); titlebar.label( tome.name() ); titlebar.setRect( 0, 0, WIDTH, 0 ); add( titlebar ); Highlighter hl = new Highlighter( way1.desc() + "\n\n" + way2.desc() + "\n\n" + TXT_MESSAGE ); 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(); 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 ); } RedButton btnWay1 = new RedButton( Utils.capitalize( way1.title() ) ) { @Override protected void onClick() { hide(); tome.choose( way1 ); } }; btnWay1.setRect( 0, normal.y + normal.height() + GAP, (WIDTH - GAP) / 2, BTN_HEIGHT ); add( btnWay1 ); RedButton btnWay2 = new RedButton( Utils.capitalize( way2.title() ) ) { @Override protected void onClick() { hide(); tome.choose( way2 ); } }; btnWay2.setRect( btnWay1.right() + GAP, btnWay1.top(), btnWay1.width(), BTN_HEIGHT ); add( btnWay2 ); RedButton btnCancel = new RedButton( TXT_CANCEL ) { @Override protected void onClick() { hide(); } }; btnCancel.setRect( 0, btnWay2.bottom() + GAP, WIDTH, BTN_HEIGHT ); add( btnCancel ); resize( WIDTH, (int)btnCancel.bottom() ); }
Example 8
Source File: AboutScene.java From pixel-dungeon with GNU General Public License v3.0 | 4 votes |
@Override public void create() { super.create(); BitmapTextMultiline text = createMultiline( TXT, 8 ); text.maxWidth = Math.min( Camera.main.width, 120 ); text.measure(); add( text ); text.x = align( (Camera.main.width - text.width()) / 2 ); text.y = align( (Camera.main.height - text.height()) / 2 ); BitmapTextMultiline link = createMultiline( LNK, 8 ); link.maxWidth = Math.min( Camera.main.width, 120 ); link.measure(); link.hardlight( Window.TITLE_COLOR ); add( link ); link.x = text.x; link.y = text.y + text.height(); TouchArea hotArea = new TouchArea( link ) { @Override protected void onClick( Touch touch ) { Intent intent = new Intent( Intent.ACTION_VIEW, Uri.parse( "http://" + LNK ) ); Game.instance.startActivity( intent ); } }; add( hotArea ); Image wata = Icons.WATA.get(); wata.x = align( (Camera.main.width - wata.width) / 2 ); wata.y = text.y - wata.height - 8; add( wata ); new Flare( 7, 64 ).color( 0x112233, true ).show( wata, 0 ).angularSpeed = +20; Archs archs = new Archs(); archs.setSize( Camera.main.width, Camera.main.height ); addToBack( archs ); ExitButton btnExit = new ExitButton(); btnExit.setPos( Camera.main.width - btnExit.width(), 0 ); add( btnExit ); fadeIn(); }