Java Code Examples for com.watabou.noosa.BitmapText#hardlight()

The following examples show how to use com.watabou.noosa.BitmapText#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: 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 2
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 3
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 4
Source File: GoldIndicator.java    From shattered-pixel-dungeon-gdx 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 5
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 6
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 7
Source File: WndChallenges.java    From unleashed-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 8
Source File: GoldIndicator.java    From YetAnotherPixelDungeon 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 9
Source File: WndBag.java    From unleashed-pixel-dungeon with GNU General Public License v3.0 4 votes vote down vote up
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();
}
 
Example 10
Source File: BadgesScene.java    From unleashed-pixel-dungeon with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void create() {

	super.create();

	Music.INSTANCE.play( Assets.THEME, true );
	Music.INSTANCE.volume( 1f );

	uiCamera.visible = false;

	int w = Camera.main.width;
	int h = Camera.main.height;

	Archs archs = new Archs();
	archs.setSize( w, h );
	add( archs );

	int pw = Math.min( MAX_PANE_WIDTH, w - 6 );
	int ph = h - 30;

	NinePatch panel = Chrome.get( Chrome.Type.WINDOW );
	panel.size( pw, ph );
	panel.x = (w - pw) / 2;
	panel.y = (h - ph) / 2;
	add( panel );

	BitmapText title = PixelScene.createText( TXT_TITLE, 9 );
	title.hardlight( Window.TITLE_COLOR );
	title.measure();
	title.x = align( (w - title.width()) / 2 );
	title.y = align( (panel.y - title.baseLine()) / 2 );
	add( title );

	Badges.loadGlobal();

	ScrollPane list = new BadgesList( true );
	add( list );

	list.setRect(
			panel.x + panel.marginLeft(),
			panel.y + panel.marginTop(),
			panel.innerWidth(),
			panel.innerHeight() );

	ExitButton btnExit = new ExitButton();
	btnExit.setPos( Camera.main.width - btnExit.width(), 0 );
	add( btnExit );

	fadeIn();

	Badges.loadingListener = new Callback() {
		@Override
		public void call() {
			if (Game.scene() == BadgesScene.this) {
				ShatteredPixelDungeon.switchNoFade( BadgesScene.class );
			}
		}
	};
}
 
Example 11
Source File: StatusPane.java    From unleashed-pixel-dungeon with GNU General Public License v3.0 4 votes vote down vote up
@Override
protected void createChildren() {

	shield = new NinePatch( Assets.STATUS, 80, 0, 30   + 18, 0 );
	add( shield );

	add( new TouchArea( 0, 1, 31, 31 ) {
		@Override
		protected void onClick( Touch touch ) {
			Image sprite = Dungeon.hero.sprite;
			if (!sprite.isVisible()) {
				Camera.main.focusOn( sprite );
			}
			GameScene.show( new WndHero() );
		}
	} );

	btnMenu = new MenuButton();
	add( btnMenu );

	avatar = HeroSprite.avatar( Dungeon.hero.heroClass, lastTier );
	add( avatar );

	blood = new Emitter();
	blood.pos( avatar );
	blood.pour( BloodParticle.FACTORY, 0.3f );
	blood.autoKill = false;
	blood.on = false;
	add( blood );

	compass = new Compass( Dungeon.level.exit );
	add( compass );

	hp = new Image( Assets.HP_BAR );
	add( hp );

	exp = new Image( Assets.XP_BAR );
	add( exp );

	level = new BitmapText( PixelScene.font1x );
	level.hardlight( 0xFFEBA4 );
	add( level );

	depth = new BitmapText( Integer.toString( Dungeon.depth ), PixelScene.font1x );
	depth.hardlight( 0xCACFC2 );
	depth.measure();
	add( depth );

	Dungeon.hero.belongings.countIronKeys();
	keys = new BitmapText( PixelScene.font1x );
	keys.hardlight( 0xCACFC2 );
	add( keys );

	danger = new DangerIndicator();
	add( danger );

	buffs = new BuffIndicator( Dungeon.hero );
	add( buffs );
}
 
