Java Code Examples for com.watabou.noosa.Image#frame()

The following examples show how to use com.watabou.noosa.Image#frame() . 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: DungeonTilemap.java    From shattered-pixel-dungeon-gdx 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 2
Source File: BannerSprites.java    From shattered-pixel-dungeon-gdx 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, 132, 90 ) );
			break;
		case BOSS_SLAIN:
			icon.frame( icon.texture.uvRect( 0, 90, 128, 125 ) );
			break;
		case GAME_OVER:
			icon.frame( icon.texture.uvRect( 0, 125, 128, 160 ) );
			break;
		case SELECT_YOUR_HERO:
			icon.frame( icon.texture.uvRect( 0, 160, 128, 181 ) );
			break;
		case PIXEL_DUNGEON_SIGNS:
			icon.frame( icon.texture.uvRect( 133, 0, 255, 90 ) );
			break;
	}
	return icon;
}
 
Example 3
Source File: BannerSprites.java    From remixed-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.getBanners() );
	switch (type) {
	case PIXEL_DUNGEON:
		icon.frame( icon.texture.uvRect( 0, 0, 128, 98 ) );
		break;
	case BOSS_SLAIN:
		icon.frame( icon.texture.uvRect( 0, 98, 128, 133 ) );
		break;
	case GAME_OVER:
		icon.frame( icon.texture.uvRect( 0, 133, 128, 168 ) );
		break;
	case SELECT_YOUR_HERO:
		icon.frame( icon.texture.uvRect( 0, 168, 128, 189 ) );
		break;
	}
	return icon;
}
 
Example 4
Source File: WndInfoBuff.java    From unleashed-pixel-dungeon with GNU General Public License v3.0 6 votes vote down vote up
public WndInfoBuff(Buff buff){
	super();

	IconTitle titlebar = new IconTitle();

	icons = TextureCache.get( Assets.BUFFS_LARGE );
	film = new TextureFilm( icons, 16, 16 );

	Image buffIcon = new Image( icons );
	buffIcon.frame( film.get(buff.icon()) );

	titlebar.icon( buffIcon );
	titlebar.label( Utils.capitalize(buff.toString()), Window.TITLE_COLOR );
	titlebar.setRect( 0, 0, WIDTH, 0 );
	add( titlebar );

	BitmapTextMultiline txtInfo = PixelScene.createMultiline(buff.desc(), 6);
	txtInfo.maxWidth = WIDTH;
	txtInfo.measure();
	txtInfo.x = titlebar.left();
	txtInfo.y = titlebar.bottom() + GAP;
	add( txtInfo );

	resize( WIDTH, (int)(txtInfo.y + txtInfo.height()) );
}
 
Example 5
Source File: WndInfoBuff.java    From shattered-pixel-dungeon-gdx with GNU General Public License v3.0 6 votes vote down vote up
public WndInfoBuff(Buff buff){
	super();

	IconTitle titlebar = new IconTitle();

	icons = TextureCache.get( Assets.BUFFS_LARGE );
	film = new TextureFilm( icons, 16, 16 );

	Image buffIcon = new Image( icons );
	buffIcon.frame( film.get(buff.icon()) );
	buff.tintIcon(buffIcon);

	titlebar.icon( buffIcon );
	titlebar.label( Messages.titleCase(buff.toString()), Window.TITLE_COLOR );
	titlebar.setRect( 0, 0, WIDTH, 0 );
	add( titlebar );

	RenderedTextBlock txtInfo = PixelScene.renderTextBlock(buff.desc(), 6);
	txtInfo.maxWidth(WIDTH);
	txtInfo.setPos(titlebar.left(), titlebar.bottom() + 2*GAP);
	add( txtInfo );

	resize( WIDTH, (int)txtInfo.bottom() + 2 );
}
 
Example 6
Source File: BannerSprites.java    From unleashed-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 7
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 8
Source File: Effects.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.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 RAY:
		icon.frame( icon.texture.uvRect( 16, 16, 32, 24 ) );
		break;
	}
	return icon;
}
 
