libgdx API

com.badlogic.gdx.graphics
Class TextureRef

java.lang.Object
  extended by com.badlogic.gdx.graphics.TextureRef

public class TextureRef
extends java.lang.Object

A reference counted wrapper for a Texture. TextureRefs are managed by the TextureDict.

Author:
Dave Clayton

Field Summary
 java.lang.String Name
           
 
Constructor Summary
TextureRef(java.lang.String name, Texture texture)
          Create a new TextureRef with the given name and texture.
 
Method Summary
 void addRef()
          Adds a reference to the texture.
 void bind()
          Binds the texture in OpenGL.
 void dispose()
           
 Texture get()
          Gets the wrapped texture.
 int unload()
          Removes a reference to the texture.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

Name

public java.lang.String Name
Constructor Detail

TextureRef

public TextureRef(java.lang.String name,
                  Texture texture)
Create a new TextureRef with the given name and texture.

Parameters:
name - The texture's name, typically its filesystem path.
texture - The texture it reference counts.
Method Detail

addRef

public void addRef()
Adds a reference to the texture.


unload

public int unload()
Removes a reference to the texture. If the internal reference count reaches 0, the texture is disposed.

Returns:
the new reference count.

dispose

public void dispose()

bind

public void bind()
Binds the texture in OpenGL.


get

public Texture get()
Gets the wrapped texture.

Returns:
the texture.

libgdx API

Copyright 2010 Mario Zechner (contact@badlogicgames.com), Nathan Sweet (admin@esotericsoftware.com)