
<?xml version="1.0" encoding="utf-8"?>
<Screen name="Bresenham2Test" descriptors="xworker.libgdx.Screen" red="0" green="0" blue="0" alpha="0">
<actions>
<GroovyAction name="render">
<code><![CDATA[batch.begin();
batch.draw(result, 0, 0);
batch.end();]]></code>
</GroovyAction>
</actions>
<Code name="init">
<code><![CDATA[import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.Pixmap;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.Pixmap.Format;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.math.Bresenham2;
import com.badlogic.gdx.math.GridPoint2;
import com.badlogic.gdx.math.Vector2;
Pixmap pixmap = new Pixmap(512, 512, Format.RGBA8888);
pixmap.setColor(Color.WHITE);
Bresenham2 bresenham = new Bresenham2();
for (GridPoint2 point : bresenham.line(0, 0, 512, 512))
pixmap.drawPixel(point.x, point.y);
for (GridPoint2 point : bresenham.line(512, 0, 0, 512))
pixmap.drawPixel(point.x, point.y);
for (GridPoint2 point : bresenham.line(0, 0, 512, 256))
pixmap.drawPixel(point.x, point.y);
for (GridPoint2 point : bresenham.line(512, 0, 0, 256))
pixmap.drawPixel(point.x, point.y);
result = new Texture(pixmap);
batch = new SpriteBatch();]]></code>
</Code>
</Screen>