com.watabou.noosa.Image Java Examples

The following examples show how to use com.watabou.noosa.Image. 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: BannerSprites.java    From pixel-dungeon with GNU General Public License v3.0 6 votes vote down vote up
public static Image get( Type type ) {
	Image icon = new Image( Assets.BANNERS );
	switch (type) {
	case PIXEL_DUNGEON:
		icon.frame( icon.texture.uvRect( 0, 0, 128, 70 ) );
		break;
	case BOSS_SLAIN:
		icon.frame( icon.texture.uvRect( 0, 70, 128, 105 ) );
		break;
	case GAME_OVER:
		icon.frame( icon.texture.uvRect( 0, 105, 128, 140 ) );
		break;
	case SELECT_YOUR_HERO:
		icon.frame( icon.texture.uvRect( 0, 140, 128, 161 ) );
		break;
	case PIXEL_DUNGEON_SIGNS:
		icon.frame( icon.texture.uvRect( 0, 161, 128, 218 ) );
		break;
	}
	return icon;
}
 
Example #2
Source File: WndJournal.java    From shattered-pixel-dungeon with GNU General Public License v3.0 6 votes vote down vote up
public ListItem( Image icon, String text, int d ) {
	super();
	
	this.icon.copy(icon);
	
	label.text( text );
	
	if (d >= 0) {
		depth.text(Integer.toString(d));
		depth.measure();
		
		if (d == Dungeon.depth) {
			label.hardlight(TITLE_COLOR);
			depth.hardlight(TITLE_COLOR);
		}
	}
}
 
Example #3
Source File: TerrainFeaturesTilemap.java    From shattered-pixel-dungeon with GNU General Public License v3.0 6 votes vote down vote up
public void growPlant( final int pos ){
	final Image plant = tile( pos, map[pos] );
	if (plant == null) return;
	
	plant.origin.set( 8, 12 );
	plant.scale.set( 0 );
	plant.point( DungeonTilemap.tileToWorld( pos ) );

	parent.add( plant );

	parent.add( new ScaleTweener( plant, new PointF(1, 1), 0.2f ) {
		protected void onComplete() {
			plant.killAndErase();
			killAndErase();
			updateMapCell(pos);
		}
	} );
}
 
Example #4
Source File: DungeonTilemap.java    From shattered-pixel-dungeon with GNU General Public License v3.0 6 votes vote down vote up
public void discover( int pos, int oldValue ) {
	
	int visual = getTileVisual( pos, oldValue, false);
	if (visual < 0) return;
	
	final Image tile = new Image( texture );
	tile.frame( tileset.get( getTileVisual( pos, oldValue, false)));
	tile.point( tileToWorld( pos ) );

	parent.add( tile );
	
	parent.add( new AlphaTweener( tile, 0, 0.6f ) {
		protected void onComplete() {
			tile.killAndErase();
			killAndErase();
		}
	} );
}
 
Example #5
Source File: TerrainFeaturesTilemap.java    From shattered-pixel-dungeon-gdx with GNU General Public License v3.0 6 votes vote down vote up
public void growPlant( final int pos ){
	final Image plant = tile( pos, map[pos] );
	if (plant == null) return;
	
	plant.origin.set( 8, 12 );
	plant.scale.set( 0 );
	plant.point( DungeonTilemap.tileToWorld( pos ) );

	parent.add( plant );

	parent.add( new ScaleTweener( plant, new PointF(1, 1), 0.2f ) {
		protected void onComplete() {
			plant.killAndErase();
			killAndErase();
			updateMapCell(pos);
		}
	} );
}
 
Example #6
Source File: WndJournal.java    From shattered-pixel-dungeon-gdx with GNU General Public License v3.0 6 votes vote down vote up
public ListItem( Image icon, String text, int d ) {
	super();
	
	this.icon.copy(icon);
	
	label.text( text );
	
	if (d >= 0) {
		depth.text(Integer.toString(d));
		depth.measure();
		
		if (d == Dungeon.depth) {
			label.hardlight(TITLE_COLOR);
			depth.hardlight(TITLE_COLOR);
		}
	}
}
 
Example #7
Source File: WndDocument.java    From shattered-pixel-dungeon-gdx with GNU General Public License v3.0 6 votes vote down vote up
public ListItem( Image icon, String text, int d ) {
	super();
	
	this.icon.copy(icon);
	
	label.text( text );
	
	if (d >= 0) {
		depth.text(Integer.toString(d));
		depth.measure();
		
		if (d == Dungeon.depth) {
			label.hardlight(TITLE_COLOR);
			depth.hardlight(TITLE_COLOR);
		}
	}
}
 
Example #8
Source File: WndDocument.java    From shattered-pixel-dungeon with GNU General Public License v3.0 6 votes vote down vote up
public ListItem( Image icon, String text, int d ) {
	super();
	
	this.icon.copy(icon);
	
	label.text( text );
	
	if (d >= 0) {
		depth.text(Integer.toString(d));
		depth.measure();
		
		if (d == Dungeon.depth) {
			label.hardlight(TITLE_COLOR);
			depth.hardlight(TITLE_COLOR);
		}
	}
}
 
Example #9
Source File: StartScene.java    From unleashed-pixel-dungeon with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void createChildren() {

	super.createChildren();

	avatar = new Image( Assets.AVATARS );
	add( avatar );

	name = PixelScene.createText( 9 );
	add( name );

	emitter = new Emitter();
	add( emitter );
}
 
Example #10
Source File: BadgesScene.java    From shattered-pixel-dungeon-gdx with GNU General Public License v3.0 5 votes vote down vote up
public BadgeButton( Badges.Badge badge ) {
	super();

	this.badge = badge;
	active = (badge != null);

	icon = active ? BadgeBanner.image(badge.image) : new Image( Assets.LOCKED );
	add(icon);

	setSize( icon.width(), icon.height() );
}
 
Example #11
Source File: SimpleButton.java    From shattered-pixel-dungeon with GNU General Public License v3.0 5 votes vote down vote up
public SimpleButton( Image image ) {
	super();
	
	this.image.copy( image );
	width = image.width;
	height = image.height;
}
 
Example #12
Source File: WndBag.java    From unleashed-pixel-dungeon with GNU General Public License v3.0 5 votes vote down vote up
private Image icon() {
	if (bag instanceof SeedPouch) {
		return Icons.get( Icons.SEED_POUCH );
	} else if (bag instanceof ScrollHolder) {
		return Icons.get( Icons.SCROLL_HOLDER );
	} else if (bag instanceof WandHolster) {
		return Icons.get( Icons.WAND_HOLSTER );
	} else if (bag instanceof PotionBandolier) {
		return Icons.get( Icons.POTION_BANDOLIER );
	} else if (bag instanceof AnkhChain) {
		return Icons.get(Icons.ANKH_CHAIN);
	} else {
		return Icons.get( Icons.BACKPACK );
	}
}
 
Example #13
Source File: RankingsScene.java    From YetAnotherPixelDungeon with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void createChildren() {

    super.createChildren();

    image = new Image();
    add( image );
}
 
Example #14
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 #15
Source File: BuffIndicator.java    From unleashed-pixel-dungeon with GNU General Public License v3.0 5 votes vote down vote up
public BuffIcon( Buff buff ){
	super();
	this.buff = buff;

	icon = new Image( texture );
	icon.frame( film.get( buff.icon() ) );
	add( icon );
}
 
Example #16
Source File: SewerBossExitRoom.java    From shattered-pixel-dungeon with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Image image(int tileX, int tileY) {
	if ((tileX == 1 && tileY == 0) || tileY == 2){
		return null;
	}
	return super.image(tileX, tileY);
}
 
Example #17
Source File: BitmaskEmitter.java    From PD-classes with GNU General Public License v3.0 5 votes vote down vote up
public BitmaskEmitter( Image target ) {
	super();

	this.target = target;

	map = target.texture;
	mapW = map.bitmap.getWidth();
	mapH = map.bitmap.getHeight();
}
 
Example #18
Source File: ChangesWindow.java    From shattered-pixel-dungeon-gdx with GNU General Public License v3.0 5 votes vote down vote up
public ChangesWindow(Image icon, String title, String message ) {
	super( icon, title, message);
	
	TouchArea blocker = new TouchArea( 0, 0, PixelScene.uiCamera.width, PixelScene.uiCamera.height ) {
		@Override
		protected void onClick( NoosaInputProcessor.Touch touch ) {
			hide();
		}
	};
	blocker.camera = PixelScene.uiCamera;
	add(blocker);
	
}
 
Example #19
Source File: SewerBossExitRoom.java    From shattered-pixel-dungeon-gdx with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Image image(int tileX, int tileY) {
	if ((tileX == 1 && tileY == 0) || tileY == 2){
		return null;
	}
	return super.image(tileX, tileY);
}
 
Example #20
Source File: Lightning.java    From unleashed-pixel-dungeon with GNU General Public License v3.0 5 votes vote down vote up
public Arc(int from, int to){
	start = DungeonTilemap.tileCenterToWorld(from);
	end = DungeonTilemap.tileCenterToWorld(to);

	arc1 = new Image(Effects.get(Effects.Type.LIGHTNING));
	arc1.x = start.x - arc1.origin.x;
	arc1.y = start.y - arc1.origin.y;
	arc1.origin.set( 0, arc1.height()/2 );
	add( arc1 );

	arc2 = new Image(Effects.get(Effects.Type.LIGHTNING));
	arc2.origin.set( 0, arc2.height()/2 );
	add( arc2 );

}
 
