Subversion Repositories AndroidProjects

Rev

Blame | Last modification | View Log | RSS feed

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (version 1.7.0_17) on Sun Nov 03 15:35:45 CET 2013 -->
<title>SpriteCache (libgdx API)</title>
<meta name="date" content="2013-11-03">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
</head>
<body>
<script type="text/javascript"><!--
   if (location.href.indexOf('is-external=true') == -1) {
       parent.document.title="SpriteCache (libgdx API)";
   }
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!--   -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
<!--   -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/SpriteCache.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
<div class="aboutLanguage"><em>
                                libgdx API
                                <style>
                                body, td, th { font-family:Helvetica, Tahoma, Arial, sans-serif; font-size:10pt }
                                pre, code, tt { font-size:9pt; font-family:Lucida Console, Courier New, sans-serif }
                                h1, h2, h3, .FrameTitleFont, .FrameHeadingFont, .TableHeadingColor font { font-size:105%;  font-weight:bold }
                                .TableHeadingColor { background:#EEEEFF; }
                                a { text-decoration:none }
                                a:hover { text-decoration:underline }
                                a:link, a:visited { color:blue }
                                table { border:0px }
                                .TableRowColor td:first-child { border-left:1px solid black }
                                .TableRowColor td { border:0px; border-bottom:1px solid black; border-right:1px solid black }
                                hr { border:0px; border-bottom:1px solid #333366; }
                                </style>
                        </em></div>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../com/badlogic/gdx/graphics/g2d/SpriteBatch.html" title="class in com.badlogic.gdx.graphics.g2d"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../../../com/badlogic/gdx/graphics/g2d/TextureAtlas.html" title="class in com.badlogic.gdx.graphics.g2d"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?com/badlogic/gdx/graphics/g2d/SpriteCache.html" target="_top">Frames</a></li>
<li><a href="SpriteCache.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
 allClassesLink = document.getElementById("allclasses_navbar_top");
 if(window==top) {
   allClassesLink.style.display = "block";
 }
 else {
   allClassesLink.style.display = "none";
 }
 //-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor_summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor_detail">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_top">
<!--   -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">com.badlogic.gdx.graphics.g2d</div>
<h2 title="Class SpriteCache" class="title">Class SpriteCache</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li>java.lang.Object</li>
<li>
<ul class="inheritance">
<li>com.badlogic.gdx.graphics.g2d.SpriteCache</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>All Implemented Interfaces:</dt>
<dd><a href="../../../../../com/badlogic/gdx/utils/Disposable.html" title="interface in com.badlogic.gdx.utils">Disposable</a></dd>
</dl>
<hr>
<br>
<pre>public class <span class="strong">SpriteCache</span>
extends java.lang.Object
implements <a href="../../../../../com/badlogic/gdx/utils/Disposable.html" title="interface in com.badlogic.gdx.utils">Disposable</a></pre>
<div class="block">Draws 2D images, optimized for geometry that does not change. Sprites and/or textures are cached and given an ID, which can
 later be used for drawing. The size, color, and texture region for each cached image cannot be modified. This information is
 stored in video memory and does not have to be sent to the GPU each time it is drawn.<br>
 <br>
 To cache <a href="../../../../../com/badlogic/gdx/graphics/g2d/Sprite.html" title="class in com.badlogic.gdx.graphics.g2d"><code>sprites</code></a> or <a href="../../../../../com/badlogic/gdx/graphics/Texture.html" title="class in com.badlogic.gdx.graphics"><code>textures</code></a>, first call <a href="../../../../../com/badlogic/gdx/graphics/g2d/SpriteCache.html#beginCache()"><code>beginCache()</code></a>, then call the
 appropriate add method to define the images. To complete the cache, call <a href="../../../../../com/badlogic/gdx/graphics/g2d/SpriteCache.html#endCache()"><code>endCache()</code></a> and store the returned
 cache ID.<br>
 <br>
 To draw with SpriteCache, first call <a href="../../../../../com/badlogic/gdx/graphics/g2d/SpriteCache.html#begin()"><code>begin()</code></a>, then call <a href="../../../../../com/badlogic/gdx/graphics/g2d/SpriteCache.html#draw(int)"><code>draw(int)</code></a> with a cache ID. When SpriteCache drawing
 is complete, call <a href="../../../../../com/badlogic/gdx/graphics/g2d/SpriteCache.html#end()"><code>end()</code></a>.<br>
 <br>
 By default, SpriteCache draws using screen coordinates and uses an x-axis pointing to the right, an y-axis pointing upwards and
 the origin is the bottom left corner of the screen. The default transformation and projection matrices can be changed. If the
 screen is <a href="../../../../../com/badlogic/gdx/ApplicationListener.html#resize(int, int)"><code>resized</code></a>, the SpriteCache's matrices must be updated. For example:<br>
 <code>cache.getProjectionMatrix().setToOrtho2D(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());</code><br>
 <br>
 Note that SpriteCache does not manage blending. You will need to enable blending (<i>Gdx.gl.glEnable(GL10.GL_BLEND);</i>) and
 set the blend func as needed before or between calls to <a href="../../../../../com/badlogic/gdx/graphics/g2d/SpriteCache.html#draw(int)"><code>draw(int)</code></a>.<br>
 <br>
 SpriteCache is managed. If the OpenGL context is lost and the restored, all OpenGL resources a SpriteCache uses internally are
 restored.<br>
 <br>
 SpriteCache is a reasonably heavyweight object. Typically only one instance should be used for an entire application.<br>
 <br>
 SpriteCache works with OpenGL ES 1.x and 2.0. For 2.0, it uses its own custom shader to draw.<br>
 <br>
 SpriteCache must be disposed once it is no longer needed.</div>
<dl><dt><span class="strong">Author:</span></dt>
  <dd>Nathan Sweet</dd></dl>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor_summary">
<!--   -->
</a>
<h3>Constructor Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation">
<caption><span>Constructors</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colOne" scope="col">Constructor and Description</th>
</tr>
<tr class="altColor">
<td class="colOne"><code><strong><a href="../../../../../com/badlogic/gdx/graphics/g2d/SpriteCache.html#SpriteCache()">SpriteCache</a></strong>()</code>
<div class="block">Creates a cache that uses indexed geometry and can contain up to 1000 images.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colOne"><code><strong><a href="../../../../../com/badlogic/gdx/graphics/g2d/SpriteCache.html#SpriteCache(int, boolean)">SpriteCache</a></strong>(int&nbsp;size,
           boolean&nbsp;useIndices)</code>
<div class="block">Creates a cache with the specified size, using a default shader if OpenGL ES 2.0 is being used.</div>
</td>
</tr>
<tr class="altColor">
<td class="colOne"><code><strong><a href="../../../../../com/badlogic/gdx/graphics/g2d/SpriteCache.html#SpriteCache(int, com.badlogic.gdx.graphics.glutils.ShaderProgram, boolean)">SpriteCache</a></strong>(int&nbsp;size,
           <a href="../../../../../com/badlogic/gdx/graphics/glutils/ShaderProgram.html" title="class in com.badlogic.gdx.graphics.glutils">ShaderProgram</a>&nbsp;shader,
           boolean&nbsp;useIndices)</code>
<div class="block">Creates a cache with the specified size and OpenGL ES 2.0 shader.</div>
</td>
</tr>
</table>
</li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method_summary">
<!--   -->
</a>
<h3>Method Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span>Methods</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../com/badlogic/gdx/graphics/g2d/SpriteCache.html#add(com.badlogic.gdx.graphics.g2d.Sprite)">add</a></strong>(<a href="../../../../../com/badlogic/gdx/graphics/g2d/Sprite.html" title="class in com.badlogic.gdx.graphics.g2d">Sprite</a>&nbsp;sprite)</code>
<div class="block">Adds the specified sprite to the cache.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../com/badlogic/gdx/graphics/g2d/SpriteCache.html#add(com.badlogic.gdx.graphics.Texture, float[], int, int)">add</a></strong>(<a href="../../../../../com/badlogic/gdx/graphics/Texture.html" title="class in com.badlogic.gdx.graphics">Texture</a>&nbsp;texture,
   float[]&nbsp;vertices,
   int&nbsp;offset,
   int&nbsp;length)</code>
