本文整理汇总了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) {
}
}
}
示例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()));
}
示例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);
}
示例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();
}
示例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);
}
}
}
示例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();
}
示例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 );
}
}
}
示例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()) );
}
示例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 );
}
示例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();
}
示例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());
}
}
}
示例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 );
}
示例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 );
}
示例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()) );
}
示例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();
}