Example #21
Source File: Effects.java    From unleashed-pixel-dungeon with GNU General Public License v3.0 5 votes vote down vote up
public static Image get( Type type ) {
	Image icon = new Image( Assets.EFFECTS );
	switch (type) {
		case RIPPLE:
			icon.frame(icon.texture.uvRect(0, 0, 16, 16));
			break;
		case LIGHTNING:
			icon.frame(icon.texture.uvRect(16, 0, 32, 8));
			break;
		case WOUND:
			icon.frame(icon.texture.uvRect(16, 8, 32, 16));
			break;
		case EXCLAMATION:
			icon.frame(icon.texture.uvRect(0, 16, 6, 25));
			break;
		case CHAIN:
			icon.frame(icon.texture.uvRect(6, 16, 11, 22));
			break;
		case DEATH_RAY:
			icon.frame(icon.texture.uvRect(16, 16, 32, 24));
			break;
		case LIGHT_RAY:
			icon.frame(icon.texture.uvRect(16, 23, 32, 31));
			break;
		case HEALTH_RAY:
			icon.frame(icon.texture.uvRect(16, 30, 32, 38));
			break;
	}
	return icon;
}
 
Example #22
Source File: Chains.java    From unleashed-pixel-dungeon with GNU General Public License v3.0 5 votes vote down vote up
public Chains(PointF from, PointF to, Callback callback){
	super();

	this.callback = callback;

	this.from = from;
	this.to = to;

	float dx = to.x - from.x;
	float dy = to.y - from.y;
	distance = (float)Math.hypot(dx, dy);


	duration = distance/300f + 0.1f;

	rotation = (float)(Math.atan2( dy, dx ) * A) + 90f;

	numChains = Math.round(distance/6f)+1;

	chains = new Image[numChains];
	for (int i = 0; i < chains.length; i++){
		chains[i] = new Image(Effects.get(Effects.Type.CHAIN));
		chains[i].angle = rotation;
		chains[i].origin.set( chains[i].width()/ 2, chains[i].height() );
		add(chains[i]);
	}
}
 
Example #23
Source File: TitleScene.java    From pixel-dungeon with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void createChildren() {
	super.createChildren();
	
	image = new Image( Assets.DASHBOARD );
	add( image );
	
	label = createText( 9 );
	add( label );
}
 
Example #24
Source File: BadgesScene.java    From pixel-dungeon with GNU General Public License v3.0 5 votes vote down vote up
public BadgeButton( Badges.Badge badge ) {
	super();

	this.badge = badge;
	active = (badge != null);

	icon = active ? BadgeBanner.image( badge.image ) : new Image( Assets.LOCKED );
	add(icon);

	setSize( icon.width(), icon.height() );
}
 
Example #25
Source File: WndBag.java    From pixel-dungeon with GNU General Public License v3.0 5 votes vote down vote up
private Image icon() {
	if (bag instanceof SeedPouch) {
		return Icons.get( Icons.SEED_POUCH );
	} else if (bag instanceof ScrollHolder) {
		return Icons.get( Icons.SCROLL_HOLDER );
	} else if (bag instanceof WandHolster) {
		return Icons.get( Icons.WAND_HOLSTER );
	} else if (bag instanceof Keyring) {
		return Icons.get( Icons.KEYRING );
	} else {
		return Icons.get( Icons.BACKPACK );
	}
}
 
Example #26
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 #27
Source File: HealthIndicator.java    From pixel-dungeon with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void createChildren() {
	bg = new Image( TextureCache.createSolid( 0xFFcc0000 ) );
	bg.scale.y = HEIGHT;
	add( bg );
	
	level = new Image( TextureCache.createSolid( 0xFF00cc00 ) );
	level.scale.y = HEIGHT;
	add( level );
}
 
Example #28
Source File: BadgesList.java    From pixel-dungeon with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void createChildren() {
	icon = new Image();
	add( icon );
	
	label = PixelScene.createText( 6 );
	add( label );
}
 
Example #29
Source File: StatusPane.java    From pixel-dungeon with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void createChildren() {
	super.createChildren();
	
	image = new Image( Assets.STATUS, 114, 3, 12, 11 );
	add( image );
}
 
Example #30
Source File: SimpleButton.java    From pixel-dungeon with GNU General Public License v3.0 5 votes vote down vote up
public SimpleButton( Image image ) {
	super();
	
	this.image.copy( image );
	width = image.width;
	height = image.height;
}