Example 12
Source File: BadgesScene.java    From pixel-dungeon with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void create() {
	
	super.create();
	
	Music.INSTANCE.play( Assets.THEME, true );
	Music.INSTANCE.volume( 1f );
	
	uiCamera.visible = false;
	
	int w = Camera.main.width;
	int h = Camera.main.height;
	
	Archs archs = new Archs();
	archs.setSize( w, h );
	add( archs );
	
	int pw = (int)Math.min( w, (PixelDungeon.landscape() ? MIN_WIDTH_L : MIN_WIDTH_P) * 3 ) - 16;
	int ph = (int)Math.min( h, (PixelDungeon.landscape() ? MIN_HEIGHT_L : MIN_HEIGHT_P) * 3 ) - 32;
	
	float size = (float)Math.sqrt( pw * ph / 27f );
	int nCols = (int)Math.ceil( pw / size );
	int nRows = (int)Math.ceil( ph / size );
	size = Math.min( pw / nCols, ph / nRows );
	
	float left = (w - size * nCols) / 2;
	float top = (h - size * nRows) / 2;
	
	BitmapText title = PixelScene.createText( TXT_TITLE, 9 );
	title.hardlight( Window.TITLE_COLOR );
	title.measure();
	title.x = align( (w - title.width()) / 2 );
	title.y = align( (top - title.baseLine()) / 2 );
	add( title );
	
	Badges.loadGlobal();
	
	List<Badges.Badge> badges = Badges.filtered( true );
	for (int i=0; i < nRows; i++) {
		for (int j=0; j < nCols; j++) {
			int index = i * nCols + j;
			Badges.Badge b = index < badges.size() ? badges.get( index ) : null;
			BadgeButton button = new BadgeButton( b );
			button.setPos(
				left + j * size + (size - button.width()) / 2,
				top + i * size + (size - button.height()) / 2);
			add( button );
		}
	}
	
	ExitButton btnExit = new ExitButton();
	btnExit.setPos( Camera.main.width - btnExit.width(), 0 );
	add( btnExit );
	
	fadeIn();
	
	Badges.loadingListener = new Callback() {
		@Override
		public void call() {
			if (Game.scene() == BadgesScene.this) {
				PixelDungeon.switchNoFade( BadgesScene.class );
			}
		}
	};
}
 
Example 13
Source File: WndBag.java    From pixel-dungeon with GNU General Public License v3.0 4 votes vote down vote up
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 );
		}
	}
}
 
Example 14
Source File: WndHero.java    From pixel-dungeon with GNU General Public License v3.0 4 votes vote down vote up
public StatsTab() {
	
	Hero hero = Dungeon.hero; 

	BitmapText title = PixelScene.createText( 
		Utils.format( TXT_TITLE, hero.lvl, hero.className() ).toUpperCase( Locale.ENGLISH ), 9 );
	title.hardlight( TITLE_COLOR );
	title.measure();
	add( title );
	
	RedButton btnCatalogus = new RedButton( TXT_CATALOGUS ) {
		@Override
		protected void onClick() {
			hide();
			GameScene.show( new WndCatalogus() );
		}
	};
	btnCatalogus.setRect( 0, title.y + title.height(), btnCatalogus.reqWidth() + 2, btnCatalogus.reqHeight() + 2 );
	add( btnCatalogus );
	
	RedButton btnJournal = new RedButton( TXT_JOURNAL ) {
		@Override
		protected void onClick() {
			hide();
			GameScene.show( new WndJournal() );
		}
	};
	btnJournal.setRect( 
		btnCatalogus.right() + 1, btnCatalogus.top(), 
		btnJournal.reqWidth() + 2, btnJournal.reqHeight() + 2 );
	add( btnJournal );
	
	pos = btnCatalogus.bottom() + GAP;
	
	statSlot( TXT_STR, hero.STR() );
	statSlot( TXT_HEALTH, hero.HP + "/" + hero.HT );
	statSlot( TXT_EXP, hero.exp + "/" + hero.maxExp() );

	pos += GAP;
	
	statSlot( TXT_GOLD, Statistics.goldCollected );
	statSlot( TXT_DEPTH, Statistics.deepestFloor );
	
	pos += GAP;
}
 