<div class="block">Adds the specified vertices to the cache.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../com/badlogic/gdx/graphics/g2d/SpriteCache.html#add(com.badlogic.gdx.graphics.Texture, float, float)">add</a></strong>(<a href="../../../../../com/badlogic/gdx/graphics/Texture.html" title="class in com.badlogic.gdx.graphics">Texture</a>&nbsp;texture,
   float&nbsp;x,
   float&nbsp;y)</code>
<div class="block">Adds the specified texture to the cache.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../com/badlogic/gdx/graphics/g2d/SpriteCache.html#add(com.badlogic.gdx.graphics.Texture, float, float, float, float, float, float, float, float, float, int, int, int, int, boolean, boolean)">add</a></strong>(<a href="../../../../../com/badlogic/gdx/graphics/Texture.html" title="class in com.badlogic.gdx.graphics">Texture</a>&nbsp;texture,
   float&nbsp;x,
   float&nbsp;y,
   float&nbsp;originX,
   float&nbsp;originY,
   float&nbsp;width,
   float&nbsp;height,
   float&nbsp;scaleX,
   float&nbsp;scaleY,
   float&nbsp;rotation,
   int&nbsp;srcX,
   int&nbsp;srcY,
   int&nbsp;srcWidth,
   int&nbsp;srcHeight,
   boolean&nbsp;flipX,
   boolean&nbsp;flipY)</code>
