com.watabou.noosa.BitmapText Java Examples

The following examples show how to use com.watabou.noosa.BitmapText. 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: ItemSlot.java    From pixel-dungeon with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected void createChildren() {
	
	super.createChildren();
	
	icon = new ItemSprite();
	add( icon );
	
	topLeft = new BitmapText( PixelScene.font1x );
	add( topLeft );
	
	topRight = new BitmapText( PixelScene.font1x );
	add( topRight );
	
	bottomRight = new BitmapText( PixelScene.font1x );
	add( bottomRight );
}
 
Example #2
Source File: WndBag.java    From shattered-pixel-dungeon-gdx with GNU General Public License v3.0 6 votes vote down vote up
protected void placeTitle( Bag bag, int width ){
	
	RenderedTextBlock txtTitle = PixelScene.renderTextBlock(
			title != null ? Messages.titleCase(title) : Messages.titleCase( bag.name() ), 9 );
	txtTitle.hardlight( TITLE_COLOR );
	txtTitle.setPos(
			1,
			(TITLE_HEIGHT - txtTitle.height()) / 2f - 1
	);
	PixelScene.align(txtTitle);
	add( txtTitle );
	
	ItemSprite gold = new ItemSprite(ItemSpriteSheet.GOLD, null);
	gold.x = width - gold.width() - 1;
	gold.y = (TITLE_HEIGHT - gold.height())/2f - 1;
	PixelScene.align(gold);
	add(gold);
	
	BitmapText amt = new BitmapText( Integer.toString(Dungeon.gold), PixelScene.pixelFont );
	amt.hardlight(TITLE_COLOR);
	amt.measure();
	amt.x = width - gold.width() - amt.width() - 2;
	amt.y = (TITLE_HEIGHT - amt.baseLine())/2f - 1;
	PixelScene.align(amt);
	add(amt);
}
 
Example #3
Source File: RankingsScene.java    From remixed-dungeon with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected void createChildren() {

    super.createChildren();

    shield = new ItemSprite(Assets.ITEMS, ItemSpriteSheet.TOMB, null);
    add(shield);

    position = new BitmapText(PixelScene.font1x);
    add(position);

    desc = createMultiline(GuiProperties.regularFontSize());
    add(desc);

    classIcon = new Image();
    add(classIcon);
}
 
Example #4
Source File: ItemSlot.java    From shattered-pixel-dungeon-gdx with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected void createChildren() {
	
	super.createChildren();
	
	icon = new ItemSprite();
	add( icon );
	
	topLeft = new BitmapText( PixelScene.pixelFont);
	add( topLeft );
	
	topRight = new BitmapText( PixelScene.pixelFont);
	add( topRight );
	
	bottomRight = new BitmapText( PixelScene.pixelFont);
	add( bottomRight );
}
 
Example #5
Source File: ItemSlot.java    From remixed-dungeon with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected void createChildren() {

    super.createChildren();

    icon = new ItemSprite();
    add(icon);

    emitter = new Emitter();
    add(emitter);

    topLeft = new BitmapText(PixelScene.font1x);
    topLeft.setScale(0.8f, 0.8f);
    add(topLeft);

    topRight = new BitmapText(PixelScene.font1x);
    topRight.setScale(0.8f, 0.8f);
    add(topRight);

    bottomRight = new BitmapText(PixelScene.font1x);
    bottomRight.setScale(0.8f, 0.8f);
    add(bottomRight);
}
 
Example #6
Source File: ItemSlot.java    From YetAnotherPixelDungeon with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected void createChildren() {
	
	super.createChildren();
	
	icon = new ItemSprite();
	add( icon );
	
	topLeft = new BitmapText( PixelScene.font1x );
	add( topLeft );
	
	topRight = new BitmapText( PixelScene.font1x );
	add( topRight );
	
	bottomRight = new BitmapText( PixelScene.font1x );
	add(bottomRight);

       bottomLeft = new BitmapText( PixelScene.font1x );
       add(bottomLeft);
}
 
Example #7
Source File: RankingsScene.java    From pixel-dungeon with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected void createChildren() {
	
	super.createChildren();
	
	shield = new ItemSprite( ItemSpriteSheet.TOMB, null );
	add( shield );
	
	position = new BitmapText( PixelScene.font1x );
	add( position );
	
	desc = createMultiline( 9 );		
	add( desc );
	
	classIcon = new Image();
	add( classIcon );
}
 
Example #8
Source File: ItemSlot.java    From unleashed-pixel-dungeon with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected void createChildren() {
	
	super.createChildren();
	
	icon = new ItemSprite();
	add( icon );
	
	topLeft = new BitmapText( PixelScene.font1x );
	add( topLeft );
	
	topRight = new BitmapText( PixelScene.font1x );
	add( topRight );
	
	bottomRight = new BitmapText( PixelScene.font1x );
	add( bottomRight );
}
 