Example 15
Source File: StatusPane.java    From shattered-pixel-dungeon-gdx with GNU General Public License v3.0 4 votes vote down vote up
@Override
protected void createChildren() {

	bg = new NinePatch( Assets.STATUS, 0, 0, 128, 36, 85, 0, 45, 0 );
	add( bg );

	add( new TouchArea<GameAction>( 0, 1, 31, 31 ) {
		@Override
		protected void onClick( NoosaInputProcessor.Touch touch ) {
			Image sprite = Dungeon.hero.sprite;
			Camera.main.panTo( sprite.center(), 5f );
			GameScene.show( new WndHero() );
		}

		@Override
		public boolean onKeyUp(NoosaInputProcessor.Key<GameAction> key) {
			boolean handled = true;
			switch (key.action) {
			case HERO_INFO:
				onClick( null );
				break;
			case JOURNAL:
				GameScene.show( new WndJournal() );
				break;
			default:
				handled = false;
				break;
			}
			return handled;
		}
	} );

	btnJournal = new JournalButton();
	add( btnJournal );

	btnMenu = new MenuButton();
	add( btnMenu );

	avatar = HeroSprite.avatar( Dungeon.hero.heroClass, lastTier );
	add( avatar );

	compass = new Compass( Statistics.amuletObtained ? Dungeon.level.entrance : Dungeon.level.exit );
	add( compass );

	rawShielding = new Image( Assets.SHLD_BAR );
	rawShielding.alpha(0.5f);
	add(rawShielding);

	shieldedHP = new Image( Assets.SHLD_BAR );
	add(shieldedHP);

	hp = new Image( Assets.HP_BAR );
	add( hp );

	exp = new Image( Assets.XP_BAR );
	add( exp );

	bossHP = new BossHealthBar();
	add( bossHP );

	level = new BitmapText( PixelScene.pixelFont);
	level.hardlight( 0xFFEBA4 );
	add( level );

	depth = new BitmapText( Integer.toString( Dungeon.depth ), PixelScene.pixelFont);
	depth.hardlight( 0xCACFC2 );
	depth.measure();
	add( depth );

	danger = new DangerIndicator();
	add( danger );

	buffs = new BuffIndicator( Dungeon.hero );
	add( buffs );

	add( pickedUp = new Toolbar.PickedUpItem());
	
	version = new BitmapText( "v" + Game.version, PixelScene.pixelFont);
	version.alpha( 0.5f );
	add(version);
}
 
Example 16
Source File: RankingsScene.java    From unleashed-pixel-dungeon with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void create() {
	
	super.create();
	
	Music.INSTANCE.play( Assets.THEME, true );
	Music.INSTANCE.volume( 1f );
	
	uiCamera.visible = false;
	
	int w = Camera.main.width;
	int h = Camera.main.height;
	
	archs = new Archs();
	archs.setSize( w, h );
	add( archs );
	
	Rankings.INSTANCE.load();

	BitmapText title = PixelScene.createText(TXT_TITLE, 9);
	title.hardlight(Window.SHPX_COLOR);
	title.measure();
	title.x = align((w - title.width()) / 2);
	title.y = align( GAP );
	add(title);
	
	if (Rankings.INSTANCE.records.size() > 0) {

		//attempts to give each record as much space as possible, ideally as much space as portrait mode
		float rowHeight = GameMath.gate(ROW_HEIGHT_MIN, (uiCamera.height - 26)/Rankings.INSTANCE.records.size(), ROW_HEIGHT_MAX);

		float left = (w - Math.min( MAX_ROW_WIDTH, w )) / 2 + GAP;
		float top = align( (h - rowHeight  * Rankings.INSTANCE.records.size()) / 2 );
		
		int pos = 0;
		
		for (Rankings.Record rec : Rankings.INSTANCE.records) {
			Record row = new Record( pos, pos == Rankings.INSTANCE.lastRecord, rec );
			float offset = rowHeight <= 14 ?
							pos %2 == 1? 5 : -5
							: 0;
			row.setRect( left+offset, top + pos * rowHeight, w - left * 2, rowHeight );
			try {
				add(row);
				pos++;
			} catch (Exception e) {
				//
			}
		}
		
		if (Rankings.INSTANCE.totalNumber >= Rankings.TABLE_SIZE) {
			BitmapText label = PixelScene.createText( TXT_TOTAL, 8 );
			label.hardlight( 0xCCCCCC );
			label.measure();
			add( label );

			BitmapText won = PixelScene.createText( Integer.toString( Rankings.INSTANCE.wonNumber ), 8 );
			won.hardlight( Window.SHPX_COLOR );
			won.measure();
			add( won );

			BitmapText total = PixelScene.createText( "/" + Rankings.INSTANCE.totalNumber, 8 );
			total.hardlight( 0xCCCCCC );
			total.measure();
			total.x = align( (w - total.width()) / 2 );
			total.y = align( top + pos * rowHeight + GAP );
			add( total );

			float tw = label.width() + won.width() + total.width();
			label.x = align( (w - tw) / 2 );
			won.x = label.x + label.width();
			total.x = won.x + won.width();
			label.y = won.y = total.y = align( h - label.height() - GAP );

		}
		
	} else {

		BitmapText noRec = PixelScene.createText(TXT_NO_GAMES, 8);
		noRec.hardlight( 0xCCCCCC );
		noRec.measure();
		noRec.x = align((w - noRec.width()) / 2);
		noRec.y = align((h - noRec.height()) / 2);
		add(noRec);
		
	}

	ExitButton btnExit = new ExitButton();
	btnExit.setPos( Camera.main.width - btnExit.width(), 0 );
	add( btnExit );

	fadeIn();
}
 