<div class="block">Adds the specified texture to the cache.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../com/badlogic/gdx/graphics/g2d/SpriteCache.html#add(com.badlogic.gdx.graphics.Texture, float, float, float, float, int, int, int, int, boolean, boolean)">add</a></strong>(<a href="../../../../../com/badlogic/gdx/graphics/Texture.html" title="class in com.badlogic.gdx.graphics">Texture</a>&nbsp;texture,
   float&nbsp;x,
   float&nbsp;y,
   float&nbsp;width,
   float&nbsp;height,
   int&nbsp;srcX,
   int&nbsp;srcY,
   int&nbsp;srcWidth,
   int&nbsp;srcHeight,
   boolean&nbsp;flipX,
   boolean&nbsp;flipY)</code>
<div class="block">Adds the specified texture to the cache.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../com/badlogic/gdx/graphics/g2d/SpriteCache.html#add(com.badlogic.gdx.graphics.Texture, float, float, int, int, float, float, float, float, float)">add</a></strong>(<a href="../../../../../com/badlogic/gdx/graphics/Texture.html" title="class in com.badlogic.gdx.graphics">Texture</a>&nbsp;texture,
   float&nbsp;x,
   float&nbsp;y,
   int&nbsp;srcWidth,
   int&nbsp;srcHeight,
   float&nbsp;u,
   float&nbsp;v,
   float&nbsp;u2,
   float&nbsp;v2,
   float&nbsp;color)</code>
<div class="block">Adds the specified texture to the cache.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../com/badlogic/gdx/graphics/g2d/SpriteCache.html#add(com.badlogic.gdx.graphics.Texture, float, float, int, int, int, int)">add</a></strong>(<a href="../../../../../com/badlogic/gdx/graphics/Texture.html" title="class in com.badlogic.gdx.graphics">Texture</a>&nbsp;texture,
   float&nbsp;x,
   float&nbsp;y,
   int&nbsp;srcX,
   int&nbsp;srcY,
   int&nbsp;srcWidth,
   int&nbsp;srcHeight)</code>
<div class="block">Adds the specified texture to the cache.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../com/badlogic/gdx/graphics/g2d/SpriteCache.html#add(com.badlogic.gdx.graphics.g2d.TextureRegion, float, float)">add</a></strong>(<a href="../../../../../com/badlogic/gdx/graphics/g2d/TextureRegion.html" title="class in com.badlogic.gdx.graphics.g2d">TextureRegion</a>&nbsp;region,
   float&nbsp;x,
   float&nbsp;y)</code>
<div class="block">Adds the specified region to the cache.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../com/badlogic/gdx/graphics/g2d/SpriteCache.html#add(com.badlogic.gdx.graphics.g2d.TextureRegion, float, float, float, float)">add</a></strong>(<a href="../../../../../com/badlogic/gdx/graphics/g2d/TextureRegion.html" title="class in com.badlogic.gdx.graphics.g2d">TextureRegion</a>&nbsp;region,
   float&nbsp;x,
   float&nbsp;y,
   float&nbsp;width,
   float&nbsp;height)</code>
<div class="block">Adds the specified region to the cache.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../com/badlogic/gdx/graphics/g2d/SpriteCache.html#add(com.badlogic.gdx.graphics.g2d.TextureRegion, float, float, float, float, float, float, float, float, float)">add</a></strong>(<a href="../../../../../com/badlogic/gdx/graphics/g2d/TextureRegion.html" title="class in com.badlogic.gdx.graphics.g2d">TextureRegion</a>&nbsp;region,
   float&nbsp;x,
   float&nbsp;y,
   float&nbsp;originX,
   float&nbsp;originY,
   float&nbsp;width,
   float&nbsp;height,
   float&nbsp;scaleX,
   float&nbsp;scaleY,
   float&nbsp;rotation)</code>