Example #9
Source File: ItemSlot.java    From shattered-pixel-dungeon with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected void createChildren() {
	
	super.createChildren();
	
	sprite = new ItemSprite();
	add(sprite);
	
	status = new BitmapText( PixelScene.pixelFont);
	add(status);
	
	extra = new BitmapText( PixelScene.pixelFont);
	add(extra);
	
	level = new BitmapText( PixelScene.pixelFont);
	add(level);
}
 
Example #10
Source File: GoldIndicator.java    From unleashed-pixel-dungeon with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void createChildren() {
	tf = new BitmapText( PixelScene.font1x );
	tf.hardlight( 0xFFFF00 );
	add( tf );
	
	visible = false;
}
 
Example #11
Source File: GoldIndicator.java    From shattered-pixel-dungeon with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void createChildren() {
	tf = new BitmapText( PixelScene.pixelFont);
	tf.hardlight( 0xFFFF00 );
	add( tf );
	
	visible = false;
}
 
Example #12
Source File: GoldIndicator.java    From remixed-dungeon with GNU General Public License v3.0 5 votes vote down vote up
GoldIndicator() {
	super();
	tf = new BitmapText( PixelScene.font1x );
	tf.hardlight( 0xFFFF00 );
	add( tf );

	setVisible(false);
}
 
Example #13
Source File: DangerIndicator.java    From unleashed-pixel-dungeon with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void createChildren() {
	super.createChildren();
	
	number = new BitmapText( PixelScene.font1x );
	add( number );
	
	icon = Icons.SKULL.get();
	add( icon );
}
 
Example #14
Source File: DangerIndicator.java    From remixed-dungeon with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void createChildren() {
	super.createChildren();
	
	number = new BitmapText(PixelScene.font1x);

	add( number );
	
	icon = Icons.SKULL.get();
	add( icon );
}
 
Example #15
Source File: WndList.java    From unleashed-pixel-dungeon with GNU General Public License v3.0 5 votes vote down vote up
public WndList( String[] items ) {
	
	super();
	
	float pos = MARGIN;
	float dotWidth = 0;
	float maxWidth = 0;
	
	for (int i=0; i < items.length; i++) {
		
		if (i > 0) {
			pos += GAP;
		}
		
		BitmapText dot = PixelScene.createText( DOT, 6 );
		dot.x = MARGIN;
		dot.y = pos;
		if (dotWidth == 0) {
			dot.measure();
			dotWidth = dot.width();
		}
		add( dot );
		
		BitmapTextMultiline item = PixelScene.createMultiline( items[i], 6 );
		item.x = dot.x + dotWidth;
		item.y = pos;
		item.maxWidth = (int)(WIDTH - MARGIN * 2 - dotWidth);
		item.measure();
		add( item );
		
		pos += item.height();
		float w = item.width();
		if (w > maxWidth) {
			maxWidth = w;
		}
	}

	resize( (int)(maxWidth + dotWidth + MARGIN * 2), (int)(pos + MARGIN) );
}
 
Example #16
Source File: TagDanger.java    From YetAnotherPixelDungeon with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void createChildren() {
	super.createChildren();
	
	number = new BitmapText( PixelScene.font1x );
	add( number );
	
	icon = Icons.SKULL.get();
	add( icon );
}
 
Example #17
Source File: WndCatalogus.java    From YetAnotherPixelDungeon with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void createChildren() {
    feature = PixelScene.createText( 9 );
    add( feature );

    depth = new BitmapText( PixelScene.font1x );
    add( depth );

    icon = Icons.get( Icons.DEPTH );
    add( icon );
}
 
Example #18
Source File: WndClass.java    From pixel-dungeon with GNU General Public License v3.0 5 votes vote down vote up
public PerksTab() {
	super();
	
	float dotWidth = 0;
	
	String[] items = cl.perks();
	float pos = MARGIN;
	
	for (int i=0; i < items.length; i++) {
		
		if (i > 0) {
			pos += GAP;
		}
		
		BitmapText dot = PixelScene.createText( DOT, 6 );
		dot.x = MARGIN;
		dot.y = pos;
		if (dotWidth == 0) {
			dot.measure();
			dotWidth = dot.width();
		}
		add( dot );
		
		BitmapTextMultiline item = PixelScene.createMultiline( items[i], 6 );
		item.x = dot.x + dotWidth;
		item.y = pos;
		item.maxWidth = (int)(WIDTH - MARGIN * 2 - dotWidth);
		item.measure();
		add( item );
		
		pos += item.height();
		float w = item.width();
		if (w > width) {
			width = w;
		}
	}
	
	width += MARGIN + dotWidth;
	height = pos + MARGIN;
}
 
Example #19
Source File: WndRanking.java    From pixel-dungeon with GNU General Public License v3.0 5 votes vote down vote up
private float statSlot( Group parent, String label, String value, float pos ) {
	
	BitmapText txt = PixelScene.createText( label, 7 );
	txt.y = pos;
	parent.add( txt );
	
	txt = PixelScene.createText( value, 7 );
	txt.measure();
	txt.x = PixelScene.align( WIDTH * 0.65f );
	txt.y = pos;
	parent.add( txt );
	
	return pos + GAP + txt.baseLine();
}
 