Example 17
Source File: StatusPane.java    From pixel-dungeon with GNU General Public License v3.0 4 votes vote down vote up
@Override
protected void createChildren() {
	
	shield = new NinePatch( Assets.STATUS, 80, 0, 30   + 18, 0 );
	add( shield );
	
	add( new TouchArea( 0, 1, 30, 30 ) {
		@Override
		protected void onClick( Touch touch ) {
			Image sprite = Dungeon.hero.sprite;
			if (!sprite.isVisible()) {
				Camera.main.focusOn( sprite );
			}
			GameScene.show( new WndHero() );
		};			
	} );
	
	btnMenu = new MenuButton();
	add( btnMenu );
	
	avatar = HeroSprite.avatar( Dungeon.hero.heroClass, lastTier );
	add( avatar );
	
	blood = new BitmaskEmitter( avatar );
	blood.pour( BloodParticle.FACTORY, 0.3f );
	blood.autoKill = false;
	blood.on = false;
	add( blood );
	
	compass = new Compass( Dungeon.level.exit );
	add( compass );
	
	hp = new Image( Assets.HP_BAR );	
	add( hp );
	
	exp = new Image( Assets.XP_BAR );
	add( exp );
	
	level = new BitmapText( PixelScene.font1x );
	level.hardlight( 0xFFEBA4 );
	add( level );
	
	depth = new BitmapText( Integer.toString( Dungeon.depth ), PixelScene.font1x );
	depth.hardlight( 0xCACFC2 );
	depth.measure();
	add( depth );
	
	Dungeon.hero.belongings.countIronKeys();
	keys = new BitmapText( PixelScene.font1x );
	keys.hardlight( 0xCACFC2 );
	add( keys );
	
	danger = new DangerIndicator();
	add( danger );
	
	loot = new LootIndicator();
	add( loot );
	
	resume = new ResumeButton();
	add( resume );
	
	buffs = new BuffIndicator( Dungeon.hero );
	add( buffs );
}
 
Example 18
Source File: StatusPane.java    From YetAnotherPixelDungeon with GNU General Public License v3.0 4 votes vote down vote up
@Override
	protected void createChildren() {
		
		shield = new NinePatch( Assets.STATUS, 80, 0, 48, 0 );
		add( shield );
		
		add( new TouchArea( 0, 1, 30, 30 ) {
			@Override
			protected void onClick( Touch touch ) {
				Image sprite = Dungeon.hero.sprite;
				if (!sprite.isVisible()) {
					Camera.main.focusOn( sprite );
				}
				GameScene.show( new WndHero() );
			};			
		} );
		
		btnMenu = new MenuButton();
		add( btnMenu );

        difficulty = new IconDifficulty();
        add(difficulty);

        avatar = HeroSprite.avatar( Dungeon.hero.heroClass, lastTier );
        add(avatar);
		
//		blood = new Emitter();
//		blood.pos(avatar);
//		blood.pour(BloodParticle.FACTORY, 0.3f);
//		blood.autoKill = false;
//		blood.on = false;
//		addFromDamage(blood);
		
		compass = new Compass( Dungeon.level.exit );
		add( compass );
		
		hp = new Image( Assets.HP_BAR );	
		add( hp );
		
		exp = new Image( Assets.XP_BAR );
		add(exp);

        level = new BitmapText( PixelScene.font1x );
        level.hardlight(0xFFEBA4);
        add(level);

        health = new BitmapText( PixelScene.font1x );
        health.hardlight(0xCACFC2);
        add(health);
		
		depth = new BitmapText( Integer.toString( Dungeon.depth ), PixelScene.font1x );
		depth.hardlight(0xCACFC2);
		depth.measure();
		add( depth );
		
		Dungeon.hero.belongings.countIronKeys();
		keys = new BitmapText( PixelScene.font1x );
		keys.hardlight(0xCACFC2);
		add(keys);
		
		danger = new TagDanger();
		add(danger);

        attack = new TagAttack();
        add( attack );

        pickup = new TagPickup();
        add(pickup);
		
		resume = new TagResume();
		add( resume );



        btnWaterskin = new TagWaterskin();
        add(btnWaterskin);

        btnOilLantern = new TagOilLantern();
        add(btnOilLantern);
		
		buffs = new BuffIndicator( Dungeon.hero );
		add( buffs );

	}
 