<div class="block">Adds the specified region to the cache.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../com/badlogic/gdx/graphics/g2d/SpriteCache.html#begin()">begin</a></strong>()</code>
<div class="block">Prepares the OpenGL state for SpriteCache rendering.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../com/badlogic/gdx/graphics/g2d/SpriteCache.html#beginCache()">beginCache</a></strong>()</code>
<div class="block">Starts the definition of a new cache, allowing the add and <a href="../../../../../com/badlogic/gdx/graphics/g2d/SpriteCache.html#endCache()"><code>endCache()</code></a> methods to be called.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../com/badlogic/gdx/graphics/g2d/SpriteCache.html#beginCache(int)">beginCache</a></strong>(int&nbsp;cacheID)</code>
<div class="block">Starts the redefinition of an existing cache, allowing the add and <a href="../../../../../com/badlogic/gdx/graphics/g2d/SpriteCache.html#endCache()"><code>endCache()</code></a> methods to be called.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../com/badlogic/gdx/graphics/g2d/SpriteCache.html#clear()">clear</a></strong>()</code>
<div class="block">Invalidates all cache IDs and resets the SpriteCache so new caches can be added.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../com/badlogic/gdx/graphics/g2d/SpriteCache.html#dispose()">dispose</a></strong>()</code>
<div class="block">Releases all resources held by this SpriteCache.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../com/badlogic/gdx/graphics/g2d/SpriteCache.html#draw(int)">draw</a></strong>(int&nbsp;cacheID)</code>
<div class="block">Draws all the images defined for the specified cache ID.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../com/badlogic/gdx/graphics/g2d/SpriteCache.html#draw(int, int, int)">draw</a></strong>(int&nbsp;cacheID,
    int&nbsp;offset,
    int&nbsp;length)</code>
<div class="block">Draws a subset of images defined for the specified cache ID.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../com/badlogic/gdx/graphics/g2d/SpriteCache.html#end()">end</a></strong>()</code>
<div class="block">Completes rendering for this SpriteCache.f</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><strong><a href="../../../../../com/badlogic/gdx/graphics/g2d/SpriteCache.html#endCache()">endCache</a></strong>()</code>
<div class="block">Ends the definition of a cache, returning the cache ID to be used with <a href="../../../../../com/badlogic/gdx/graphics/g2d/SpriteCache.html#draw(int)"><code>draw(int)</code></a>.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="../../../../../com/badlogic/gdx/graphics/Color.html" title="class in com.badlogic.gdx.graphics">Color</a></code></td>
<td class="colLast"><code><strong><a href="../../../../../com/badlogic/gdx/graphics/g2d/SpriteCache.html#getColor()">getColor</a></strong>()</code>&nbsp;</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code><a href="../../../../../com/badlogic/gdx/math/Matrix4.html" title="class in com.badlogic.gdx.math">Matrix4</a></code></td>
<td class="colLast"><code><strong><a href="../../../../../com/badlogic/gdx/graphics/g2d/SpriteCache.html#getProjectionMatrix()">getProjectionMatrix</a></strong>()</code>&nbsp;</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="../../../../../com/badlogic/gdx/math/Matrix4.html" title="class in com.badlogic.gdx.math">Matrix4</a></code></td>
<td class="colLast"><code><strong><a href="../../../../../com/badlogic/gdx/graphics/g2d/SpriteCache.html#getTransformMatrix()">getTransformMatrix</a></strong>()</code>&nbsp;</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../com/badlogic/gdx/graphics/g2d/SpriteCache.html#setColor(com.badlogic.gdx.graphics.Color)">setColor</a></strong>(<a href="../../../../../com/badlogic/gdx/graphics/Color.html" title="class in com.badlogic.gdx.graphics">Color</a>&nbsp;tint)</code>
<div class="block">Sets the color used to tint images when they are added to the SpriteCache.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../com/badlogic/gdx/graphics/g2d/SpriteCache.html#setColor(float)">setColor</a></strong>(float&nbsp;color)</code>&nbsp;</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../com/badlogic/gdx/graphics/g2d/SpriteCache.html#setColor(float, float, float, float)">setColor</a></strong>(float&nbsp;r,
        float&nbsp;g,
        float&nbsp;b,
        float&nbsp;a)</code>&nbsp;</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../com/badlogic/gdx/graphics/g2d/SpriteCache.html#setProjectionMatrix(com.badlogic.gdx.math.Matrix4)">setProjectionMatrix</a></strong>(<a href="../../../../../com/badlogic/gdx/math/Matrix4.html" title="class in com.badlogic.gdx.math">Matrix4</a>&nbsp;projection)</code>&nbsp;</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../com/badlogic/gdx/graphics/g2d/SpriteCache.html#setShader(com.badlogic.gdx.graphics.glutils.ShaderProgram)">setShader</a></strong>(<a href="../../../../../com/badlogic/gdx/graphics/glutils/ShaderProgram.html" title="class in com.badlogic.gdx.graphics.glutils">ShaderProgram</a>&nbsp;shader)</code>
