Search in sources :

Example 1 with Bresenham2

use of com.badlogic.gdx.math.Bresenham2 in project libgdx by libgdx.

the class Bresenham2Test method create.

@Override
public void create() {
    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();
}
Also used : Bresenham2(com.badlogic.gdx.math.Bresenham2) GridPoint2(com.badlogic.gdx.math.GridPoint2) Texture(com.badlogic.gdx.graphics.Texture) SpriteBatch(com.badlogic.gdx.graphics.g2d.SpriteBatch) Pixmap(com.badlogic.gdx.graphics.Pixmap)

Aggregations

Pixmap (com.badlogic.gdx.graphics.Pixmap)1 Texture (com.badlogic.gdx.graphics.Texture)1 SpriteBatch (com.badlogic.gdx.graphics.g2d.SpriteBatch)1 Bresenham2 (com.badlogic.gdx.math.Bresenham2)1 GridPoint2 (com.badlogic.gdx.math.GridPoint2)1