Java Code Examples for com.watabou.gltextures.TextureCache#contains()

The following examples show how to use com.watabou.gltextures.TextureCache#contains() . 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 vote down vote up
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 vote down vote up
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 vote down vote up
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 vote down vote up
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 vote down vote up
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 vote down vote up
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: Halo.java    From shattered-pixel-dungeon-gdx with GNU General Public License v3.0 5 votes vote down vote up
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 );
}