<div class="block">Sets the shader to be used in a GLES 2.0 environment.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../com/badlogic/gdx/graphics/g2d/SpriteCache.html#setTransformMatrix(com.badlogic.gdx.math.Matrix4)">setTransformMatrix</a></strong>(<a href="../../../../../com/badlogic/gdx/math/Matrix4.html" title="class in com.badlogic.gdx.math">Matrix4</a>&nbsp;transform)</code>&nbsp;</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods_inherited_from_class_java.lang.Object">
<!--   -->
</a>
<h3>Methods inherited from class&nbsp;java.lang.Object</h3>
<code>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor_detail">
<!--   -->
</a>
<h3>Constructor Detail</h3>
<a name="SpriteCache()">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>SpriteCache</h4>
<pre>public&nbsp;SpriteCache()</pre>
<div class="block">Creates a cache that uses indexed geometry and can contain up to 1000 images.</div>
</li>
</ul>
<a name="SpriteCache(int, boolean)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>SpriteCache</h4>
<pre>public&nbsp;SpriteCache(int&nbsp;size,
           boolean&nbsp;useIndices)</pre>
<div class="block">Creates a cache with the specified size, using a default shader if OpenGL ES 2.0 is being used.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>size</code> - The maximum number of images this cache can hold. The memory required to hold the images is allocated up front.</dd><dd><code>useIndices</code> - If true, indexed geometry will be used.</dd></dl>
</li>
</ul>
<a name="SpriteCache(int, com.badlogic.gdx.graphics.glutils.ShaderProgram, boolean)">
<!--   -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>SpriteCache</h4>
<pre>public&nbsp;SpriteCache(int&nbsp;size,
           <a href="../../../../../com/badlogic/gdx/graphics/glutils/ShaderProgram.html" title="class in com.badlogic.gdx.graphics.glutils">ShaderProgram</a>&nbsp;shader,
           boolean&nbsp;useIndices)</pre>
<div class="block">Creates a cache with the specified size and OpenGL ES 2.0 shader.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>size</code> - The maximum number of images this cache can hold. The memory required to hold the images is allocated up front.</dd><dd><code>useIndices</code> - If true, indexed geometry will be used.</dd></dl>
</li>
</ul>
</li>
</ul>
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method_detail">
<!--   -->
</a>
<h3>Method Detail</h3>
<a name="setColor(com.badlogic.gdx.graphics.Color)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setColor</h4>
<pre>public&nbsp;void&nbsp;setColor(<a href="../../../../../com/badlogic/gdx/graphics/Color.html" title="class in com.badlogic.gdx.graphics">Color</a>&nbsp;tint)</pre>
<div class="block">Sets the color used to tint images when they are added to the SpriteCache. Default is <a href="../../../../../com/badlogic/gdx/graphics/Color.html#WHITE"><code>Color.WHITE</code></a>.</div>
</li>
</ul>
<a name="setColor(float, float, float, float)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setColor</h4>
<pre>public&nbsp;void&nbsp;setColor(float&nbsp;r,
            float&nbsp;g,
            float&nbsp;b,
            float&nbsp;a)</pre>
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../../../com/badlogic/gdx/graphics/g2d/SpriteCache.html#setColor(com.badlogic.gdx.graphics.Color)"><code>setColor(Color)</code></a></dd></dl>
</li>
</ul>
<a name="setColor(float)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setColor</h4>
<pre>public&nbsp;void&nbsp;setColor(float&nbsp;color)</pre>
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../../../com/badlogic/gdx/graphics/g2d/SpriteCache.html#setColor(com.badlogic.gdx.graphics.Color)"><code>setColor(Color)</code></a>,
<a href="../../../../../com/badlogic/gdx/graphics/Color.html#toFloatBits()"><code>Color.toFloatBits()</code></a></dd></dl>
</li>
</ul>
<a name="getColor()">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getColor</h4>
<pre>public&nbsp;<a href="../../../../../com/badlogic/gdx/graphics/Color.html" title="class in com.badlogic.gdx.graphics">Color</a>&nbsp;getColor()</pre>
</li>
</ul>
<a name="beginCache()">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>beginCache</h4>
<pre>public&nbsp;void&nbsp;beginCache()</pre>
<div class="block">Starts the definition of a new cache, allowing the add and <a href="../../../../../com/badlogic/gdx/graphics/g2d/SpriteCache.html#endCache()"><code>endCache()</code></a> methods to be called.</div>
</li>
</ul>
<a name="beginCache(int)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>beginCache</h4>
<pre>public&nbsp;void&nbsp;beginCache(int&nbsp;cacheID)</pre>
<div class="block">Starts the redefinition of an existing cache, allowing the add and <a href="../../../../../com/badlogic/gdx/graphics/g2d/SpriteCache.html#endCache()"><code>endCache()</code></a> methods to be called. If this is not
 the last cache created, it cannot have more entries added to it than when it was first created. To do that, use
 <a href="../../../../../com/badlogic/gdx/graphics/g2d/SpriteCache.html#clear()"><code>clear()</code></a> and then <a href="../../../../../com/badlogic/gdx/graphics/g2d/SpriteCache.html#begin()"><code>begin()</code></a>.</div>
