<!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>PolygonSpriteBatch (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="PolygonSpriteBatch (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/PolygonSpriteBatch.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/PolygonSprite.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/Sprite.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/PolygonSpriteBatch.html" target="_top">Frames
</a></li>
<li><a href="PolygonSpriteBatch.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:
</li>
<li>Nested
|
</li>
<li><a href="#field_summary">Field
</a> |
</li>
<li><a href="#constructor_summary">Constr
</a> |
</li>
<li><a href="#method_summary">Method
</a></li>
</ul>
<ul class="subNavList">
<li>Detail:
</li>
<li><a href="#field_detail">Field
</a> |
</li>
<li><a href="#constructor_detail">Constr
</a> |
</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 PolygonSpriteBatch" class="title">Class PolygonSpriteBatch
</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li>java.lang.Object
</li>
<li>
<ul class="inheritance">
<li>com.badlogic.gdx.graphics.g2d.PolygonSpriteBatch
</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<hr>
<br>
<pre>public class
<span class="strong">PolygonSpriteBatch
</span>
extends java.lang.Object
</pre>
<div class="block">A PolygonSpriteBatch is used to draw 2D polygons that reference a texture (region). The class will batch the drawing commands
and optimize them for processing by the GPU.
<p>
To draw something with a PolygonSpriteBatch one has to first call the
<a href="../../../../../com/badlogic/gdx/graphics/g2d/PolygonSpriteBatch.html#begin()"><code>begin()
</code></a> method which will
setup appropriate render states. When you are done with drawing you have to call
<a href="../../../../../com/badlogic/gdx/graphics/g2d/PolygonSpriteBatch.html#end()"><code>end()
</code></a> which will
actually draw the things you specified.
<p>
All drawing commands of the PolygonSpriteBatch operate in screen coordinates. The screen coordinate system has an x-axis
pointing to the right, an y-axis pointing upwards and the origin is in the lower left corner of the screen. You can also
provide your own transformation and projection matrices if you so wish.
<p>
A PolygonSpriteBatch is managed. In case the OpenGL context is lost all OpenGL resources a PolygonSpriteBatch uses internally
get invalidated. A context is lost when a user switches to another application or receives an incoming call on Android. A
SpritPolygonSpriteBatcheBatch will be automatically reloaded after the OpenGL context is restored.
<p>
A PolygonSpriteBatch is a pretty heavy object so you should only ever have one in your program.
<p>
A PolygonSpriteBatch works with OpenGL ES 1.x and 2.0. In the case of a 2.0 context it will use its own custom shader to draw
all provided sprites. You can set your own custom shader via
<a href="../../../../../com/badlogic/gdx/graphics/g2d/PolygonSpriteBatch.html#setShader(com.badlogic.gdx.graphics.glutils.ShaderProgram)"><code>setShader(ShaderProgram)
</code></a>.
<p>
A PolygonSpriteBatch has to be disposed if it is no longer used.
</div>
<dl><dt><span class="strong">Author:
</span></dt>
<dd>mzechner, Stefan Bachmann, Nathan Sweet
</dd></dl>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- =========== FIELD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="field_summary">
<!-- -->
</a>
<h3>Field Summary
</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Field Summary table, listing fields, and an explanation">
<caption><span>Fields
</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type
</th>
<th class="colLast" scope="col">Field and Description
</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>int
</code></td>
<td class="colLast"><code><strong><a href="../../../../../com/badlogic/gdx/graphics/g2d/PolygonSpriteBatch.html#maxTrianglesInBatch">maxTrianglesInBatch
</a></strong></code>
<div class="block">The maximum number of triangles rendered in one batch so far.
</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>int
</code></td>
<td class="colLast"><code><strong><a href="../../../../../com/badlogic/gdx/graphics/g2d/PolygonSpriteBatch.html#renderCalls">renderCalls
</a></strong></code>
<div class="block">Number of render calls since the last
<a href="../../../../../com/badlogic/gdx/graphics/g2d/PolygonSpriteBatch.html#begin()"><code>begin()
</code></a>.
</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/PolygonSpriteBatch.html#totalRenderCalls">totalRenderCalls
</a></strong></code>
<div class="block">Number of rendering calls, ever.
</div>
</td>
</tr>
</table>
</li>
</ul>
<!-- ======== 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"> </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/PolygonSpriteBatch.html#PolygonSpriteBatch()">PolygonSpriteBatch
</a></strong>()
</code>
<div class="block">Constructs a new PolygonSpriteBatch with a size of 2000, the default shader, and one buffer.
</div>
</td>
</tr>
<tr class="rowColor">
<td class="colOne"><code><strong><a href="../../../../../com/badlogic/gdx/graphics/g2d/PolygonSpriteBatch.html#PolygonSpriteBatch(int)">PolygonSpriteBatch
</a></strong>(int
size)
</code>
<div class="block">Constructs a PolygonSpriteBatch with the default shader and one buffer.
</div>
</td>
</tr>
<tr class="altColor">
<td class="colOne"><code><strong><a href="../../../../../com/badlogic/gdx/graphics/g2d/PolygonSpriteBatch.html#PolygonSpriteBatch(int, int)">PolygonSpriteBatch
</a></strong>(int
size,
int
buffers)
</code>
<div class="block">Constructs a PolygonSpriteBatch with the default shader.
</div>
</td>
</tr>
<tr class="rowColor">
<td class="colOne"><code><strong><a href="../../../../../com/badlogic/gdx/graphics/g2d/PolygonSpriteBatch.html#PolygonSpriteBatch(int, int, com.badlogic.gdx.graphics.glutils.ShaderProgram)">PolygonSpriteBatch
</a></strong>(int
size,
int
buffers,
<a href="../../../../../com/badlogic/gdx/graphics/glutils/ShaderProgram.html" title="class in com.badlogic.gdx.graphics.glutils">ShaderProgram
</a> defaultShader)
</code>
<div class="block">Constructs a new PolygonSpriteBatch.
</div>
</td>
</tr>
<tr class="altColor">
<td class="colOne"><code><strong><a href="../../../../../com/badlogic/gdx/graphics/g2d/PolygonSpriteBatch.html#PolygonSpriteBatch(int, com.badlogic.gdx.graphics.glutils.ShaderProgram)">PolygonSpriteBatch
</a></strong>(int
size,
<a href="../../../../../com/badlogic/gdx/graphics/glutils/ShaderProgram.html" title="class in com.badlogic.gdx.graphics.glutils">ShaderProgram
</a> defaultShader)
</code>
<div class="block">Constructs a new PolygonSpriteBatch with one buffer.
</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"> </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/PolygonSpriteBatch.html#begin()">begin
</a></strong>()
</code>
<div class="block">Sets up the PolygonSpriteBatch for drawing.
</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/PolygonSpriteBatch.html#disableBlending()">disableBlending
</a></strong>()
</code>
<div class="block">Disables blending for drawing sprites.
</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/PolygonSpriteBatch.html#dispose()">dispose
</a></strong>()
</code>
<div class="block">Disposes all resources associated with this PolygonSpriteBatch.
</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/PolygonSpriteBatch.html#draw(com.badlogic.gdx.graphics.g2d.PolygonRegion, float, float)">draw
</a></strong>(
<a href="../../../../../com/badlogic/gdx/graphics/g2d/PolygonRegion.html" title="class in com.badlogic.gdx.graphics.g2d">PolygonRegion
</a> region,
float
x,
float
y)
</code>
<div class="block">Draws a polygon region with the bottom left corner at x,y having the width and height of the region.
</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/PolygonSpriteBatch.html#draw(com.badlogic.gdx.graphics.g2d.PolygonRegion, float, float, float, float)">draw
</a></strong>(
<a href="../../../../../com/badlogic/gdx/graphics/g2d/PolygonRegion.html" title="class in com.badlogic.gdx.graphics.g2d">PolygonRegion
</a> region,
float
x,
float
y,
float
width,
float
height)
</code>
<div class="block">Draws a polygon region with the bottom left corner at x,y and stretching the region to cover the given width and height.
</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/PolygonSpriteBatch.html#draw(com.badlogic.gdx.graphics.g2d.PolygonRegion, float, float, float, float, float, float, float, float, float)">draw
</a></strong>(
<a href="../../../../../com/badlogic/gdx/graphics/g2d/PolygonRegion.html" title="class in com.badlogic.gdx.graphics.g2d">PolygonRegion
</a> region,
float
x,
float
y,
float
originX,
float
originY,
float
width,
float
height,
float
scaleX,
float
scaleY,
float
rotation)
</code>
<div class="block">Draws the polygon region with the bottom left corner at x,y and stretching the region to cover the given width and height.
</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/PolygonSpriteBatch.html#draw(com.badlogic.gdx.graphics.Texture, float[], int, int, short[], int, int)">draw
</a></strong>(
<a href="../../../../../com/badlogic/gdx/graphics/Texture.html" title="class in com.badlogic.gdx.graphics">Texture
</a> texture,
float[]
polygonVertices,
int
verticesOffset,
int
verticesCount,
short[]
polygonTriangles,
int
trianglesOffset,
int
trianglesCount)
</code>
<div class="block">Draws the polygon using the given vertices and triangles.
</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/PolygonSpriteBatch.html#enableBlending()">enableBlending
</a></strong>()
</code>
<div class="block">Enables blending for sprites.
</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/PolygonSpriteBatch.html#end()">end
</a></strong>()
</code>
<div class="block">Finishes off 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/PolygonSpriteBatch.html#flush()">flush
</a></strong>()
</code>
<div class="block">Causes any pending sprites to be rendered, without ending the PolygonSpriteBatch.
</div>
</td>
</tr>
<tr class="altColor">
<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/PolygonSpriteBatch.html#getColor()">getColor
</a></strong>()
</code> </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/PolygonSpriteBatch.html#getProjectionMatrix()">getProjectionMatrix
</a></strong>()
</code>
<div class="block">Returns the current projection matrix.
</div>
</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/PolygonSpriteBatch.html#getTransformMatrix()">getTransformMatrix
</a></strong>()
</code>
<div class="block">Returns the current transform matrix.
</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>boolean
</code></td>
<td class="colLast"><code><strong><a href="../../../../../com/badlogic/gdx/graphics/g2d/PolygonSpriteBatch.html#isBlendingEnabled()">isBlendingEnabled
</a></strong>()
</code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void
</code></td>
<td class="colLast"><code><strong><a href="../../../../../com/badlogic/gdx/graphics/g2d/PolygonSpriteBatch.html#setBlendFunction(int, int)">setBlendFunction
</a></strong>(int
srcFunc,
int
dstFunc)
</code>
<div class="block">Sets the blending function to be used when rendering sprites.
</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/PolygonSpriteBatch.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> tint)
</code>
<div class="block">Sets the color used to tint images when they are added to the PolygonSpriteBatch.
</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/PolygonSpriteBatch.html#setColor(float)">setColor
</a></strong>(float
color)
</code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void
</code></td>
<td class="colLast"><code><strong><a href="../../../../../com/badlogic/gdx/graphics/g2d/PolygonSpriteBatch.html#setColor(float, float, float, float)">setColor
</a></strong>(float
r,
float
g,
float
b,
float
a)
</code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void
</code></td>
<td class="colLast"><code><strong><a href="../../../../../com/badlogic/gdx/graphics/g2d/PolygonSpriteBatch.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> projection)
</code>
<div class="block">Sets the projection matrix to be used by this PolygonSpriteBatch.
</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/PolygonSpriteBatch.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> shader)
</code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void
</code></td>
<td class="colLast"><code><strong><a href="../../../../../com/badlogic/gdx/graphics/g2d/PolygonSpriteBatch.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> transform)
</code>
<div class="block">Sets the transform matrix to be used by this PolygonSpriteBatch.
</div>
</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods_inherited_from_class_java.lang.Object">
<!-- -->
</a>
<h3>Methods inherited from class
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">
<!-- ============ FIELD DETAIL =========== -->
<ul class="blockList">
<li class="blockList"><a name="field_detail">
<!-- -->
</a>
<h3>Field Detail
</h3>
<a name="renderCalls">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>renderCalls
</h4>
<pre>public
int renderCalls
</pre>
<div class="block">Number of render calls since the last
<a href="../../../../../com/badlogic/gdx/graphics/g2d/PolygonSpriteBatch.html#begin()"><code>begin()
</code></a>.
</div>
</li>
</ul>
<a name="totalRenderCalls">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>totalRenderCalls
</h4>
<pre>public
int totalRenderCalls
</pre>
<div class="block">Number of rendering calls, ever. Will not be reset unless set manually.
</div>
</li>
</ul>
<a name="maxTrianglesInBatch">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>maxTrianglesInBatch
</h4>
<pre>public
int maxTrianglesInBatch
</pre>
<div class="block">The maximum number of triangles rendered in one batch so far.
</div>
</li>
</ul>
</li>
</ul>
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor_detail">
<!-- -->
</a>
<h3>Constructor Detail
</h3>
<a name="PolygonSpriteBatch()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>PolygonSpriteBatch
</h4>
<pre>public
PolygonSpriteBatch()
</pre>
<div class="block">Constructs a new PolygonSpriteBatch with a size of 2000, the default shader, and one buffer.
</div>
<dl><dt><span class="strong">See Also:
</span></dt><dd><a href="../../../../../com/badlogic/gdx/graphics/g2d/PolygonSpriteBatch.html#PolygonSpriteBatch(int, int, com.badlogic.gdx.graphics.glutils.ShaderProgram)"><code>PolygonSpriteBatch(int, int, ShaderProgram)
</code></a></dd></dl>
</li>
</ul>
<a name="PolygonSpriteBatch(int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>PolygonSpriteBatch
</h4>
<pre>public
PolygonSpriteBatch(int
size)
</pre>
<div class="block">Constructs a PolygonSpriteBatch with the default shader and one buffer.
</div>
<dl><dt><span class="strong">See Also:
</span></dt><dd><a href="../../../../../com/badlogic/gdx/graphics/g2d/PolygonSpriteBatch.html#PolygonSpriteBatch(int, int, com.badlogic.gdx.graphics.glutils.ShaderProgram)"><code>PolygonSpriteBatch(int, int, ShaderProgram)
</code></a></dd></dl>
</li>
</ul>
<a name="PolygonSpriteBatch(int, com.badlogic.gdx.graphics.glutils.ShaderProgram)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>PolygonSpriteBatch
</h4>
<pre>public
PolygonSpriteBatch(int
size,
<a href="../../../../../com/badlogic/gdx/graphics/glutils/ShaderProgram.html" title="class in com.badlogic.gdx.graphics.glutils">ShaderProgram
</a> defaultShader)
</pre>
<div class="block">Constructs a new PolygonSpriteBatch with one buffer.
</div>
<dl><dt><span class="strong">See Also:
</span></dt><dd><a href="../../../../../com/badlogic/gdx/graphics/g2d/PolygonSpriteBatch.html#PolygonSpriteBatch(int, int, com.badlogic.gdx.graphics.glutils.ShaderProgram)"><code>PolygonSpriteBatch(int, int, ShaderProgram)
</code></a></dd></dl>
</li>
</ul>
<a name="PolygonSpriteBatch(int, int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>PolygonSpriteBatch
</h4>
<pre>public
PolygonSpriteBatch(int
size,
int
buffers)
</pre>
<div class="block">Constructs a PolygonSpriteBatch with the default shader.
</div>
<dl><dt><span class="strong">See Also:
</span></dt><dd><a href="../../../../../com/badlogic/gdx/graphics/g2d/PolygonSpriteBatch.html#PolygonSpriteBatch(int, int, com.badlogic.gdx.graphics.glutils.ShaderProgram)"><code>PolygonSpriteBatch(int, int, ShaderProgram)
</code></a></dd></dl>
</li>
</ul>
<a name="PolygonSpriteBatch(int, int, com.badlogic.gdx.graphics.glutils.ShaderProgram)">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>PolygonSpriteBatch
</h4>
<pre>public
PolygonSpriteBatch(int
size,
int
buffers,
<a href="../../../../../com/badlogic/gdx/graphics/glutils/ShaderProgram.html" title="class in com.badlogic.gdx.graphics.glutils">ShaderProgram
</a> defaultShader)
</pre>
<div class="block">Constructs a new PolygonSpriteBatch. Sets the projection matrix to an orthographic projection with y-axis point upwards,
x-axis point to the right and the origin being in the bottom left corner of the screen. The projection will be pixel perfect
with respect to the current screen resolution.
<p>
The defaultShader specifies the shader to use. Note that the names for uniforms for this default shader are different than
the ones expect for shaders set with
<a href="../../../../../com/badlogic/gdx/graphics/g2d/PolygonSpriteBatch.html#setShader(com.badlogic.gdx.graphics.glutils.ShaderProgram)"><code>setShader(ShaderProgram)
</code></a>. See
<a href="../../../../../com/badlogic/gdx/graphics/g2d/SpriteBatch.html#createDefaultShader()"><code>SpriteBatch.createDefaultShader()
</code></a>.
</div>
<dl><dt><span class="strong">Parameters:
</span></dt><dd><code>size
</code> - The max number of vertices and number of triangles in a single batch. Max of 10920.
</dd><dd><code>buffers
</code> - The number of meshes to use. This is an expert function. It only makes sense with VBOs (see
<a href="../../../../../com/badlogic/gdx/graphics/Mesh.html#forceVBO"><code>Mesh.forceVBO
</code></a>).
</dd><dd><code>defaultShader
</code> - The default shader to use. This is not owned by the PolygonSpriteBatch and must be disposed separately.
</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="begin()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>begin
</h4>
<pre>public
void
begin()
</pre>
<div class="block">Sets up the PolygonSpriteBatch for drawing. This will disable depth buffer writting. It enables blending and texturing. If
you have more texture units enabled than the first one you have to disable them before calling this. Uses a screen
coordinate system by default where everything is given in pixels. You can specify your own projection and modelview matrices
via
<a href="../../../../../com/badlogic/gdx/graphics/g2d/PolygonSpriteBatch.html#setProjectionMatrix(com.badlogic.gdx.math.Matrix4)"><code>setProjectionMatrix(Matrix4)
</code></a> and
<a href="../../../../../com/badlogic/gdx/graphics/g2d/PolygonSpriteBatch.html#setTransformMatrix(com.badlogic.gdx.math.Matrix4)"><code>setTransformMatrix(Matrix4)
</code></a>.
</div>
</li>
</ul>
<a name="end()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>end
</h4>
<pre>public
void
end()
</pre>
<div class="block">Finishes off rendering. Enables depth writes, disables blending and texturing. Must always be called after a call to
<a href="../../../../../com/badlogic/gdx/graphics/g2d/PolygonSpriteBatch.html#begin()"><code>begin()
</code></a></div>
</li>
</ul>
<a name="setColor(com.badlogic.gdx.graphics.Color)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setColor
</h4>
<pre>public
void
setColor(
<a href="../../../../../com/badlogic/gdx/graphics/Color.html" title="class in com.badlogic.gdx.graphics">Color
</a> tint)
</pre>
<div class="block">Sets the color used to tint images when they are added to the PolygonSpriteBatch. 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
void
setColor(float
r,
float
g,
float
b,
float
a)
</pre>
<dl><dt><span class="strong">See Also:
</span></dt><dd><a href="../../../../../com/badlogic/gdx/graphics/g2d/PolygonSpriteBatch.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
void
setColor(float
color)
</pre>
<dl><dt><span class="strong">See Also:
</span></dt><dd><a href="../../../../../com/badlogic/gdx/graphics/g2d/PolygonSpriteBatch.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
<a href="../../../../../com/badlogic/gdx/graphics/Color.html" title="class in com.badlogic.gdx.graphics">Color
</a> getColor()
</pre>
<dl><dt><span class="strong">Returns:
</span></dt><dd>the rendering color of this PolygonSpriteBatch. Manipulating the returned instance has no effect.
</dd></dl>
</li>
</ul>
<a name="draw(com.badlogic.gdx.graphics.g2d.PolygonRegion, float, float)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>draw
</h4>
<pre>public
void
draw(
<a href="../../../../../com/badlogic/gdx/graphics/g2d/PolygonRegion.html" title="class in com.badlogic.gdx.graphics.g2d">PolygonRegion
</a> region,
float
x,
float
y)
</pre>
<div class="block">Draws a polygon region with the bottom left corner at x,y having the width and height of the region.
</div>
</li>
</ul>
<a name="draw(com.badlogic.gdx.graphics.g2d.PolygonRegion, float, float, float, float)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>draw
</h4>
<pre>public
void
draw(
<a href="../../../../../com/badlogic/gdx/graphics/g2d/PolygonRegion.html" title="class in com.badlogic.gdx.graphics.g2d">PolygonRegion
</a> region,
float
x,
float
y,
float
width,
float
height)
</pre>
<div class="block">Draws a polygon region with the bottom left corner at x,y and stretching the region to cover the given width and height.
</div>
</li>
</ul>
<a name="draw(com.badlogic.gdx.graphics.g2d.PolygonRegion, float, float, float, float, float, float, float, float, float)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>draw
</h4>
<pre>public
void
draw(
<a href="../../../../../com/badlogic/gdx/graphics/g2d/PolygonRegion.html" title="class in com.badlogic.gdx.graphics.g2d">PolygonRegion
</a> region,
float
x,
float
y,
float
originX,
float
originY,
float
width,
float
height,
float
scaleX,
float
scaleY,
float
rotation)
</pre>
<div class="block">Draws the polygon region with the bottom left corner at x,y and stretching the region to cover the given width and height.
The polygon region is offset by originX, originY relative to the origin. Scale specifies the scaling factor by which the
polygon region should be scaled around originX, originY. Rotation specifies the angle of counter clockwise rotation of the
rectangle around originX, originY.
</div>
</li>
</ul>
<a name="draw(com.badlogic.gdx.graphics.Texture, float[], int, int, short[], int, int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>draw
</h4>
<pre>public
void
draw(
<a href="../../../../../com/badlogic/gdx/graphics/Texture.html" title="class in com.badlogic.gdx.graphics">Texture
</a> texture,
float[]
polygonVertices,
int
verticesOffset,
int
verticesCount,
short[]
polygonTriangles,
int
trianglesOffset,
int
trianglesCount)
</pre>
<div class="block">Draws the polygon using the given vertices and triangles. Each vertices must be made up of 5 elements in this order: x, y,
color, u, v.
</div>
</li>
</ul>
<a name="flush()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>flush
</h4>
<pre>public
void
flush()
</pre>
<div class="block">Causes any pending sprites to be rendered, without ending the PolygonSpriteBatch.
</div>
</li>
</ul>
<a name="disableBlending()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>disableBlending
</h4>
<pre>public
void
disableBlending()
</pre>
<div class="block">Disables blending for drawing sprites. Calling this within
<a href="../../../../../com/badlogic/gdx/graphics/g2d/PolygonSpriteBatch.html#begin()"><code>begin()
</code></a>/
<a href="../../../../../com/badlogic/gdx/graphics/g2d/PolygonSpriteBatch.html#end()"><code>end()
</code></a> will flush the batch.
</div>
</li>
</ul>
<a name="enableBlending()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>enableBlending
</h4>
<pre>public
void
enableBlending()
</pre>
<div class="block">Enables blending for sprites. Calling this within
<a href="../../../../../com/badlogic/gdx/graphics/g2d/PolygonSpriteBatch.html#begin()"><code>begin()
</code></a>/
<a href="../../../../../com/badlogic/gdx/graphics/g2d/PolygonSpriteBatch.html#end()"><code>end()
</code></a> will flush the batch.
</div>
</li>
</ul>
<a name="setBlendFunction(int, int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setBlendFunction
</h4>
<pre>public
void
setBlendFunction(int
srcFunc,
int
dstFunc)
</pre>
<div class="block">Sets the blending function to be used when rendering sprites.
</div>
<dl><dt><span class="strong">Parameters:
</span></dt><dd><code>srcFunc
</code> - the source function, e.g. GL11.GL_SRC_ALPHA. If set to -1, PolygonSpriteBatch won't change the blending
function.
</dd><dd><code>dstFunc
</code> - the destination function, e.g. GL11.GL_ONE_MINUS_SRC_ALPHA
</dd></dl>
</li>
</ul>
<a name="dispose()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>dispose
</h4>
<pre>public
void
dispose()
</pre>
<div class="block">Disposes all resources associated with this PolygonSpriteBatch.
</div>
</li>
</ul>
<a name="getProjectionMatrix()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getProjectionMatrix
</h4>
<pre>public
<a href="../../../../../com/badlogic/gdx/math/Matrix4.html" title="class in com.badlogic.gdx.math">Matrix4
</a> getProjectionMatrix()
</pre>
<div class="block">Returns the current projection matrix. Changing this within
<a href="../../../../../com/badlogic/gdx/graphics/g2d/PolygonSpriteBatch.html#begin()"><code>begin()
</code></a>/
<a href="../../../../../com/badlogic/gdx/graphics/g2d/PolygonSpriteBatch.html#end()"><code>end()
</code></a> results in undefined behaviour.
</div>
</li>
</ul>
<a name="getTransformMatrix()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getTransformMatrix
</h4>
<pre>public
<a href="../../../../../com/badlogic/gdx/math/Matrix4.html" title="class in com.badlogic.gdx.math">Matrix4
</a> getTransformMatrix()
</pre>
<div class="block">Returns the current transform matrix. Changing this within
<a href="../../../../../com/badlogic/gdx/graphics/g2d/PolygonSpriteBatch.html#begin()"><code>begin()
</code></a>/
<a href="../../../../../com/badlogic/gdx/graphics/g2d/PolygonSpriteBatch.html#end()"><code>end()
</code></a> results in undefined behaviour.
</div>
</li>
</ul>
<a name="setProjectionMatrix(com.badlogic.gdx.math.Matrix4)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setProjectionMatrix
</h4>
<pre>public
void
setProjectionMatrix(
<a href="../../../../../com/badlogic/gdx/math/Matrix4.html" title="class in com.badlogic.gdx.math">Matrix4
</a> projection)
</pre>
<div class="block">Sets the projection matrix to be used by this PolygonSpriteBatch. If this is called inside a
<a href="../../../../../com/badlogic/gdx/graphics/g2d/PolygonSpriteBatch.html#begin()"><code>begin()
</code></a>/
<a href="../../../../../com/badlogic/gdx/graphics/g2d/PolygonSpriteBatch.html#end()"><code>end()
</code></a>
block, the current batch is flushed to the gpu.
</div>
</li>
</ul>
<a name="setTransformMatrix(com.badlogic.gdx.math.Matrix4)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setTransformMatrix
</h4>
<pre>public
void
setTransformMatrix(
<a href="../../../../../com/badlogic/gdx/math/Matrix4.html" title="class in com.badlogic.gdx.math">Matrix4
</a> transform)
</pre>
<div class="block">Sets the transform matrix to be used by this PolygonSpriteBatch. If this is called inside a
<a href="../../../../../com/badlogic/gdx/graphics/g2d/PolygonSpriteBatch.html#begin()"><code>begin()
</code></a>/
<a href="../../../../../com/badlogic/gdx/graphics/g2d/PolygonSpriteBatch.html#end()"><code>end()
</code></a>
block, the current batch is flushed to the gpu.
</div>
</li>
</ul>
<a name="setShader(com.badlogic.gdx.graphics.glutils.ShaderProgram)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setShader
</h4>
<pre>public
void
setShader(
<a href="../../../../../com/badlogic/gdx/graphics/glutils/ShaderProgram.html" title="class in com.badlogic.gdx.graphics.glutils">ShaderProgram
</a> shader)
</pre>
<dl><dt><span class="strong">See Also:
</span></dt><dd><a href="../../../../../com/badlogic/gdx/graphics/g2d/SpriteBatch.html#setShader(com.badlogic.gdx.graphics.glutils.ShaderProgram)"><code>SpriteBatch.setShader(ShaderProgram)
</code></a></dd></dl>
</li>
</ul>
<a name="isBlendingEnabled()">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>isBlendingEnabled
</h4>
<pre>public
boolean
isBlendingEnabled()
</pre>
<dl><dt><span class="strong">Returns:
</span></dt><dd>whether blending for sprites is enabled
</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/PolygonSpriteBatch.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/PolygonSprite.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/Sprite.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/PolygonSpriteBatch.html" target="_top">Frames
</a></li>
<li><a href="PolygonSpriteBatch.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:
</li>
<li>Nested
|
</li>
<li><a href="#field_summary">Field
</a> |
</li>
<li><a href="#constructor_summary">Constr
</a> |
</li>
<li><a href="#method_summary">Method
</a></li>
</ul>
<ul class="subNavList">
<li>Detail:
</li>
<li><a href="#field_detail">Field
</a> |
</li>
<li><a href="#constructor_detail">Constr
</a> |
</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
© 2010-2013 Mario Zechner (contact@badlogicgames.com), Nathan Sweet (admin@esotericsoftware.com)
</i></div>
</small></p>
</body>
</html>