Java Code Examples for com.watabou.noosa.Image#height()

The following examples show how to use com.watabou.noosa.Image#height() . 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: WndBadge.java    From YetAnotherPixelDungeon with GNU General Public License v3.0 5 votes vote down vote up
public WndBadge( Badges.Badge badge ) {
	
	super();
	
	Image icon = BadgeBanner.image( badge.image );
	icon.scale.set( 2 );
	add( icon );
	
	BitmapTextMultiline info = PixelScene.createMultiline( badge.description, 8 );
	info.maxWidth = WIDTH - MARGIN * 2;
	info.measure();
	
	float w = Math.max( icon.width(), info.width() ) + MARGIN * 2;
	
	icon.x = (w - icon.width()) / 2;
	icon.y = MARGIN;
	
	float pos = icon.y + icon.height() + MARGIN;
	for (BitmapText line : info.new LineSplitter().split()) {
		line.measure();
		line.x = PixelScene.align( (w - line.width()) / 2 );
		line.y = PixelScene.align( pos );
		add( line );
		
		pos += line.height(); 
	}

	resize( (int)w, (int)(pos + MARGIN) );
	
	BadgeBanner.highlight( icon, badge.image );
}
 
Example 2
Source File: WndBadge.java    From unleashed-pixel-dungeon with GNU General Public License v3.0 5 votes vote down vote up
public WndBadge( Badges.Badge badge ) {
	
	super();
	
	Image icon = BadgeBanner.image( badge.image );
	icon.scale.set( 2 );
	add( icon );
	
	BitmapTextMultiline info = PixelScene.createMultiline( badge.description, 8 );
	info.maxWidth = WIDTH - MARGIN * 2;
	info.measure();
	
	float w = Math.max( icon.width(), info.width() ) + MARGIN * 2;
	
	icon.x = (w - icon.width()) / 2;
	icon.y = MARGIN;
	
	float pos = icon.y + icon.height() + MARGIN;
	for (BitmapText line : info.new LineSplitter().split()) {
		line.measure();
		line.x = PixelScene.align( (w - line.width()) / 2 );
		line.y = PixelScene.align( pos );
		add( line );
		
		pos += line.height();
	}

	resize( (int)w, (int)(pos + MARGIN) );
	
	BadgeBanner.highlight( icon, badge.image );
}
 
Example 3
Source File: WndBadge.java    From pixel-dungeon with GNU General Public License v3.0 5 votes vote down vote up
public WndBadge( Badges.Badge badge ) {
	
	super();
	
	Image icon = BadgeBanner.image( badge.image );
	icon.scale.set( 2 );
	add( icon );
	
	BitmapTextMultiline info = PixelScene.createMultiline( badge.description, 8 );
	info.maxWidth = WIDTH - MARGIN * 2;
	info.measure();
	
	float w = Math.max( icon.width(), info.width() ) + MARGIN * 2;
	
	icon.x = (w - icon.width()) / 2;
	icon.y = MARGIN;
	
	float pos = icon.y + icon.height() + MARGIN;
	for (BitmapText line : info.new LineSplitter().split()) {
		line.measure();
		line.x = PixelScene.align( (w - line.width()) / 2 );
		line.y = PixelScene.align( pos );
		add( line );
		
		pos += line.height(); 
	}

	resize( (int)w, (int)(pos + MARGIN) );
	
	BadgeBanner.highlight( icon, badge.image );
}
 
Example 4
Source File: WndBadge.java    From remixed-dungeon with GNU General Public License v3.0 3 votes vote down vote up
public WndBadge( Badges.Badge badge ) {
	
	super();
	
	Image icon = BadgeBanner.image( badge.image );
	icon.Scale().set( 2 );
	add( icon );
	
	Text info = PixelScene.createMultiline( badge.description, GuiProperties.regularFontSize());
	info.maxWidth(WIDTH - MARGIN * 2);

	float w = Math.max( icon.width(), info.width() ) + MARGIN * 2;
	
	icon.x = (w - icon.width()) / 2;
	icon.y = MARGIN;
	
	float pos = icon.y + icon.height() + MARGIN;
	
	info.hardlight(0xFFFF00);
	info.x = PixelScene.align(w / 2 - info.width() / 2);
	info.y = PixelScene.align(pos);
	add(info);
	
	resize( (int)w, (int)(pos + info.height() + MARGIN) );
	
	BadgeBanner.highlight( icon, badge.image );
}