</li>
</ul>
<a name="endCache()">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>endCache</h4>
<pre>public&nbsp;int&nbsp;endCache()</pre>
<div class="block">Ends the definition of a cache, returning the cache ID to be used with <a href="../../../../../com/badlogic/gdx/graphics/g2d/SpriteCache.html#draw(int)"><code>draw(int)</code></a>.</div>
</li>
</ul>
<a name="clear()">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>clear</h4>
<pre>public&nbsp;void&nbsp;clear()</pre>
<div class="block">Invalidates all cache IDs and resets the SpriteCache so new caches can be added.</div>
</li>
</ul>
<a name="add(com.badlogic.gdx.graphics.Texture, float[], int, int)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>add</h4>
<pre>public&nbsp;void&nbsp;add(<a href="../../../../../com/badlogic/gdx/graphics/Texture.html" title="class in com.badlogic.gdx.graphics">Texture</a>&nbsp;texture,
       float[]&nbsp;vertices,
       int&nbsp;offset,
       int&nbsp;length)</pre>
<div class="block">Adds the specified vertices to the cache. Each vertex should have 5 elements, one for each of the attributes: x, y, color,
 u, and v. If indexed geometry is used, each image should be specified as 4 vertices, otherwise each image should be
 specified as 6 vertices.</div>
</li>
</ul>
<a name="add(com.badlogic.gdx.graphics.Texture, float, float)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>add</h4>
<pre>public&nbsp;void&nbsp;add(<a href="../../../../../com/badlogic/gdx/graphics/Texture.html" title="class in com.badlogic.gdx.graphics">Texture</a>&nbsp;texture,
       float&nbsp;x,
       float&nbsp;y)</pre>
<div class="block">Adds the specified texture to the cache.</div>
</li>
</ul>
<a name="add(com.badlogic.gdx.graphics.Texture, float, float, int, int, float, float, float, float, float)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>add</h4>
<pre>public&nbsp;void&nbsp;add(<a href="../../../../../com/badlogic/gdx/graphics/Texture.html" title="class in com.badlogic.gdx.graphics">Texture</a>&nbsp;texture,
       float&nbsp;x,
       float&nbsp;y,
       int&nbsp;srcWidth,
       int&nbsp;srcHeight,
       float&nbsp;u,
       float&nbsp;v,
       float&nbsp;u2,
       float&nbsp;v2,
       float&nbsp;color)</pre>
<div class="block">Adds the specified texture to the cache.</div>
</li>
</ul>
<a name="add(com.badlogic.gdx.graphics.Texture, float, float, int, int, int, int)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>add</h4>
<pre>public&nbsp;void&nbsp;add(<a href="../../../../../com/badlogic/gdx/graphics/Texture.html" title="class in com.badlogic.gdx.graphics">Texture</a>&nbsp;texture,
       float&nbsp;x,
       float&nbsp;y,
       int&nbsp;srcX,
       int&nbsp;srcY,
       int&nbsp;srcWidth,
       int&nbsp;srcHeight)</pre>