Example 19
Source File: StatusPane.java    From remixed-dungeon with GNU General Public License v3.0 4 votes vote down vote up
@Override
protected void createChildren() {

    shield = new NinePatch(Assets.getStatus(), 80, 0, 30 + 18, 0);
    add(shield);

    add(new TouchArea(0, 1, 30, 30) {
        @Override
        protected void onClick(Touch touch) {
            Image sprite = hero.getSprite();
            if (!sprite.isVisible()) {
                Camera.main.focusOn(sprite);
            }
            GameScene.show(new WndHero());
        }
    });

    avatar = hero.getSprite().avatar();
    add(avatar);

    blood = new Emitter();
    blood.pos(avatar);
    blood.pour(BloodParticle.FACTORY, 0.3f);
    blood.autoKill = false;
    blood.on = false;
    add(blood);

    int compassTarget = currentLevel.entrance;

    if (currentLevel.hasCompassTarget()) {
        compassTarget = currentLevel.getCompassTarget();    // Set to compass target if exists
    } else if ( currentLevel.hasExit(0)
                && hero.getBelongings().getItem(Amulet.class) == null) {
        compassTarget = currentLevel.getExit(0);    // Set to first exit if exists
    }

    compass = new Compass(compassTarget, currentLevel);
    add(compass);


    hp = new Image(Assets.HP_BAR);
    add(hp);

    sp = new Image(Assets.SP_BAR);
    add(sp);

    exp = new Image(Assets.XP_BAR);
    add(exp);

    level = new BitmapText(PixelScene.font1x);
    level.hardlight(0xFFEBA4);
    add(level);

    depth = new BitmapText(Integer.toString(Dungeon.depth), PixelScene.font1x);
    depth.hardlight(0xCACFC2);
    add(depth);

    hero.getBelongings().countIronKeys();
    keys = new BitmapText(PixelScene.font1x);
    keys.hardlight(0xCACFC2);
    add(keys);

    danger = new DangerIndicator();
    add(danger);

    loot = new LootIndicator();
    add(loot);

    buffs = new BuffIndicator(hero);
    add(buffs);

    btnMenu = new MenuButton(new Image(Assets.getStatus(), 114, 3, 12, 11), WndGame.class);
    add(btnMenu);

    btnHats = new MenuButton(new Image(Assets.getStatus(), 114, 18, 12, 11), WndHats.class);

    if (!Flavours.haveHats()) {
        btnHats.enable(false);
    }

    add(btnHats);
}
 
Example 20
Source File: BadgesScene.java    From YetAnotherPixelDungeon with GNU General Public License v3.0 4 votes vote down vote up
@Override
	public void create() {
		
		super.create();
		
		Music.INSTANCE.play( Assets.TRACK_MAIN_THEME, true );
		Music.INSTANCE.volume( 1f );
		
		uiCamera.visible = false;
		
		int w = Camera.main.width;
		int h = Camera.main.height;
		
		Archs archs = new Archs();
		archs.setSize( w, h );
		add( archs );
		
		int pw = Math.min( MAX_PANE_WIDTH, w - 6 );
		int ph = h - 30;
		
		NinePatch panel = Chrome.get( Chrome.Type.WINDOW );
		panel.size( pw, ph );
		panel.x = (w - pw) / 2;
		panel.y = (h - ph) / 2;
		add( panel );
		
		BitmapText title = PixelScene.createText( TXT_TITLE, 9 );
		title.hardlight( Window.TITLE_COLOR );
		title.measure();
		title.x = align( (w - title.width()) / 2 );
		title.y = align( (panel.y - title.baseLine()) / 2 );
		add( title );

		ScrollPane list = new BadgesList( true );
		add( list );

		list.setRect( 
			panel.x + panel.marginLeft(), 
			panel.y + panel.marginTop(), 
			panel.innerWidth(), 
			panel.innerHeight() );
		
		ExitButton btnExit = new ExitButton();
		btnExit.setPos( Camera.main.width - btnExit.width(), 0 );
		add( btnExit );
		
		fadeIn();
		
//		Badges.loadingListener = new Callback() {
//			@Override
//			public void call() {
//				if (Game.scene() == BadgesScene.this) {
//					YetAnotherPixelDungeon.switchNoFade(BadgesScene.class);
//				}
//			}
//		};
	}