Example 9
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 10
Source File: WndInfoBuff.java    From shattered-pixel-dungeon with GNU General Public License v3.0 6 votes vote down vote up
public WndInfoBuff(Buff buff){
	super();

	IconTitle titlebar = new IconTitle();

	icons = TextureCache.get( Assets.Interfaces.BUFFS_LARGE );
	film = new TextureFilm( icons, 16, 16 );

	Image buffIcon = new Image( icons );
	buffIcon.frame( film.get(buff.icon()) );
	buff.tintIcon(buffIcon);

	titlebar.icon( buffIcon );
	titlebar.label( Messages.titleCase(buff.toString()), Window.TITLE_COLOR );
	titlebar.setRect( 0, 0, WIDTH, 0 );
	add( titlebar );

	RenderedTextBlock txtInfo = PixelScene.renderTextBlock(buff.desc(), 6);
	txtInfo.maxWidth(WIDTH);
	txtInfo.setPos(titlebar.left(), titlebar.bottom() + 2*GAP);
	add( txtInfo );

	resize( WIDTH, (int)txtInfo.bottom() + 2 );
}
 
Example 11
Source File: BannerSprites.java    From shattered-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.Interfaces.BANNERS );
	switch (type) {
		case PIXEL_DUNGEON:
			icon.frame( icon.texture.uvRect( 0, 0, 132, 90 ) );
			break;
		case BOSS_SLAIN:
			icon.frame( icon.texture.uvRect( 0, 90, 128, 125 ) );
			break;
		case GAME_OVER:
			icon.frame( icon.texture.uvRect( 0, 125, 128, 160 ) );
			break;
		case SELECT_YOUR_HERO:
			icon.frame( icon.texture.uvRect( 0, 160, 128, 181 ) );
			break;
		case PIXEL_DUNGEON_SIGNS:
			icon.frame( icon.texture.uvRect( 132, 0, 256, 90 ) );
			break;
	}
	return icon;
}
 
Example 12
Source File: Effects.java    From remixed-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 RAY:
		icon.frame( icon.texture.uvRect( 16, 16, 32, 24 ) );
		break;
	case CHAIN:
		icon.frame( icon.texture.uvRect( 16, 24, 32, 32 ) );
		break;
	case DEATHSTROKE:
		icon.frame( icon.texture.uvRect( 0, 16, 16, 24 ) );
		break;
	case DEVOUR:
		icon.frame( icon.texture.uvRect( 0, 24, 16, 32 ) );
		break;
	}
	return icon;
}
 
Example 13
Source File: VariativeDungeonTilemap.java    From remixed-dungeon with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Image tile(int pos) {
    CompositeImage img = new CompositeImage(getTexture());
    img.frame(getTileset().get(data[pos]));

    Image deco = new Image(getTexture());
    deco.frame(getTileset().get(mDecoMap[pos]));

    img.addLayer(deco);

    return img;
}
 
Example 14
Source File: Effects.java    From shattered-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.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 15
Source File: BuffIndicator.java    From shattered-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 );

	grey = new Image( TextureCache.createSolid(0xCC666666));
	add( grey );
}
 
Example 16
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 17
Source File: BuffIndicator.java    From shattered-pixel-dungeon-gdx 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 18
Source File: WndTabbed.java    From shattered-pixel-dungeon with GNU General Public License v3.0 4 votes vote down vote up
public IconTab( Image icon ){
	super();
	
	this.icon.copy(icon);
	this.defaultFrame = icon.frame();
}
 
Example 19
Source File: DungeonTilemap.java    From pixel-dungeon with GNU General Public License v3.0 4 votes vote down vote up
public static Image tile( int index ) {
	Image img = new Image( instance.texture );
	img.frame( instance.tileset.get( index ) );
	return img;
}
 
Example 20
Source File: Effects.java    From YetAnotherPixelDungeon with GNU General Public License v3.0 4 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 CHAIN:
               icon.frame( icon.texture.uvRect( 0, 16, 8, 24 ) );
               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 RAY:
               icon.frame( icon.texture.uvRect( 16, 16, 32, 24 ) );
               break;
           case DRAIN:
               icon.frame( icon.texture.uvRect( 16, 24, 32, 32 ) );
               break;
           case CONTROL:
               icon.frame( icon.texture.uvRect( 0, 24, 16, 32 ) );
               break;
           case DOOM:
               icon.frame( icon.texture.uvRect( 32, 0, 48, 16 ) );
               break;
           case CROSS:
               icon.frame( icon.texture.uvRect( 48, 0, 64, 16 ) );
               break;
           case BLAST:
               icon.frame( icon.texture.uvRect( 32, 16, 48, 32 ) );
               break;
           case SHOCK:
               icon.frame( icon.texture.uvRect( 48, 16, 64, 32 ) );
               break;
	}


	return icon;
}