当前位置: 首页>>代码示例>>Java>>正文


Java BitmapText.height方法代码示例

本文整理汇总了Java中com.watabou.noosa.BitmapText.height方法的典型用法代码示例。如果您正苦于以下问题:Java BitmapText.height方法的具体用法?Java BitmapText.height怎么用?Java BitmapText.height使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.watabou.noosa.BitmapText的用法示例。


在下文中一共展示了BitmapText.height方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: WndBadge

import com.watabou.noosa.BitmapText; //导入方法依赖的package包/类
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 );
}
 
开发者ID:kurtyu,项目名称:PixelDungeonTC,代码行数:32,代码来源:WndBadge.java

示例2: WndBadge

import com.watabou.noosa.BitmapText; //导入方法依赖的package包/类
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 );
}
 
开发者ID:FthrNature,项目名称:unleashed-pixel-dungeon,代码行数:32,代码来源:WndBadge.java

示例3: WndChallenges

import com.watabou.noosa.BitmapText; //导入方法依赖的package包/类
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 );
        add( title );

        boxes = new ArrayList<CheckBox>();

        float pos = title.height() + GAP;
        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 );
    }
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:34,代码来源:WndChallenges.java

示例4: WndBag

import com.watabou.noosa.BitmapText; //导入方法依赖的package包/类
public WndBag( Bag bag, Listener listener, Mode mode, String title ) {
	
	super();
	
	this.listener = listener;
	this.mode = mode;
	this.title = title;
	
	lastMode = mode;
	lastBag = bag;
	
	nCols = PixelDungeon.landscape() ? COLS_L : COLS_P;
	nRows = (Belongings.BACKPACK_SIZE + 4 + 1) / nCols + ((Belongings.BACKPACK_SIZE + 4 + 1) % nCols > 0 ? 1 : 0);
	
	int slotsWidth = SLOT_SIZE * nCols + SLOT_MARGIN * (nCols - 1);
	int slotsHeight = SLOT_SIZE * nRows + SLOT_MARGIN * (nRows - 1);
	
	BitmapText txtTitle = PixelScene.createText( title != null ? title : Utils.capitalize( bag.name() ), 9 );
	txtTitle.hardlight( TITLE_COLOR );
	txtTitle.measure();
	txtTitle.x = (int)(slotsWidth - txtTitle.width()) / 2;
	txtTitle.y = (int)(TITLE_HEIGHT - txtTitle.height()) / 2;
	add( txtTitle );
	
	placeItems( bag );
	
	resize( slotsWidth, slotsHeight + TITLE_HEIGHT );
	
	Belongings stuff = Dungeon.hero.belongings;
	Bag[] bags = {
		stuff.backpack, 
		stuff.getItem( SeedPouch.class ), 
		stuff.getItem( ScrollHolder.class ),
		stuff.getItem( WandHolster.class ),
		stuff.getItem( Keyring.class )};
	
	for (Bag b : bags) {
		if (b != null) {
			BagTab tab = new BagTab( b );
			tab.setSize( TAB_WIDTH, tabHeight() );
			add( tab );
			
			tab.select( b == bag );
		}
	}
}
 
开发者ID:kurtyu,项目名称:PixelDungeonTC,代码行数:47,代码来源:WndBag.java

示例5: WndBag

import com.watabou.noosa.BitmapText; //导入方法依赖的package包/类
public WndBag( Bag bag, Listener listener, Mode mode, String title ) {

		super();

		this.listener = listener;
		this.mode = mode;
		this.title = title;

		lastMode = mode;
		lastBag = bag;

		nCols = YetAnotherPixelDungeon.landscape() ? COLS_L : COLS_P;
		nRows = YetAnotherPixelDungeon.landscape() ? ROWS_L : ROWS_P ;
//		nRows = (Belongings.BACKPACK_SIZE + 4 + 1) / nCols + ((Belongings.BACKPACK_SIZE + 4 + 1) % nCols > 0 ? 1 : 0) + ( !YetAnotherPixelDungeon.landscape() ? 1 : 0 );

		int slotsWidth = SLOT_SIZE * nCols + SLOT_MARGIN * (nCols - 1);
		int slotsHeight = SLOT_SIZE * nRows + SLOT_MARGIN * (nRows - 1);

		BitmapText txtTitle = PixelScene.createText( title != null ? title : Utils.capitalize( bag.name() ), 9 );
		txtTitle.hardlight( TITLE_COLOR );
		txtTitle.measure();
		txtTitle.x = (int)(slotsWidth - txtTitle.width()) / 2;
		txtTitle.y = (int)(TITLE_HEIGHT - txtTitle.height()) / 2;
		add( txtTitle );

		placeItems( bag );

		resize( slotsWidth, slotsHeight + TITLE_HEIGHT );

		Belongings stuff = Dungeon.hero.belongings;

		ArrayList<Bag> bags = new ArrayList<>();

        bags.add( stuff.backpack );
        bags.add( stuff.getItem( Keyring.class ) );
        bags.add( stuff.getItem( HerbPouch.class ) );
        bags.add( stuff.getItem( PotionSash.class ) );
        bags.add( stuff.getItem( ScrollHolder.class ) );
        bags.add( stuff.getItem( WandHolster.class ) );

        while(bags.remove(null));

        int tabWidth = ( slotsWidth + 12 ) / bags.size() ;

		for (Bag b : bags) {
            BagTab tab = new BagTab( b );
            tab.setSize( tabWidth, tabHeight() );
            add( tab );

            tab.select( b == bag );
		}
	}
 
开发者ID:ConsideredHamster,项目名称:YetAnotherPixelDungeon,代码行数:53,代码来源:WndBag.java

示例6: WndBag

