当前位置: 首页>>代码示例>>Java>>正文


Java TextureCache类代码示例

本文整理汇总了Java中com.watabou.gltextures.TextureCache的典型用法代码示例。如果您正苦于以下问题:Java TextureCache类的具体用法?Java TextureCache怎么用?Java TextureCache使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


TextureCache类属于com.watabou.gltextures包,在下文中一共展示了TextureCache类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: saveGlobal

import com.watabou.gltextures.TextureCache; //导入依赖的package包/类
public static void saveGlobal() {
	if (saveNeeded) {

		Bundle bundle = new Bundle();
		store(bundle, global);

		try {
			OutputStream output = Game.instance.openFileOutput(BADGES_FILE,
					Context.MODE_PRIVATE);
			Bundle.write(bundle, output);
			File file = new File(TextureCache.context.getExternalFilesDir(null), BADGES_FILE);
			Bundle.writeext(bundle, file);
			output.close();
			saveNeeded = false;
		} catch (IOException e) {

		}
	}
}
 
开发者ID:G2159687,项目名称:ESPD,代码行数:20,代码来源:Badges.java

示例2: WndInfoBuff

import com.watabou.gltextures.TextureCache; //导入依赖的package包/类
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(Messages.titleCase(buff.toString()), Window.TITLE_COLOR);
	titlebar.setRect(0, 0, WIDTH, 0);
	add(titlebar);

	RenderedTextMultiline txtInfo = PixelScene.renderMultiline(buff.desc(), 6);
	txtInfo.maxWidth(WIDTH);
	txtInfo.setPos(titlebar.left(), titlebar.bottom() + GAP);
	add(txtInfo);

	resize(WIDTH, (int) (txtInfo.top() + txtInfo.height()));
}
 
开发者ID:G2159687,项目名称:ESPD,代码行数:24,代码来源:WndInfoBuff.java

示例3: Halo

import com.watabou.gltextures.TextureCache; //导入依赖的package包/类
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);
}
 
开发者ID:G2159687,项目名称:ESPD,代码行数:18,代码来源:Halo.java

示例4: NinePatch

import com.watabou.gltextures.TextureCache; //导入依赖的package包/类
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();
}
 
开发者ID:G2159687,项目名称:ESPD,代码行数:24,代码来源:NinePatch.java

示例5: TextureFilm

import com.watabou.gltextures.TextureCache; //导入依赖的package包/类
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);
			}
		}
	}
 
开发者ID:G2159687,项目名称:ESPD,代码行数:20,代码来源:TextureFilm.java

示例6: NinePatch

import com.watabou.gltextures.TextureCache; //导入依赖的package包/类
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();
}
 
开发者ID:mango-tree,项目名称:UNIST-pixel-dungeon,代码行数:24,代码来源:NinePatch.java

示例7: TextureFilm

import com.watabou.gltextures.TextureCache; //导入依赖的package包/类
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 );
		}
	}
}
 
开发者ID:mango-tree,项目名称:UNIST-pixel-dungeon,代码行数:20,代码来源:TextureFilm.java

示例8: WndInfoBuff

import com.watabou.gltextures.TextureCache; //导入依赖的package包/类
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( Messages.titleCase(buff.toString()), Window.TITLE_COLOR );
	titlebar.setRect( 0, 0, WIDTH, 0 );
	add( titlebar );

	RenderedTextMultiline txtInfo = PixelScene.renderMultiline(buff.desc(), 6);
	txtInfo.maxWidth(WIDTH);
	txtInfo.setPos(titlebar.left(), titlebar.bottom() + GAP);
	add( txtInfo );

	resize( WIDTH, (int)(txtInfo.top() + txtInfo.height()) );
}
 
开发者ID:mango-tree,项目名称:UNIST-pixel-dungeon,代码行数:24,代码来源:WndInfoBuff.java

示例9: Halo

import com.watabou.gltextures.TextureCache; //导入依赖的package包/类
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 );
}
 
开发者ID:mango-tree,项目名称:UNIST-pixel-dungeon,代码行数:17,代码来源:Halo.java

示例10: NinePatch

import com.watabou.gltextures.TextureCache; //导入依赖的package包/类
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];
	verticesBuffer = 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();
}
 
开发者ID:kurtyu,项目名称:PixelDungeonTC,代码行数:24,代码来源:NinePatch.java

示例11: resize

import com.watabou.gltextures.TextureCache; //导入依赖的package包/类
@Override
public void resize( int width, int height ) {
	Gdx.gl.glViewport( 0, 0, width, height );

	if (width != Game.width || height != Game.height) {
		Game.width = width;
		Game.height = height;

		Scene sc = scene();
		if (sc != null) {
			TextureCache.reload();
			Camera.reset();
			switchScene(sc.getClass());
		}
	}
}
 
开发者ID:kurtyu,项目名称:PixelDungeonTC,代码行数:17,代码来源:Game.java

示例12: Halo

import com.watabou.gltextures.TextureCache; //导入依赖的package包/类
public Halo() {
	super();

	if (!TextureCache.contains( CACHE_KEY )) {
		Pixmap pixmap = new Pixmap(RADIUS * 2, RADIUS * 2, Pixmap.Format.RGBA8888);
		pixmap.setColor( 0xFFFFFFFF );
		pixmap.fillCircle( RADIUS, RADIUS, (int) (RADIUS * 0.75f));
		pixmap.setColor( 0xFFFFFF88 );
		pixmap.fillCircle( RADIUS, RADIUS, RADIUS );
		GdxTexture bmp = new GdxTexture(pixmap);
		TextureCache.add( CACHE_KEY, new SmartTexture( bmp ) );
	}

	texture( CACHE_KEY );

	origin.set( RADIUS );
}
 
开发者ID:kurtyu,项目名称:PixelDungeonTC,代码行数:18,代码来源:Halo.java

示例13: Halo

import com.watabou.gltextures.TextureCache; //导入依赖的package包/类
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 );
}
 
开发者ID:ConsideredHamster,项目名称:YetAnotherPixelDungeon,代码行数:19,代码来源:Halo.java

示例14: WndInfoBuff

import com.watabou.gltextures.TextureCache; //导入依赖的package包/类
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()) );
}
 
开发者ID:FthrNature,项目名称:unleashed-pixel-dungeon,代码行数:26,代码来源:WndInfoBuff.java

示例15: NinePatch

import com.watabou.gltextures.TextureCache; //导入依赖的package包/类
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];
    verticesBuffer = 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();
}
 
开发者ID:skynet67,项目名称:pixel-dungeon-rebirth,代码行数:24,代码来源:NinePatch.java


注:本文中的com.watabou.gltextures.TextureCache类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。