<div class="block">Adds the specified texture to the cache.</div>
</li>
</ul>
<a name="add(com.badlogic.gdx.graphics.Texture, float, float, float, float, int, int, int, int, boolean, boolean)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>add</h4>
<pre>public&nbsp;void&nbsp;add(<a href="../../../../../com/badlogic/gdx/graphics/Texture.html" title="class in com.badlogic.gdx.graphics">Texture</a>&nbsp;texture,
       float&nbsp;x,
       float&nbsp;y,
       float&nbsp;width,
       float&nbsp;height,
       int&nbsp;srcX,
       int&nbsp;srcY,
       int&nbsp;srcWidth,
       int&nbsp;srcHeight,
       boolean&nbsp;flipX,
       boolean&nbsp;flipY)</pre>
<div class="block">Adds the specified texture to the cache.</div>
</li>
</ul>
<a name="add(com.badlogic.gdx.graphics.Texture, float, float, float, float, float, float, float, float, float, int, int, int, int, boolean, boolean)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>add</h4>
<pre>public&nbsp;void&nbsp;add(<a href="../../../../../com/badlogic/gdx/graphics/Texture.html" title="class in com.badlogic.gdx.graphics">Texture</a>&nbsp;texture,
       float&nbsp;x,
       float&nbsp;y,
       float&nbsp;originX,
       float&nbsp;originY,
       float&nbsp;width,
       float&nbsp;height,
       float&nbsp;scaleX,
       float&nbsp;scaleY,
       float&nbsp;rotation,
       int&nbsp;srcX,
       int&nbsp;srcY,
       int&nbsp;srcWidth,
       int&nbsp;srcHeight,
       boolean&nbsp;flipX,
       boolean&nbsp;flipY)</pre>
<div class="block">Adds the specified texture to the cache.</div>
</li>
</ul>
<a name="add(com.badlogic.gdx.graphics.g2d.TextureRegion, float, float)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>add</h4>
<pre>public&nbsp;void&nbsp;add(<a href="../../../../../com/badlogic/gdx/graphics/g2d/TextureRegion.html" title="class in com.badlogic.gdx.graphics.g2d">TextureRegion</a>&nbsp;region,
       float&nbsp;x,
       float&nbsp;y)</pre>
<div class="block">Adds the specified region to the cache.</div>
</li>
</ul>
<a name="add(com.badlogic.gdx.graphics.g2d.TextureRegion, float, float, float, float)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>add</h4>
<pre>public&nbsp;void&nbsp;add(<a href="../../../../../com/badlogic/gdx/graphics/g2d/TextureRegion.html" title="class in com.badlogic.gdx.graphics.g2d">TextureRegion</a>&nbsp;region,
       float&nbsp;x,
       float&nbsp;y,
       float&nbsp;width,
       float&nbsp;height)</pre>
<div class="block">Adds the specified region to the cache.</div>
</li>
</ul>
<a name="add(com.badlogic.gdx.graphics.g2d.TextureRegion, float, float, float, float, float, float, float, float, float)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>add</h4>
<pre>public&nbsp;void&nbsp;add(<a href="../../../../../com/badlogic/gdx/graphics/g2d/TextureRegion.html" title="class in com.badlogic.gdx.graphics.g2d">TextureRegion</a>&nbsp;region,
       float&nbsp;x,
       float&nbsp;y,
       float&nbsp;originX,
       float&nbsp;originY,
       float&nbsp;width,
       float&nbsp;height,
       float&nbsp;scaleX,
       float&nbsp;scaleY,
       float&nbsp;rotation)</pre>
<div class="block">Adds the specified region to the cache.</div>
</li>
</ul>
<a name="add(com.badlogic.gdx.graphics.g2d.Sprite)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>add</h4>
<pre>public&nbsp;void&nbsp;add(<a href="../../../../../com/badlogic/gdx/graphics/g2d/Sprite.html" title="class in com.badlogic.gdx.graphics.g2d">Sprite</a>&nbsp;sprite)</pre>
<div class="block">Adds the specified sprite to the cache.</div>
</li>
</ul>
<a name="begin()">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>begin</h4>
<pre>public&nbsp;void&nbsp;begin()</pre>
<div class="block">Prepares the OpenGL state for SpriteCache rendering.</div>
</li>
</ul>
<a name="end()">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>end</h4>
<pre>public&nbsp;void&nbsp;end()</pre>
<div class="block">Completes rendering for this SpriteCache.f</div>
</li>
</ul>
<a name="draw(int)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>draw</h4>
<pre>public&nbsp;void&nbsp;draw(int&nbsp;cacheID)</pre>
<div class="block">Draws all the images defined for the specified cache ID.</div>
</li>
</ul>
<a name="draw(int, int, int)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>draw</h4>
<pre>public&nbsp;void&nbsp;draw(int&nbsp;cacheID,
        int&nbsp;offset,
        int&nbsp;length)</pre>
