本文整理汇总了Java中com.badlogic.gdx.graphics.Texture.dispose方法的典型用法代码示例。如果您正苦于以下问题:Java Texture.dispose方法的具体用法?Java Texture.dispose怎么用?Java Texture.dispose使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.badlogic.gdx.graphics.Texture
的用法示例。
在下文中一共展示了Texture.dispose方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: NationTileRenderer
import com.badlogic.gdx.graphics.Texture; //导入方法依赖的package包/类
public NationTileRenderer(Nation nation,
List<List<Nation>> world,
String textureName,
int tileSize) {
this.nation = nation;
this.world = world;
this.tileSize = tileSize;
Texture tileTexture = new Texture(Gdx.files.internal(textureName));
tileTexture.getTextureData().prepare();
this.tilePixmap = tileTexture.getTextureData().consumePixmap();
if (tileTexture.getTextureData().disposePixmap()) {
tileTexture.dispose();
}
}
示例2: dispose
import com.badlogic.gdx.graphics.Texture; //导入方法依赖的package包/类
public void dispose()
{
if (instantReplayManager != null)
instantReplayManager.dispose();
abortThreads = true;
for (int i = 0; i < textures.size(); i++)
{
Texture texture = textures.get(i);
if (texture != null)
texture.dispose();
}
DownloadedTexture dt = downloadedTextures.poll();
while (dt != null)
{
dt.data.dispose();
dt = downloadedTextures.poll();
}
}
示例3: setTexture
import com.badlogic.gdx.graphics.Texture; //导入方法依赖的package包/类
public void setTexture(Texture texture) {
Texture oldTexture = this.texture;
this.texture = texture;
if (oldTexture != null) {
oldTexture.dispose();
}
}
示例4: draw
import com.badlogic.gdx.graphics.Texture; //导入方法依赖的package包/类
@Override
public void draw(Batch batch, float parentAlpha) {
// TODO Auto-generated method stub
super.draw(batch, parentAlpha);
if(is_me_get_focus == false){
if(Math.pow(this.page_no-book.current_page,2)<=book.pages_range_to_load){
page_textrue=new Texture(Gdx.files.internal("pagestray/p"+page_no+".png"));
page_textrue.setFilter(TextureFilter.Linear,TextureFilter.Linear);
page_sprite = new Sprite(page_textrue);
page_sprite.setSize(Gdx.graphics.getWidth(),Gdx.graphics.getHeight());
is_me_get_focus = true;
//book.android.make_toast("page no : "+page_no+" loaded", false);
}
}else
{
b_a_s.setColor(255/255f,27/255f,177/255f,book.bookmark_a_page == page_no? (book.stage_detector==Stages.menu?.6f:(book.them_detector ==Thems.colord?.5f:.4f)):0);
b_b_s.setColor(27/255f,255/255f,215/255f,book.bookmark_b_page == page_no? (book.stage_detector==Stages.menu?.6f:(book.them_detector ==Thems.colord?.5f:.4f)):0);
b_c_s.setColor(255/255f,220/255f,27/255f,book.bookmark_c_page == page_no? (book.stage_detector==Stages.menu?.6f:(book.them_detector ==Thems.colord?.5f:.4f)):0);
b_a_s.setPosition(b_first_x,book.pages_scroll_pane.getScrollY()-(page_no-1)*Gdx.graphics.getHeight()+ b_y);
b_b_s.setPosition(b_first_x+b_pading_x+b_width, book.pages_scroll_pane.getScrollY()-(page_no-1)*Gdx.graphics.getHeight()+b_y);
b_c_s.setPosition(b_first_x+2*b_pading_x+2*b_width, book.pages_scroll_pane.getScrollY()-(page_no-1)*Gdx.graphics.getHeight()+b_y);
back_ground.setPosition(0,book.pages_scroll_pane.getScrollY()-(page_no-1)*Gdx.graphics.getHeight());
britness.setPosition(0,book.pages_scroll_pane.getScrollY()-(page_no-1)*Gdx.graphics.getHeight());
page_sprite.setPosition(0,book.pages_scroll_pane.getScrollY()-(page_no-1)*Gdx.graphics.getHeight());
page_sprite.setAlpha(book.stage_detector==Stages.menu?.3f:1);
back_ground.setAlpha(book.them_detector ==Thems.colord?1:0);
britness.setAlpha(1f-(book.light_value*.01f));
back_ground.draw(batch);
page_sprite.draw(batch);
britness.draw(batch);
b_a_s.draw(batch);
b_b_s.draw(batch);
b_c_s.draw(batch);
}
if(Math.pow(this.page_no-book.current_page,2)>book.pages_range_to_load&&is_me_get_focus){
// book.android.make_toast("page no : "+page_no+" unloaded", false);
is_me_get_focus = false ;
page_sprite = null ;
page_textrue.dispose() ;
}
}
示例5: TerrainTileRenderer
import com.badlogic.gdx.graphics.Texture; //导入方法依赖的package包/类
public TerrainTileRenderer(List<List<Integer>> world,
int tileSize) {
this.world = world;
this.tileSize = tileSize;
// build the tile map with the tile specifications
Texture tilesTexture = new Texture(Gdx.files.internal("tiles.png"));
tilesTexture.getTextureData().prepare();
this.tilesPixmap = tilesTexture.getTextureData().consumePixmap();
this.tileRegions = TextureRegion.split(tilesTexture, tileSize, tileSize);
if (tilesTexture.getTextureData().disposePixmap()) {
tilesTexture.dispose();
}
}
示例6: removeTexture
import com.badlogic.gdx.graphics.Texture; //导入方法依赖的package包/类
public void removeTexture(String key) {
Texture tex = textures.get(key);
if (tex != null) {
tex.dispose();
}
textures.remove(tex);
}
示例7: dispose
import com.badlogic.gdx.graphics.Texture; //导入方法依赖的package包/类
public void dispose()
{
for (Texture texture : textures) {
texture.dispose();
}
}
示例8: saveChallengeImage
import com.badlogic.gdx.graphics.Texture; //导入方法依赖的package包/类
public boolean saveChallengeImage(final int score, final boolean timeMode) {
final File saveAt = getShareImageFilePath();
if (!saveAt.getParentFile().isDirectory())
if (!saveAt.mkdirs())
return false;
final FileHandle output = new FileHandle(saveAt);
final Texture shareBase = new Texture(Gdx.files.internal("share.png"));
final int width = shareBase.getWidth();
final int height = shareBase.getHeight();
final FrameBuffer frameBuffer = new FrameBuffer(Pixmap.Format.RGB888, width, height, false);
frameBuffer.begin();
// Render the base share texture
final SpriteBatch batch = new SpriteBatch();
final Matrix4 matrix = new Matrix4();
matrix.setToOrtho2D(0, 0, width, height);
batch.setProjectionMatrix(matrix);
Gdx.gl.glClearColor(Color.GOLD.r, Color.GOLD.g, Color.GOLD.b, 1);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
batch.begin();
batch.draw(shareBase, 0, 0);
// Render the achieved score
final Label.LabelStyle style = new Label.LabelStyle();
style.font = new BitmapFont(Gdx.files.internal("font/x1.0/geosans-light64.fnt"));
Label label = new Label("just scored " + score + " on", style);
label.setColor(Color.BLACK);
label.setPosition(40, 500);
label.draw(batch, 1);
label.setText("try to beat me if you can");
label.setPosition(40, 40);
label.draw(batch, 1);
if (timeMode) {
Texture timeModeTexture = new Texture("ui/x1.5/stopwatch.png");
batch.setColor(Color.BLACK);
batch.draw(timeModeTexture, 200, 340);
}
batch.end();
// Get the framebuffer pixels and write them to a local file
final byte[] pixels = ScreenUtils.getFrameBufferPixels(0, 0, width, height, true);
final Pixmap pixmap = new Pixmap(width, height, Pixmap.Format.RGBA8888);
BufferUtils.copy(pixels, 0, pixmap.getPixels(), pixels.length);
PixmapIO.writePNG(output, pixmap);
// Dispose everything
pixmap.dispose();
shareBase.dispose();
batch.dispose();
frameBuffer.end();
return true;
}
示例9: disposeTexture
import com.badlogic.gdx.graphics.Texture; //导入方法依赖的package包/类
public void disposeTexture(String key) {
Texture texture = textureDatabase.get(key);
if (texture != null) {
texture.dispose();
}
}