Java Code Examples for com.watabou.noosa.BitmapText

The following examples show how to use com.watabou.noosa.BitmapText. These examples are extracted from open source projects. 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
@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 2
@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 3
Source Project: pixel-dungeon   Source File: RankingsScene.java    License: 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 4
Source Project: pixel-dungeon   Source File: ItemSlot.java    License: 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 5
@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 6
@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 7
Source Project: remixed-dungeon   Source File: ItemSlot.java    License: 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 8
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 9
@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 10
public DetailsTab() {
    super();

    float dotWidth = 0;

    String[] items = cl.details();
    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 11
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, 6 );
	txt.measure();
	txt.x = PixelScene.align( WIDTH * 0.65f );
	txt.y = pos;
	parent.add( txt );
	
	return pos + GAP + txt.baseLine();
}
 
Example 12
private void statSlot( String label, String value ) {
	
	BitmapText txt = PixelScene.createText( label, 6 );
	txt.y = pos;
	add( txt );
	
	txt = PixelScene.createText( value, 6 );
	txt.measure();
	txt.x = PixelScene.align( WIDTH * 0.65f );
	txt.y = pos;
	add( txt );
	
	pos += GAP + txt.baseLine();
}
 
Example 13
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 14
@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 15
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 16
@Override
protected void createChildren() {
	super.createChildren();
	
	number = new BitmapText( PixelScene.font1x );
	add( number );
	
	icon = Icons.SKULL.get();
	add( icon );
}
 
Example 17
@Override
protected void createChildren() {
	tf = new BitmapText( PixelScene.font1x );
	tf.hardlight( 0xFFFF00 );
	add( tf );
	
	visible = false;
}
 
Example 18
@Override
protected void createChildren() {
	try {
		super.createChildren();

              // <shield + position>   <description of how you died>     <depth/steps> <class/level>
		shield = new ItemSprite(ItemSpriteSheet.TOMB, null);
		position = new BitmapText(PixelScene.font1x);
		position.alpha(0.8f);

		desc = createMultiline(7);

		depth = new BitmapText(PixelScene.font1x);
		depth.alpha(0.8f);
		steps = new Image();

		classIcon = new Image();

		add(shield);
		add(position);
		add(desc);
		add(classIcon);

		level = new BitmapText(PixelScene.font1x);
		level.alpha(0.8f);
	} catch (Exception e) {
		//
	}
}
 
Example 19
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 20
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 21
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
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
@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
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
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 26
@Override
protected void createChildren() {
	super.createChildren();
	
	number = new BitmapText( PixelScene.font1x );
	add( number );
	
	icon = Icons.SKULL.get();
	add( icon );
}
 
Example 27
@Override
protected void createChildren() {
	tf = new BitmapText( PixelScene.font1x );
	tf.hardlight( 0xFFFF00 );
	add( tf );
	
	visible = false;
}
 
Example 28
Source Project: pixel-dungeon   Source File: WndClass.java    License: 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 29
Source Project: pixel-dungeon   Source File: WndRanking.java    License: 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 30
Source Project: pixel-dungeon   Source File: WndHero.java    License: 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();
}