Class DrawUtils

java.lang.Object
com.prineside.tdi2.utils.DrawUtils

public class DrawUtils extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    bakeVertices(float[] toVertices, com.badlogic.gdx.graphics.g2d.TextureRegion region, float x, float y, float originX, float originY, float width, float height, float scaleX, float scaleY, float rotation)
    Запечь вершины, чтобы использовать в Batch.
    static com.badlogic.gdx.graphics.Mesh
    copyMesh(com.badlogic.gdx.graphics.Mesh meshToCopy, boolean isStatic, boolean removeDuplicates, int[] usage)
     
    static void
    drawFontToCache(com.badlogic.gdx.graphics.g2d.SpriteCache cache, CharSequence text, com.badlogic.gdx.graphics.g2d.BitmapFont font, float color, float x, float y, float targetWidth, int halign, boolean wrap)
     
    static void
    drawFontToCache(com.badlogic.gdx.graphics.g2d.SpriteCache cache, CharSequence text, com.badlogic.gdx.graphics.g2d.BitmapFont font, float color, float x, float y, float targetWidth, int halign, boolean wrap, float scale)
     
    static float[]
    getTexturedLineVertices(com.badlogic.gdx.graphics.g2d.TextureRegion textureRegion, float startX, float startY, float endX, float endY, float startWidth, float endWidth, float startAngleRad, float endAngleRad, float startColor, float endColor)
     
    static int
    getTexturedMultiLineVertices(float[] out, float width, com.badlogic.gdx.graphics.g2d.TextureRegion textureRegion, float[] data, int dataStart, int dataLength)
     
    static com.badlogic.gdx.graphics.Mesh
    mergeMeshes(com.badlogic.gdx.utils.Array<com.badlogic.gdx.graphics.Mesh> meshes, com.badlogic.gdx.utils.Array<com.badlogic.gdx.math.Matrix4> transformations)
     
    static void
    prepareBezierCurve(float[] out, com.badlogic.gdx.math.Vector2[] points, int segmentCount, com.badlogic.gdx.graphics.Color startColor, com.badlogic.gdx.graphics.Color endColor)
    Generates an array of segments for the curve, lerping between two colors Can be used for texturedMultiLine()
    static void
    texturedLine(com.badlogic.gdx.graphics.g2d.Batch batch, com.badlogic.gdx.graphics.g2d.TextureRegion textureRegion, float startX, float startY, float endX, float endY, float width)
     
    static void
    texturedLine(com.badlogic.gdx.graphics.g2d.Batch batch, com.badlogic.gdx.graphics.g2d.TextureRegion textureRegion, float startX, float startY, float endX, float endY, float width, float startColor, float endColor)
     
    static void
    texturedLine(com.badlogic.gdx.graphics.g2d.Batch batch, com.badlogic.gdx.graphics.g2d.TextureRegion textureRegion, float startX, float startY, float endX, float endY, float startWidth, float endWidth, float startAngleRad, float endAngleRad, float startColor, float endColor)
     
    static void
    texturedLine(com.badlogic.gdx.graphics.g2d.Batch batch, com.badlogic.gdx.graphics.g2d.TextureRegion textureRegion, float startX, float startY, float endX, float endY, float startWidth, float endWidth, float startAngleRad, float endAngleRad, com.badlogic.gdx.graphics.Color startColor, com.badlogic.gdx.graphics.Color endColor)
     
    static void
    texturedLine(com.badlogic.gdx.graphics.g2d.Batch batch, com.badlogic.gdx.graphics.g2d.TextureRegion textureRegion, float startX, float startY, float endX, float endY, float startWidth, float endWidth, com.badlogic.gdx.graphics.Color startColor, com.badlogic.gdx.graphics.Color endColor)
     
    static void
    texturedLine(com.badlogic.gdx.graphics.g2d.Batch batch, com.badlogic.gdx.graphics.Texture texture, float u, float v, float u2, float v2, float startX, float startY, float endX, float endY, float startWidth, float endWidth, float startAngleRad, float endAngleRad, float startColorBits, float endColorBits)
     
    static void
    texturedLine(com.badlogic.gdx.graphics.g2d.SpriteCache spriteCache, com.badlogic.gdx.graphics.g2d.TextureRegion textureRegion, float startX, float startY, float endX, float endY, float width, float startColor, float endColor)
     
    static void
    texturedLine(com.badlogic.gdx.graphics.g2d.SpriteCache spriteCache, com.badlogic.gdx.graphics.g2d.TextureRegion textureRegion, float startX, float startY, float endX, float endY, float startWidth, float endWidth, float startAngleRad, float endAngleRad, float startColor, float endColor)
     
    static void
    texturedMultiLine(com.badlogic.gdx.graphics.g2d.Batch batch, float width, com.badlogic.gdx.graphics.g2d.TextureRegion textureRegion, float[] data)
    data - массив точек линии, каждая точка состоит из 4 floats: x, y, color Минимум 2 точки

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • DrawUtils

      public DrawUtils()
  • Method Details

    • bakeVertices

      public static void bakeVertices(float[] toVertices, com.badlogic.gdx.graphics.g2d.TextureRegion region, float x, float y, float originX, float originY, float width, float height, float scaleX, float scaleY, float rotation)
      Запечь вершины, чтобы использовать в Batch. Цвет не устанавливается (будет белый) - менять ячейки i * 5 + 2
      Parameters:
      toVertices - float[20]
    • prepareBezierCurve

      public static void prepareBezierCurve(float[] out, com.badlogic.gdx.math.Vector2[] points, int segmentCount, com.badlogic.gdx.graphics.Color startColor, com.badlogic.gdx.graphics.Color endColor)
      Generates an array of segments for the curve, lerping between two colors Can be used for texturedMultiLine()
      Parameters:
      out - array of size (segmentCount + 1) * 3 for every point of the curve. Each point is represented as x, y and color where
      points - Bezier curve points, array of 2 (linear), 3 (cubic) or 4 (quadratic)
      segmentCount - number of segments, at least 2. Higher number = smoother curve
      startColor - color at the start of the curve
      endColor - color at the end of the curve
    • getTexturedMultiLineVertices

      public static int getTexturedMultiLineVertices(float[] out, float width, com.badlogic.gdx.graphics.g2d.TextureRegion textureRegion, float[] data, int dataStart, int dataLength)
      Parameters:
      out - must be of size ((dataLength / 3) - 1) * 20 or larger
      Returns:
      length of vertices array
    • getTexturedLineVertices

      public static float[] getTexturedLineVertices(com.badlogic.gdx.graphics.g2d.TextureRegion textureRegion, float startX, float startY, float endX, float endY, float startWidth, float endWidth, float startAngleRad, float endAngleRad, float startColor, float endColor)
      Returns:
      array of 20 floats ready to be drawn by batch
    • texturedMultiLine

      public static void texturedMultiLine(com.badlogic.gdx.graphics.g2d.Batch batch, float width, com.badlogic.gdx.graphics.g2d.TextureRegion textureRegion, float[] data)
      data - массив точек линии, каждая точка состоит из 4 floats: x, y, color Минимум 2 точки
    • texturedLine

      public static void texturedLine(com.badlogic.gdx.graphics.g2d.Batch batch, com.badlogic.gdx.graphics.g2d.TextureRegion textureRegion, float startX, float startY, float endX, float endY, float width)
    • texturedLine

      public static void texturedLine(com.badlogic.gdx.graphics.g2d.Batch batch, com.badlogic.gdx.graphics.g2d.TextureRegion textureRegion, float startX, float startY, float endX, float endY, float width, float startColor, float endColor)
    • texturedLine

      public static void texturedLine(com.badlogic.gdx.graphics.g2d.Batch batch, com.badlogic.gdx.graphics.g2d.TextureRegion textureRegion, float startX, float startY, float endX, float endY, float startWidth, float endWidth, float startAngleRad, float endAngleRad, float startColor, float endColor)
    • texturedLine

      public static void texturedLine(com.badlogic.gdx.graphics.g2d.SpriteCache spriteCache, com.badlogic.gdx.graphics.g2d.TextureRegion textureRegion, float startX, float startY, float endX, float endY, float width, float startColor, float endColor)
    • texturedLine

      public static void texturedLine(com.badlogic.gdx.graphics.g2d.SpriteCache spriteCache, com.badlogic.gdx.graphics.g2d.TextureRegion textureRegion, float startX, float startY, float endX, float endY, float startWidth, float endWidth, float startAngleRad, float endAngleRad, float startColor, float endColor)
    • texturedLine

      public static void texturedLine(com.badlogic.gdx.graphics.g2d.Batch batch, com.badlogic.gdx.graphics.g2d.TextureRegion textureRegion, float startX, float startY, float endX, float endY, float startWidth, float endWidth, float startAngleRad, float endAngleRad, com.badlogic.gdx.graphics.Color startColor, com.badlogic.gdx.graphics.Color endColor)
    • texturedLine

      public static void texturedLine(com.badlogic.gdx.graphics.g2d.Batch batch, com.badlogic.gdx.graphics.Texture texture, float u, float v, float u2, float v2, float startX, float startY, float endX, float endY, float startWidth, float endWidth, float startAngleRad, float endAngleRad, float startColorBits, float endColorBits)
    • texturedLine

      public static void texturedLine(com.badlogic.gdx.graphics.g2d.Batch batch, com.badlogic.gdx.graphics.g2d.TextureRegion textureRegion, float startX, float startY, float endX, float endY, float startWidth, float endWidth, com.badlogic.gdx.graphics.Color startColor, com.badlogic.gdx.graphics.Color endColor)
    • drawFontToCache

      public static void drawFontToCache(com.badlogic.gdx.graphics.g2d.SpriteCache cache, CharSequence text, com.badlogic.gdx.graphics.g2d.BitmapFont font, float color, float x, float y, float targetWidth, int halign, boolean wrap)
    • drawFontToCache

      public static void drawFontToCache(com.badlogic.gdx.graphics.g2d.SpriteCache cache, CharSequence text, com.badlogic.gdx.graphics.g2d.BitmapFont font, float color, float x, float y, float targetWidth, int halign, boolean wrap, float scale)
    • mergeMeshes

      public static com.badlogic.gdx.graphics.Mesh mergeMeshes(com.badlogic.gdx.utils.Array<com.badlogic.gdx.graphics.Mesh> meshes, com.badlogic.gdx.utils.Array<com.badlogic.gdx.math.Matrix4> transformations)
    • copyMesh

      public static com.badlogic.gdx.graphics.Mesh copyMesh(com.badlogic.gdx.graphics.Mesh meshToCopy, boolean isStatic, boolean removeDuplicates, int[] usage)