com.watabou.glwrap.Texture Java Examples

The following examples show how to use com.watabou.glwrap.Texture. 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: BufferTexture.java    From shattered-pixel-dungeon-gdx with GNU General Public License v3.0 6 votes vote down vote up
public void update(){
	bind();
	filter( Texture.LINEAR, Texture.LINEAR );
	wrap( Texture.CLAMP, Texture.CLAMP);
	pixels.position(0);
	Gdx.gl.glTexImage2D(
			GL20.GL_TEXTURE_2D,
			0,
			GL20.GL_RGBA,
			width,
			height,
			0,
			GL20.GL_RGBA,
			GL20.GL_UNSIGNED_BYTE,
			pixels );
}
 
Example #2
Source File: TextureCache.java    From shattered-pixel-dungeon-gdx with GNU General Public License v3.0 5 votes vote down vote up
public synchronized static void clear() {
	
	for (Texture txt : all.values()) {
		txt.delete();
	}
	all.clear();
	
}
 
Example #3
Source File: TextureCache.java    From PD-classes with GNU General Public License v3.0 5 votes vote down vote up
public static void clear() {
	
	for (Texture txt:all.values()) {
		txt.delete();
	}
	all.clear();
	
}
 
Example #4
Source File: TextureCache.java    From remixed-dungeon with GNU General Public License v3.0 5 votes vote down vote up
public static void clear() {

		for (Texture txt : all.values()) {
			txt.delete();
		}
		all.clear();

	}
 
Example #5
Source File: CompositeMovieClip.java    From remixed-dungeon with GNU General Public License v3.0 5 votes vote down vote up
protected void addLayer(String id, Texture img) {
	if (mLayers == null) {
		mLayers = new ArrayList<>();
	}

	LayerDesc layerDesc = new LayerDesc(id, img);
	mLayers.add(layerDesc);
}
 
Example #6
Source File: BufferTexture.java    From shattered-pixel-dungeon-gdx with GNU General Public License v3.0 5 votes vote down vote up
public void update(int top, int bottom){
	bind();
	filter( Texture.LINEAR, Texture.LINEAR );
	wrap( Texture.CLAMP, Texture.CLAMP);
	pixels.position(top*width);
	Gdx.gl.glTexSubImage2D(GL20.GL_TEXTURE_2D,
			0,
			0,
			top,
			width,
			bottom - top,
			GL20.GL_RGBA,
			GL20.GL_UNSIGNED_BYTE,
			pixels);
}
 
Example #7
Source File: CompositeTextureImage.java    From remixed-dungeon with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void draw() {

	super.draw();

	NoosaScript script = NoosaScript.get();

	for (Texture img : mLayers) {
		img.bind();
		script.drawQuad(getVerticesBuffer());
	}
}
 
Example #8
Source File: FogOfWar.java    From shattered-pixel-dungeon with GNU General Public License v3.0 5 votes vote down vote up
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 #9
Source File: TextureCache.java    From shattered-pixel-dungeon with GNU General Public License v3.0 5 votes vote down vote up
public synchronized static void clear() {
	
	for (Texture txt : all.values()) {
		txt.delete();
	}
	all.clear();
	
}
 
Example #10
Source File: TextureCache.java    From YetAnotherPixelDungeon with GNU General Public License v3.0 5 votes vote down vote up
public static void clear() {
	
	for (Texture txt:all.values()) {
		txt.delete();
	}
	all.clear();
	
}
 
Example #11
Source File: CompositeTextureImage.java    From remixed-dungeon with GNU General Public License v3.0 4 votes vote down vote up
public void addLayer(Texture img) {
	mLayers.add(img);
}
 
Example #12
Source File: TextureCache.java    From shattered-pixel-dungeon with GNU General Public License v3.0 4 votes vote down vote up
public synchronized static SmartTexture createGradient( int... colors ) {
	
	final String key = "" + colors;
	
	if (all.containsKey( key )) {
		
		return all.get( key );
		
	} else {
		
		Pixmap pixmap = new Pixmap( colors.length, 1, Pixmap.Format.RGBA8888);
		for (int i=0; i < colors.length; i++) {
			// In the rest of the code ARGB is used
			pixmap.drawPixel( i, 0, (colors[i] << 8) | (colors[i] >>> 24) );
		}
		SmartTexture tx = new SmartTexture( pixmap );

		tx.filter( Texture.LINEAR, Texture.LINEAR );
		tx.wrap( Texture.CLAMP, Texture.CLAMP );

		all.put( key, tx );
		return tx;
	}
	
}
 