import com.watabou.noosa.BitmapText; //导入方法依赖的package包/类
public WndBag( Bag bag, Listener listener, Mode mode, String title ) {
	
	super();
	
	this.listener = listener;
	this.mode = mode;
	this.title = title;
	
	lastMode = mode;
	lastBag = bag;

	nCols = ShatteredPixelDungeon.landscape() ? COLS_L : COLS_P;
	nRows = (Belongings.BACKPACK_SIZE + 4 + 1) / nCols + ((Belongings.BACKPACK_SIZE + 4 + 1) % nCols > 0 ? 1 : 0);

	int slotsWidth = SLOT_SIZE * nCols + SLOT_MARGIN * (nCols - 1);
	int slotsHeight = SLOT_SIZE * nRows + SLOT_MARGIN * (nRows - 1);

	BitmapText txtTitle = PixelScene.createText( title != null ? title : Utils.capitalize( bag.name() ), 9 );
	txtTitle.hardlight( TITLE_COLOR );
	txtTitle.measure();
	txtTitle.x = (int)(slotsWidth - txtTitle.width()) / 2;
	txtTitle.y = (int)(TITLE_HEIGHT - txtTitle.height()) / 2;
	add( txtTitle );
	
	placeItems( bag );

	resize( slotsWidth, slotsHeight + TITLE_HEIGHT );

	Belongings stuff = Dungeon.hero.belongings;
	Bag[] bags = {
		stuff.backpack,
		stuff.getItem( SeedPouch.class ),
		stuff.getItem( ScrollHolder.class ),
		stuff.getItem( PotionBandolier.class ),
		stuff.getItem( WandHolster.class ),
           stuff.getItem( AnkhChain.class )};

	for (Bag b : bags) {
		if (b != null) {
			BagTab tab = new BagTab( b );
			add( tab );
			tab.select( b == bag );
		}
	}

	layoutTabs();
}
 
开发者ID:FthrNature,项目名称:unleashed-pixel-dungeon,代码行数:48,代码来源:WndBag.java

示例7: WndBag

import com.watabou.noosa.BitmapText; //导入方法依赖的package包/类
public WndBag( Bag bag, Listener listener, Mode mode, String title ) {
	
	super();
	
	this.listener = listener;
	this.mode = mode;
	this.title = title;
	
	lastMode = mode;
	lastBag = bag;
	
	BitmapText txtTitle = PixelScene.createText( title != null ? title : Utils.capitalize( bag.name() ), 9 );
	txtTitle.hardlight( TITLE_COLOR );
	txtTitle.measure();
	txtTitle.x = (int)(SLOT_SIZE * COLS + SLOT_MARGIN * (COLS - 1) - txtTitle.width()) / 2;
	txtTitle.y = (int)(TITLE_HEIGHT - txtTitle.height()) / 2;
	add( txtTitle );
	
	placeItems( bag );
	
	resize( 
		SLOT_SIZE * COLS + SLOT_MARGIN * (COLS - 1), 
		SLOT_SIZE * ROWS + SLOT_MARGIN * (ROWS - 1) + TITLE_HEIGHT );
	
	Belongings stuff = Dungeon.hero.belongings;
	Bag[] bags = {
		stuff.backpack, 
		stuff.getItem( SeedPouch.class ), 
		stuff.getItem( ScrollHolder.class ),
		stuff.getItem( WandHolster.class )};
	
	for (Bag b : bags) {
		if (b != null) {
			BagTab tab = new BagTab( b );
			tab.setSize( TAB_WIDTH, tabHeight() );
			add( tab );
			
			tab.select( b == bag );
		}
	}
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:42,代码来源:WndBag.java

示例8: WndBag

import com.watabou.noosa.BitmapText; //导入方法依赖的package包/类
public WndBag( Bag bag, Listener listener, Mode mode, String title ) {
	
	super();
	
	this.listener = listener;
	this.mode = mode;
	this.title = title;
	
	lastMode = mode;
	lastBag = bag;

	nCols = ShatteredPixelDungeon.landscape() ? COLS_L : COLS_P;
	nRows = (Belongings.BACKPACK_SIZE + 4 + 1) / nCols + ((Belongings.BACKPACK_SIZE + 4 + 1) % nCols > 0 ? 1 : 0);

	int slotsWidth = SLOT_SIZE * nCols + SLOT_MARGIN * (nCols - 1);
	int slotsHeight = SLOT_SIZE * nRows + SLOT_MARGIN * (nRows - 1);

	BitmapText txtTitle = PixelScene.createText( title != null ? title : Utils.capitalize( bag.name() ), 9 );
	txtTitle.hardlight( TITLE_COLOR );
	txtTitle.measure();
	txtTitle.x = (int)(slotsWidth - txtTitle.width()) / 2;
	txtTitle.y = (int)(TITLE_HEIGHT - txtTitle.height()) / 2;
	add( txtTitle );
	
	placeItems( bag );

	resize( slotsWidth, slotsHeight + TITLE_HEIGHT );

	Belongings stuff = Dungeon.hero.belongings;
	Bag[] bags = {
		stuff.backpack,
		stuff.getItem( SeedPouch.class ),
		stuff.getItem( ScrollHolder.class ),
		stuff.getItem( PotionBandolier.class ),
		stuff.getItem( WandHolster.class )};

	for (Bag b : bags) {
		if (b != null) {
			BagTab tab = new BagTab( b );
			add( tab );
			tab.select( b == bag );
		}
	}

	layoutTabs();
}
 
开发者ID:Sarius997,项目名称:Multiplayer-PD,代码行数:47,代码来源:WndBag.java


注:本文中的com.watabou.noosa.BitmapText.height方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。