<div class="block">Draws a subset of images defined for the specified cache ID.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>offset</code> - The first image to render.</dd><dd><code>length</code> - The number of images from the first image (inclusive) to render.</dd></dl>
</li>
</ul>
<a name="dispose()">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>dispose</h4>
<pre>public&nbsp;void&nbsp;dispose()</pre>
<div class="block">Releases all resources held by this SpriteCache.</div>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code><a href="../../../../../com/badlogic/gdx/utils/Disposable.html#dispose()">dispose</a></code>&nbsp;in interface&nbsp;<code><a href="../../../../../com/badlogic/gdx/utils/Disposable.html" title="interface in com.badlogic.gdx.utils">Disposable</a></code></dd>
</dl>
</li>
</ul>
<a name="getProjectionMatrix()">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getProjectionMatrix</h4>
<pre>public&nbsp;<a href="../../../../../com/badlogic/gdx/math/Matrix4.html" title="class in com.badlogic.gdx.math">Matrix4</a>&nbsp;getProjectionMatrix()</pre>
</li>
</ul>
<a name="setProjectionMatrix(com.badlogic.gdx.math.Matrix4)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setProjectionMatrix</h4>
<pre>public&nbsp;void&nbsp;setProjectionMatrix(<a href="../../../../../com/badlogic/gdx/math/Matrix4.html" title="class in com.badlogic.gdx.math">Matrix4</a>&nbsp;projection)</pre>
</li>
</ul>
<a name="getTransformMatrix()">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getTransformMatrix</h4>
<pre>public&nbsp;<a href="../../../../../com/badlogic/gdx/math/Matrix4.html" title="class in com.badlogic.gdx.math">Matrix4</a>&nbsp;getTransformMatrix()</pre>
</li>
</ul>
<a name="setTransformMatrix(com.badlogic.gdx.math.Matrix4)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setTransformMatrix</h4>
<pre>public&nbsp;void&nbsp;setTransformMatrix(<a href="../../../../../com/badlogic/gdx/math/Matrix4.html" title="class in com.badlogic.gdx.math">Matrix4</a>&nbsp;transform)</pre>
</li>
</ul>
<a name="setShader(com.badlogic.gdx.graphics.glutils.ShaderProgram)">
<!--   -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>setShader</h4>
<pre>public&nbsp;void&nbsp;setShader(<a href="../../../../../com/badlogic/gdx/graphics/glutils/ShaderProgram.html" title="class in com.badlogic.gdx.graphics.glutils">ShaderProgram</a>&nbsp;shader)</pre>
<div class="block">Sets the shader to be used in a GLES 2.0 environment. Vertex position attribute is called "a_position", the texture
 coordinates attribute is called called "a_texCoords", the color attribute is called "a_color". The projection matrix is
 uploaded via a mat4 uniform called "u_proj", the transform matrix is uploaded via a uniform called "u_trans", the combined
 transform and projection matrx is is uploaded via a mat4 uniform called "u_projTrans". The texture sampler is passed via a
 uniform called "u_texture".
 
 Call this method with a null argument to use the default shader.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>shader</code> - the <a href="../../../../../com/badlogic/gdx/graphics/glutils/ShaderProgram.html" title="class in com.badlogic.gdx.graphics.glutils"><code>ShaderProgram</code></a> or null to use the default shader.</dd></dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
<!--   -->
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
<!--   -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/SpriteCache.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
<div class="aboutLanguage"><em>libgdx API</em></div>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../com/badlogic/gdx/graphics/g2d/SpriteBatch.html" title="class in com.badlogic.gdx.graphics.g2d"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../../../com/badlogic/gdx/graphics/g2d/TextureAtlas.html" title="class in com.badlogic.gdx.graphics.g2d"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?com/badlogic/gdx/graphics/g2d/SpriteCache.html" target="_top">Frames</a></li>
<li><a href="SpriteCache.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
 allClassesLink = document.getElementById("allclasses_navbar_bottom");
 if(window==top) {
   allClassesLink.style.display = "block";
 }
 else {
   allClassesLink.style.display = "none";
 }
 //-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor_summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor_detail">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_bottom">
<!--   -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small>
                                <div style="font-size:9pt"><i>
                                Copyright &copy; 2010-2013 Mario Zechner (contact@badlogicgames.com), Nathan Sweet (admin@esotericsoftware.com)
                                </i></div>
                        </small></p>
</body>
</html>