Example #13
Source File: TextureCache.java    From shattered-pixel-dungeon-gdx with GNU General Public License v3.0 4 votes vote down vote up
public synchronized static SmartTexture createGradient( int... colors ) {

		final String key = "" + colors;

		if (all.containsKey( key )) {

			return all.get( key );

		} else {

			Pixmap pixmap = new Pixmap( colors.length, 1, Pixmap.Format.RGBA8888);
			for (int i=0; i < colors.length; i++) {
				// In the rest of the code ARGB is used
				pixmap.drawPixel( i, 0, (colors[i] << 8) | (colors[i] >>> 24) );
			}
			SmartTexture tx = new SmartTexture( pixmap );

			tx.filter( Texture.LINEAR, Texture.LINEAR );
			tx.wrap( Texture.CLAMP, Texture.CLAMP );

			all.put( key, tx );
			return tx;
		}

	}
 
Example #14
Source File: FogOfWar.java    From YetAnotherPixelDungeon with GNU General Public License v3.0 4 votes vote down vote up
public FogTexture() {
	super( Bitmap.createBitmap( width2, height2, Bitmap.Config.ARGB_8888 ) );
	filter( Texture.LINEAR, Texture.LINEAR );
	TextureCache.add( FogOfWar.class, this );
}
 
Example #15
Source File: CompositeMovieClip.java    From remixed-dungeon with GNU General Public License v3.0 4 votes vote down vote up
LayerDesc(String _id, Texture _tex) {
	id = _id;
	texture = _tex;
}
 
Example #16
Source File: FogOfWar.java    From pixel-dungeon with GNU General Public License v3.0 4 votes vote down vote up
public FogTexture() {
	super( Bitmap.createBitmap( width2, height2, Bitmap.Config.ARGB_8888 ) );
	filter( Texture.LINEAR, Texture.LINEAR );
	TextureCache.add( FogOfWar.class, this );
}
 
Example #17
Source File: FogOfWar.java    From remixed-dungeon with GNU General Public License v3.0 4 votes vote down vote up
public FogTexture() {
	super( Bitmap.createBitmap( width2, height2, Bitmap.Config.ARGB_8888 ) );
	filter( Texture.LINEAR, Texture.LINEAR );
	TextureCache.add( FogOfWar.class, this );
}
 
Example #18
Source File: FogOfWar.java    From unleashed-pixel-dungeon with GNU General Public License v3.0 4 votes vote down vote up
public FogTexture() {
	super( Bitmap.createBitmap( width2, height2, Bitmap.Config.ARGB_8888 ) );
	filter( Texture.LINEAR, Texture.LINEAR );
	TextureCache.add( FogOfWar.class, this );
}
 
Example #19
Source File: SystemTextLine.java    From remixed-dungeon with GNU General Public License v3.0 3 votes vote down vote up
public SystemTextLine(Bitmap bitmap) {
	this();

	texture = new SmartTexture(bitmap, Texture.LINEAR, Texture.CLAMP);

	frame( new RectF( 0, 0, 1, 1 ) );
}
 
Example #20
Source File: SkinnedBlock.java    From shattered-pixel-dungeon-gdx with GNU General Public License v3.0 3 votes vote down vote up
public SkinnedBlock( float width, float height, Object tx ) {
	super( tx );
	
	texture.wrap( Texture.REPEAT, Texture.REPEAT );
	
	size( width, height );
}
 
Example #21
Source File: SkinnedBlock.java    From PD-classes with GNU General Public License v3.0 3 votes vote down vote up
public SkinnedBlock( float width, float height, Object tx ) {
	super( tx );
	
	texture.wrap( Texture.REPEAT, Texture.REPEAT );
	
	size( width, height );
}
 
Example #22
Source File: SkinnedBlock.java    From remixed-dungeon with GNU General Public License v3.0 3 votes vote down vote up
public SkinnedBlock( float width, float height, Object tx ) {
	super( tx );
	
	texture.wrap( Texture.REPEAT, Texture.REPEAT );
	
	size(width, height);
}
 
Example #23
Source File: SkinnedBlock.java    From shattered-pixel-dungeon with GNU General Public License v3.0 3 votes vote down vote up
public SkinnedBlock( float width, float height, Object tx ) {
	super( tx );
	
	texture.wrap( Texture.REPEAT, Texture.REPEAT );
	
	size( width, height );
}
 
Example #24
Source File: SkinnedBlock.java    From YetAnotherPixelDungeon with GNU General Public License v3.0 3 votes vote down vote up
public SkinnedBlock( float width, float height, Object tx ) {
	super( tx );
	
	texture.wrap( Texture.REPEAT, Texture.REPEAT );
	
	size( width, height );
}