當前位置: 首頁>>代碼示例>>Java>>正文


Java Texture.dispose方法代碼示例

本文整理匯總了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();
	}
}
 
開發者ID:mcgeer,項目名稱:Climatar,代碼行數:17,代碼來源:DrawableMap.java

示例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();
	}
}
 
開發者ID:bp2008,項目名稱:blueirisviewer,代碼行數:19,代碼來源:Images.java

示例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();
    }
}
 
開發者ID:opensourcegamedev,項目名稱:SpaceChaos,代碼行數:10,代碼來源:ActionBarItem.java

示例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() ;
		
		
	}
	
}
 
開發者ID:omar6597,項目名稱:alquran-alkarem,代碼行數:52,代碼來源:PageSeen.java

示例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();
	}
}
 
開發者ID:mcgeer,項目名稱:Climatar,代碼行數:15,代碼來源:DrawableMap.java

示例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);
}
 
開發者ID:heyzqt,項目名稱:libGdx-xiyou,代碼行數:8,代碼來源:AssetManager.java

示例7: dispose

import com.badlogic.gdx.graphics.Texture; //導入方法依賴的package包/類
public void dispose()
{
	for (Texture texture : textures) {
		texture.dispose();
	}
}
 
開發者ID:UdealInferno,項目名稱:Parasites-of-HellSpace,代碼行數:7,代碼來源:Player.java

示例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;
}
 
開發者ID:LonamiWebs,項目名稱:Klooni1010,代碼行數:64,代碼來源:ShareChallenge.java

示例9: disposeTexture

import com.badlogic.gdx.graphics.Texture; //導入方法依賴的package包/類
public void disposeTexture(String key) {
	Texture texture = textureDatabase.get(key);
	if (texture != null) {
		texture.dispose();
	}
}
 
開發者ID:ja-brouil,項目名稱:StarshipFighters,代碼行數:7,代碼來源:ImageManager.java


注:本文中的com.badlogic.gdx.graphics.Texture.dispose方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。