Example #20
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 #21
Source File: WndHero.java    From pixel-dungeon with GNU General Public License v3.0 5 votes vote down vote up
private void statSlot( String label, String value ) {
	
	BitmapText txt = PixelScene.createText( label, 8 );
	txt.y = pos;
	add( txt );
	
	txt = PixelScene.createText( value, 8 );
	txt.measure();
	txt.x = PixelScene.align( WIDTH * 0.65f );
	txt.y = pos;
	add( txt );
	
	pos += GAP + txt.baseLine();
}
 
Example #22
Source File: WndChallenges.java    From pixel-dungeon with GNU General Public License v3.0 5 votes vote down vote up
public WndChallenges( int checked, boolean editable ) {
	
	super();
	
	this.editable = editable;
	
	BitmapText title = PixelScene.createText( TITLE, 9 );
	title.hardlight( TITLE_COLOR );
	title.measure();
	title.x = PixelScene.align( camera, (WIDTH - title.width()) / 2 );
	title.y = PixelScene.align( camera, (TTL_HEIGHT - title.height()) / 2 );
	add( title );

	boxes = new ArrayList<CheckBox>();
	
	float pos = TTL_HEIGHT;
	for (int i=0; i < Challenges.NAMES.length; i++) {
		
		CheckBox cb = new CheckBox( Challenges.NAMES[i] );
		cb.checked( (checked & Challenges.MASKS[i]) != 0 );
		cb.active = editable;
		
		if (i > 0) {
			pos += GAP;
		}
		cb.setRect( 0, pos, WIDTH, BTN_HEIGHT );
		pos = cb.bottom();
		
		add( cb );
		boxes.add( cb );
	}

	resize( WIDTH, (int)pos );
}
 
Example #23
Source File: WndJournal.java    From pixel-dungeon with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void createChildren() {
	feature = PixelScene.createText( 9 );
	add( feature );
	
	depth = new BitmapText( PixelScene.font1x );
	add( depth );
	
	icon = Icons.get( Icons.DEPTH );
	add( icon );
}
 
Example #24
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 #25
Source File: DangerIndicator.java    From pixel-dungeon with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void createChildren() {
	super.createChildren();
	
	number = new BitmapText( PixelScene.font1x );
	add( number );
	
	icon = Icons.SKULL.get();
	add( icon );
}
 
Example #26
Source File: GoldIndicator.java    From pixel-dungeon with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void createChildren() {
	tf = new BitmapText( PixelScene.font1x );
	tf.hardlight( 0xFFFF00 );
	add( tf );
	
	visible = false;
}
 
Example #27
Source File: DangerIndicator.java    From shattered-pixel-dungeon with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void createChildren() {
	super.createChildren();
	
	number = new BitmapText( PixelScene.pixelFont);
	add( number );
	
	icon = Icons.SKULL.get();
	add( icon );
}
 
Example #28
Source File: WndJournal.java    From shattered-pixel-dungeon with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void createChildren() {
	label = PixelScene.renderTextBlock( 7 );
	add( label );
	
	icon = new Image();
	add( icon );
	
	depth = new BitmapText( PixelScene.pixelFont);
	add( depth );
	
	line = new ColorBlock( 1, 1, 0xFF222222);
	add(line);
	
}
 
Example #29
Source File: WndBag.java    From shattered-pixel-dungeon with GNU General Public License v3.0 5 votes vote down vote up
protected void placeTitle( Bag bag, int width ){
	
	ItemSprite gold = new ItemSprite(ItemSpriteSheet.GOLD, null);
	gold.x = width - gold.width() - 1;
	gold.y = (TITLE_HEIGHT - gold.height())/2f - 1;
	PixelScene.align(gold);
	add(gold);
	
	BitmapText amt = new BitmapText( Integer.toString(Dungeon.gold), PixelScene.pixelFont );
	amt.hardlight(TITLE_COLOR);
	amt.measure();
	amt.x = width - gold.width() - amt.width() - 2;
	amt.y = (TITLE_HEIGHT - amt.baseLine())/2f - 1;
	PixelScene.align(amt);
	add(amt);
	
	RenderedTextBlock txtTitle = PixelScene.renderTextBlock(
			title != null ? Messages.titleCase(title) : Messages.titleCase( bag.name() ), 8 );
	txtTitle.hardlight( TITLE_COLOR );
	txtTitle.maxWidth( (int)amt.x - 2 );
	txtTitle.setPos(
			1,
			(TITLE_HEIGHT - txtTitle.height()) / 2f - 1
	);
	PixelScene.align(txtTitle);
	add( txtTitle );
}
 
Example #30
Source File: WndDocument.java    From shattered-pixel-dungeon with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void createChildren() {
	label = PixelScene.renderTextBlock( 7 );
	add( label );
	
	icon = new Image();
	add( icon );
	
	depth = new BitmapText( PixelScene.pixelFont);
	add( depth );
	
	line = new ColorBlock( 1, 1, 0xFF222222);
	add(line);
	
}