Java Code Examples for com.watabou.gltextures.TextureCache#add()
The following examples show how to use
com.watabou.gltextures.TextureCache#add() .
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: Halo.java From YetAnotherPixelDungeon with GNU General Public License v3.0 | 6 votes |
public Halo() { super(); if (!TextureCache.contains( CACHE_KEY )) { Bitmap bmp = Bitmap.createBitmap( RADIUS * 2, RADIUS * 2, Bitmap.Config.ARGB_8888 ); Canvas canvas = new Canvas( bmp ); Paint paint = new Paint(); paint.setColor( 0xFFFFFFFF ); canvas.drawCircle( RADIUS, RADIUS, RADIUS * 0.75f, paint ); paint.setColor( 0x88FFFFFF ); canvas.drawCircle( RADIUS, RADIUS, RADIUS, paint ); TextureCache.add( CACHE_KEY, new SmartTexture( bmp ) ); } texture( CACHE_KEY ); origin.set( RADIUS ); }
Example 2
Source File: Halo.java From unleashed-pixel-dungeon with GNU General Public License v3.0 | 6 votes |
public Halo() { super(); if (!TextureCache.contains( CACHE_KEY )) { Bitmap bmp = Bitmap.createBitmap( RADIUS * 2, RADIUS * 2, Bitmap.Config.ARGB_8888 ); Canvas canvas = new Canvas( bmp ); Paint paint = new Paint(); paint.setColor( 0xFFFFFFFF ); canvas.drawCircle( RADIUS, RADIUS, RADIUS * 0.75f, paint ); paint.setColor( 0x88FFFFFF ); canvas.drawCircle( RADIUS, RADIUS, RADIUS, paint ); TextureCache.add( CACHE_KEY, new SmartTexture( bmp ) ); } texture( CACHE_KEY ); origin.set( RADIUS ); }
Example 3
Source File: Halo.java From pixel-dungeon with GNU General Public License v3.0 | 6 votes |
public Halo() { super(); if (!TextureCache.contains( CACHE_KEY )) { Bitmap bmp = Bitmap.createBitmap( RADIUS * 2, RADIUS * 2, Bitmap.Config.ARGB_8888 ); Canvas canvas = new Canvas( bmp ); Paint paint = new Paint(); paint.setColor( 0xFFFFFFFF ); canvas.drawCircle( RADIUS, RADIUS, RADIUS * 0.75f, paint ); paint.setColor( 0x88FFFFFF ); canvas.drawCircle( RADIUS, RADIUS, RADIUS, paint ); TextureCache.add( CACHE_KEY, new SmartTexture( bmp ) ); } texture( CACHE_KEY ); origin.set( RADIUS ); }
Example 4
Source File: CircleMask.java From remixed-dungeon with GNU General Public License v3.0 | 6 votes |
public static void ensureTexture() { if (!TextureCache.contains( CACHE_KEY )) { Bitmap bmp = Bitmap.createBitmap( RADIUS * 2, RADIUS * 2, Bitmap.Config.ARGB_8888 ); Canvas canvas = new Canvas( bmp ); Paint paint = new Paint(); canvas.drawColor(Color.WHITE, PorterDuff.Mode.SRC); paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC)); paint.setColor( 0xf7ffffff); canvas.drawCircle( RADIUS, RADIUS, RADIUS, paint ); paint.setColor( 0x77ffffff); canvas.drawCircle( RADIUS, RADIUS, RADIUS*0.75f, paint ); paint.setColor( 0x00ffffff); canvas.drawCircle( RADIUS, RADIUS, RADIUS*0.5f, paint ); TextureCache.add( CACHE_KEY, new SmartTexture( bmp ) ); } }
Example 5
Source File: Halo.java From remixed-dungeon with GNU General Public License v3.0 | 6 votes |
public Halo() { if (!TextureCache.contains( CACHE_KEY )) { Bitmap bmp = Bitmap.createBitmap( RADIUS * 2, RADIUS * 2, Bitmap.Config.ARGB_8888 ); Canvas canvas = new Canvas( bmp ); Paint paint = new Paint(); paint.setColor( 0xFFFFFFFF ); canvas.drawCircle( RADIUS, RADIUS, RADIUS * 0.75f, paint ); paint.setColor( 0x88FFFFFF ); canvas.drawCircle( RADIUS, RADIUS, RADIUS, paint ); TextureCache.add( CACHE_KEY, new SmartTexture( bmp ) ); } texture( CACHE_KEY ); origin.set( RADIUS ); }
Example 6
Source File: Halo.java From shattered-pixel-dungeon with GNU General Public License v3.0 | 5 votes |
public Halo() { super(); if (!TextureCache.contains( CACHE_KEY )) { Pixmap pixmap = new Pixmap(2*RADIUS+1, 2*RADIUS+1, Pixmap.Format.RGBA8888); pixmap.setColor( 0xFFFFFF08 ); for (int i = 0; i < RADIUS; i+=2) { pixmap.fillCircle(RADIUS, RADIUS, (RADIUS - i)); } TextureCache.add( CACHE_KEY, new SmartTexture( pixmap ) ); } texture( CACHE_KEY ); }
Example 7
Source File: FogOfWar.java From shattered-pixel-dungeon with GNU General Public License v3.0 | 5 votes |
public FogOfWar( int mapWidth, int mapHeight ) { super(); this.mapWidth = mapWidth; this.mapHeight = mapHeight; mapLength = mapHeight * mapWidth; pWidth = mapWidth * PIX_PER_TILE; pHeight = mapHeight * PIX_PER_TILE; width2 = 1; while (width2 < pWidth) { width2 <<= 1; } height2 = 1; while (height2 < pHeight) { height2 <<= 1; } float size = DungeonTilemap.SIZE / PIX_PER_TILE; width = width2 * size; height = height2 * size; //TODO might be nice to compartmentalize the pixmap access and modification into texture/texturecache Pixmap px = new Pixmap(width2, height2, Pixmap.Format.RGBA8888); px.setBlending(Pixmap.Blending.None); px.setColor(0x000000FF); px.fill(); SmartTexture tx = new SmartTexture(px, Texture.LINEAR, Texture.CLAMP, false); TextureCache.add(FogOfWar.class, tx); texture( tx ); scale.set( size, size ); toUpdate = new ArrayList<>(); toUpdate.add(new Rect(0, 0, mapWidth, mapHeight)); }
Example 8
Source File: Halo.java From shattered-pixel-dungeon-gdx with GNU General Public License v3.0 | 5 votes |
public Halo() { super(); if (!TextureCache.contains( CACHE_KEY )) { Pixmap pixmap = new Pixmap(RADIUS * 2, RADIUS * 2, Pixmap.Format.RGBA8888); pixmap.setColor( 0xFFFFFF0A ); for (int i = 0; i < 50; i++) { pixmap.fillCircle(RADIUS, RADIUS, (int)(RADIUS * (i+1)/50f)); } TextureCache.add( CACHE_KEY, new SmartTexture( pixmap ) ); } texture( CACHE_KEY ); }
Example 9
Source File: FogOfWar.java From shattered-pixel-dungeon-gdx with GNU General Public License v3.0 | 5 votes |
public FogOfWar( int mapWidth, int mapHeight ) { super(); this.mapWidth = mapWidth; this.mapHeight = mapHeight; mapLength = mapHeight * mapWidth; pWidth = mapWidth * PIX_PER_TILE; pHeight = mapHeight * PIX_PER_TILE; width2 = 1; while (width2 < pWidth) { width2 <<= 1; } height2 = 1; while (height2 < pHeight) { height2 <<= 1; } float size = DungeonTilemap.SIZE / PIX_PER_TILE; width = width2 * size; height = height2 * size; BufferTexture tx = new BufferTexture(width2, height2); TextureCache.add(FogOfWar.class, tx); texture( tx ); scale.set( DungeonTilemap.SIZE / PIX_PER_TILE, DungeonTilemap.SIZE / PIX_PER_TILE); toUpdate = new ArrayList<>(); toUpdate.add(new Rect(0, 0, mapWidth, mapHeight)); }
Example 10
Source File: FogOfWar.java From YetAnotherPixelDungeon with GNU General Public License v3.0 | 4 votes |
public FogTexture() { super( Bitmap.createBitmap( width2, height2, Bitmap.Config.ARGB_8888 ) ); filter( Texture.LINEAR, Texture.LINEAR ); TextureCache.add( FogOfWar.class, this ); }
Example 11
Source File: FogOfWar.java From unleashed-pixel-dungeon with GNU General Public License v3.0 | 4 votes |
public FogTexture() { super( Bitmap.createBitmap( width2, height2, Bitmap.Config.ARGB_8888 ) ); filter( Texture.LINEAR, Texture.LINEAR ); TextureCache.add( FogOfWar.class, this ); }
Example 12
Source File: FogOfWar.java From pixel-dungeon with GNU General Public License v3.0 | 4 votes |
public FogTexture() { super( Bitmap.createBitmap( width2, height2, Bitmap.Config.ARGB_8888 ) ); filter( Texture.LINEAR, Texture.LINEAR ); TextureCache.add( FogOfWar.class, this ); }
Example 13
Source File: FogOfWar.java From remixed-dungeon with GNU General Public License v3.0 | 4 votes |
public FogTexture() { super( Bitmap.createBitmap( width2, height2, Bitmap.Config.ARGB_8888 ) ); filter( Texture.LINEAR, Texture.LINEAR ); TextureCache.add( FogOfWar.class, this ); }