Java Code Examples for com.watabou.gltextures.TextureCache#get()
The following examples show how to use
com.watabou.gltextures.TextureCache#get() .
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: TextureFilm.java From remixed-dungeon with GNU General Public License v3.0 | 6 votes |
public TextureFilm( Object tx, int width, int height ) { SmartTexture texture = TextureCache.get( tx ); texWidth = texture.width; texHeight = texture.height; float uw = (float)width / texWidth; float vh = (float)height / texHeight; int cols = texWidth / width; int rows = texHeight / height; for (int i=0; i < rows; i++) { for (int j=0; j < cols; j++) { RectF rect = new RectF( j * uw, i * vh, (j+1) * uw, (i+1) * vh ); add( i * cols + j, rect ); } } }
Example 2
Source File: NinePatch.java From shattered-pixel-dungeon-gdx with GNU General Public License v3.0 | 6 votes |
public NinePatch( Object tx, int x, int y, int w, int h, int left, int top, int right, int bottom ) { super( 0, 0, 0, 0 ); texture = TextureCache.get( tx ); w = w == 0 ? texture.width : w; h = h == 0 ? texture.height : h; nWidth = width = w; nHeight = height = h; vertices = new float[16]; quads = Quad.createSet( 9 ); marginLeft = left; marginRight = right; marginTop = top; marginBottom= bottom; outterF = texture.uvRect( x, y, x + w, y + h ); innerF = texture.uvRect( x + left, y + top, x + w - right, y + h - bottom ); updateVertices(); }
Example 3
Source File: TextureFilm.java From YetAnotherPixelDungeon with GNU General Public License v3.0 | 6 votes |
public TextureFilm( Object tx, int width, int height ) { SmartTexture texture = TextureCache.get( tx ); texWidth = texture.width; texHeight = texture.height; float uw = (float)width / texWidth; float vh = (float)height / texHeight; int cols = texWidth / width; int rows = texHeight / height; for (int i=0; i < rows; i++) { for (int j=0; j < cols; j++) { RectF rect = new RectF( j * uw, i * vh, (j+1) * uw, (i+1) * vh ); add( i * cols + j, rect ); } } }
Example 4
Source File: WndInfoBuff.java From unleashed-pixel-dungeon with GNU General Public License v3.0 | 6 votes |
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: ItemSprite.java From YetAnotherPixelDungeon with GNU General Public License v3.0 | 5 votes |
public static int pick( int index, int x, int y ) { Bitmap bmp = TextureCache.get( Assets.ITEMS ).bitmap; int rows = bmp.getWidth() / SIZE; int row = index / rows; int col = index % rows; return bmp.getPixel( col * SIZE + x, row * SIZE + y ); }
Example 6
Source File: HeroSprite.java From shattered-pixel-dungeon-gdx with GNU General Public License v3.0 | 5 votes |
public static TextureFilm tiers() { if (tiers == null) { SmartTexture texture = TextureCache.get( Assets.ROGUE ); tiers = new TextureFilm( texture, texture.width, FRAME_HEIGHT ); } return tiers; }
Example 7
Source File: HeroSprite.java From shattered-pixel-dungeon with GNU General Public License v3.0 | 5 votes |
public static TextureFilm tiers() { if (tiers == null) { SmartTexture texture = TextureCache.get( Assets.Sprites.ROGUE ); tiers = new TextureFilm( texture, texture.width, FRAME_HEIGHT ); } return tiers; }
Example 8
Source File: Spell.java From remixed-dungeon with GNU General Public License v3.0 | 5 votes |
public Image image(Char caster) { val texture = TextureCache.get(texture()); var spellImage = new Image(texture); spellImage.frame(new TextureFilm(texture, 16, 16).get(getImage(caster))); return spellImage; }
Example 9
Source File: ItemSprite.java From shattered-pixel-dungeon with GNU General Public License v3.0 | 5 votes |
public static int pick( int index, int x, int y ) { SmartTexture tx = TextureCache.get( Assets.Sprites.ITEMS ); int rows = tx.width / SIZE; int row = index / rows; int col = index % rows; return tx.getPixel( col * SIZE + x, row * SIZE + y ); }
Example 10
Source File: ItemSprite.java From pixel-dungeon with GNU General Public License v3.0 | 5 votes |
public static int pick( int index, int x, int y ) { Bitmap bmp = TextureCache.get( Assets.ITEMS ).bitmap; int rows = bmp.getWidth() / SIZE; int row = index / rows; int col = index % rows; return bmp.getPixel( col * SIZE + x, row * SIZE + y ); }
Example 11
Source File: HeroSprite.java From pixel-dungeon with GNU General Public License v3.0 | 5 votes |
public static TextureFilm tiers() { if (tiers == null) { SmartTexture texture = TextureCache.get( Assets.ROGUE ); tiers = new TextureFilm( texture, texture.width, FRAME_HEIGHT ); } return tiers; }
Example 12
Source File: Image.java From shattered-pixel-dungeon with GNU General Public License v3.0 | 4 votes |
public void texture( Object tx ) { texture = tx instanceof SmartTexture ? (SmartTexture)tx : TextureCache.get( tx ); frame( new RectF( 0, 0, 1, 1 ) ); }
Example 13
Source File: Image.java From remixed-dungeon with GNU General Public License v3.0 | 4 votes |
public void texture( Object tx ) { texture = tx instanceof SmartTexture ? (SmartTexture)tx : TextureCache.get( tx ); frame( new RectF( 0, 0, 1, 1 ) ); }
Example 14
Source File: BitmapText.java From shattered-pixel-dungeon with GNU General Public License v3.0 | 4 votes |
public static Font colorMarked( Pixmap bmp, int color, String chars ) { Font font = new Font( TextureCache.get( bmp ) ); font.splitBy( bmp, bmp.getHeight(), color, chars ); return font; }
Example 15
Source File: BitmapText.java From shattered-pixel-dungeon-gdx with GNU General Public License v3.0 | 4 votes |
public static Font colorMarked( Pixmap bmp, int color, String chars ) { Font font = new Font( TextureCache.get( bmp ) ); font.splitBy( bmp, bmp.getHeight(), color, chars ); return font; }
Example 16
Source File: BitmapText.java From YetAnotherPixelDungeon with GNU General Public License v3.0 | 4 votes |
public static Font colorMarked( Bitmap bmp, int height, int color, String chars ) { Font font = new Font( TextureCache.get( bmp ) ); font.splitBy( bmp, height, color, chars ); return font; }
Example 17
Source File: BitmapText.java From YetAnotherPixelDungeon with GNU General Public License v3.0 | 4 votes |
public static Font colorMarked( Bitmap bmp, int color, String chars ) { Font font = new Font( TextureCache.get( bmp ) ); font.splitBy( bmp, bmp.getHeight(), color, chars ); return font; }
Example 18
Source File: BuffIndicator.java From YetAnotherPixelDungeon with GNU General Public License v3.0 | 4 votes |
@Override protected void createChildren() { texture = TextureCache.get( Assets.BUFFS_SMALL ); film = new TextureFilm( texture, SIZE, SIZE ); }
Example 19
Source File: TextureFilm.java From remixed-dungeon with GNU General Public License v3.0 | 3 votes |
public TextureFilm( Object tx ) { SmartTexture texture = TextureCache.get( tx ); texWidth = texture.width; texHeight = texture.height; }
Example 20
Source File: Tilemap.java From PD-classes with GNU General Public License v3.0 | 3 votes |
public Tilemap( Object tx, TextureFilm tileset ) { super( 0, 0, 0, 0 ); this.texture = TextureCache.get( tx ); this.tileset = tileset; RectF r = tileset.get( 0 ); cellW = tileset.width( r ); cellH = tileset.height( r ); vertices = new float[16]; updated = new Rect(); }