Last active
December 15, 2015 23:06
-
-
Save piotr-j/edd74c07bdaa4bb944f4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class PolyBatchTest extends ApplicationAdapter { | |
PolygonSpriteBatch batch; | |
@Override public void create () { | |
Pixmap white = new Pixmap(3, 3, Pixmap.Format.RGBA8888); | |
white.setColor(Color.WHITE); | |
white.drawRectangle(0, 0, 3, 3); | |
Texture texture = new Texture(white); | |
white.dispose(); | |
PolygonRegion region = new PolygonRegion(new TextureRegion(texture), new float[]{0, 0, 0, 3, 3, 3, 3, 0}, new short[]{0,1,2,0,3,2}); | |
// 6, so we cant fit 2 regions | |
batch = new PolygonSpriteBatch(6); | |
batch.begin(); | |
batch.draw(region, 0, 0); | |
batch.draw(region, 0, 0); | |
// java.lang.ArrayIndexOutOfBoundsException: 30 | |
batch.end(); | |
texture.dispose(); | |
batch.dispose(); | |
} | |
public static void main (String[] arg) { | |
LwjglApplicationConfiguration config = new LwjglApplicationConfiguration(); | |
new LwjglApplication(new PolyBatchTest(), config); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment