Package engine.util

Class ToolKit

java.lang.Object
engine.util.ToolKit

public final class ToolKit extends Object
Static class of util functions along with collision and image manipulation
Author:
Nico L. (MrDuckyTesla)
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private static processing.core.PApplet
    Stores the PApplet being used by all classes
    private static HashMap<Integer,Boolean>
    Stores all keys that are being held down
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    add(ArrayList<Integer> a, int[] b)
     
     
    static void
    changeColor(processing.core.PApplet app, processing.core.PImage image, ArrayList<Integer> colorList, int[] tintList)
    Given the list that is returned from PreCompile(), this function changes the color of input image
    static void
    changeSingleColor(processing.core.PApplet app, processing.core.PImage image, int[] ogColorRGB, int[] newColorRGB)
    Takes in an image along with a color from the image and a new color.
    static processing.core.PImage
    circleImage(processing.core.PApplet app, float x, float y, int res, float thickness, float sizeDisplay)
     
    static processing.core.PImage
    circleImage(processing.core.PApplet app, float x, float y, int res, float thickness, float sizeDisplay, int[] color1)
     
    static processing.core.PImage
    circleImage(processing.core.PApplet app, float x, float y, int res, float thickness, float sizeDisplay, int[] color1, boolean gradient)
     
    static processing.core.PImage
    circleImage(processing.core.PApplet app, float x, float y, int res, float thickness, float sizeDisplay, int[] color1, boolean gradient, int[] color2)
    Returns an image of a circle with varying thickness, resolution, and color (pixelated circle).
    static boolean
    circRectCollide(float cx, float cy, float cr, float rx, float ry, float rw, float rh)
     
    static void
    clearImage(processing.core.PApplet app, processing.core.PImage image)
    Takes an image and sets its alpha value to 0, making the image completely transparent
    static float[]
    closestPointLine(float px, float py, float x1, float y1, float x2, float y2)
     
    static float[]
    closestPointLine(float px, float py, float x1, float y1, float x2, float y2, boolean rounded)
    Finds the closest spot on a line from a point
    static boolean
    compareColorColor(int[] col1, int[] col2)
     
    static boolean
    compareColorList(int r, int g, int b, int a, int[] col)
     
    static boolean
    compareListList(float[] list1, float[] list2)
    Checks if two lines are identical
    static boolean
    compareProcessingColorList(processing.core.PApplet app, int color1, int[] color2)
     
    static void
    copy(processing.core.PApplet app, processing.core.PImage image1, processing.core.PImage image2)
    Copies image1 onto image2
    static boolean
    fillApp(int r, int g, int b)
     
    static processing.core.PApplet
     
    static int
     
    static int
     
    static boolean
     
    static Point
    getImageWH(processing.core.PImage p)
     
    static float[]
    getLimbCoords(float centerX, float centerY, float length1, float length2, float endX, float endY)
     
    static float[]
    getLimbCoords(float centerX, float centerY, float length1, float length2, float endX, float endY, boolean bendRight)
    Returns a set of coordinates that create an arm with one joint
    static <E extends Entity>
    ArrayList<E>
    getNeighbors(E obj, HashMap<Integer,ArrayList<E>> h, int wid, int hgt, int size)
     
    static <E extends Entity>
    ArrayList<E>
    getNeighborsRender(E obj, HashMap<Integer,ArrayList<E>> h, int wid, int hgt, int size)
     
    static int
    hash(int x, int y)
     
    static boolean
    keyIsDown(int key)
     
    static void
    lineDraw(processing.core.PApplet app, float x1, float y1, float x2, float y2)
    simple version of pixelated line that draws line instead of returning it
    static processing.core.PImage
    lineImage(processing.core.PApplet app, float x1, float y1, float x2, float y2)
     
    static processing.core.PImage
    lineImage(processing.core.PApplet app, float x1, float y1, float x2, float y2, int res, float thickness, float sizeDisplay)
     
    static processing.core.PImage
    lineImage(processing.core.PApplet app, float x1, float y1, float x2, float y2, int res, float thickness, float sizeDisplay, int[] color)
    Returns an image of a line with varying thickness, resolution, and color (pixelated line)
    static float[]
    lineLineCollide(float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4)
    Calculates if and where two lines collide
    static float[]
    lineRadius(float centerX, float centerY, float endX, float endY, float radius)
     
    static float[]
    lineRadius(float centerX, float centerY, float endX, float endY, float radius, boolean forceRadius)
    Returns a set of coordinates that keep a line within a certain radius
    static float[][]
    lineRectCollide(float x1, float y1, float x2, float y2, float rx, float ry, float rw, float rh)
    Checks if a line and rectangle collide
    static boolean[]
    lRectRectCollide(float rx1, float ry1, float rw1, float rh1, float rx2, float ry2, float rw2, float rh2)
     
    static boolean
     
    static boolean
    nRectRectCollide(float r1x, float r1y, float r1w, float r1h, float r2x, float r2y, float r2w, float r2h)
    Checks if rectangle is fully inside another rectangle
    static float[]
    nRectRectCollideCoords(float px, float py, float x1, float y1, float w1, float h1, float x2, float y2, float w2, float h2)
    Checks if two rectangles collide and returns the EXACT coordinates that the moving rectangle should be in, except moving rectangle is INSIDE non-moving rectangle
    static processing.core.PImage
    outline(processing.core.PApplet app, processing.core.PImage image)
     
    static processing.core.PImage
    outline(processing.core.PApplet app, processing.core.PImage image, int[] color1)
     
    static processing.core.PImage
    outline(processing.core.PApplet app, processing.core.PImage image, int[] color1, int[] color2)
    Returns the image given but with usually a single pixel outline around it (some cases may get 2 pixels, faster than outlineThin tho)
    static processing.core.PImage
    outlineThin(processing.core.PApplet app, processing.core.PImage image)
     
    static processing.core.PImage
    outlineThin(processing.core.PApplet app, processing.core.PImage image, int[] color1)
     
    static processing.core.PImage
    outlineThin(processing.core.PApplet app, processing.core.PImage image, int[] color1, int[] color2)
    Returns the image given but with a single pixel outline around it
    static void
    pixelate(processing.core.PApplet app, int res)
     
    static void
    pixelate(processing.core.PApplet app, int res, float x, float y, float w, float h)
    Takes a chunk of the PApplet and pixelates it, automatically drawing it over the given area of PApplet
    static void
    pixelate(processing.core.PApplet app, processing.core.PImage image, int res)
     
    static void
    pixelate(processing.core.PApplet app, processing.core.PImage image, int res, float x, float y, float w, float h)
    Takes a chunk of an image and pixelates it, automatically drawing it over the given area of the image
    static boolean
    pLineCollide(float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4)
    Checks if two parallel lines are colliding (useful for rectangle collision)
    static boolean
    pointCircCollide(float px, float py, float cx, float cy, float cr)
     
    static boolean
    pointRectCollide(float px, float py, float rx, float ry, float rw, float rh)
     
    static boolean
    pointRectCollideNotExact(float px, float py, float rx, float ry, float rw, float rh)
     
    static boolean
     
    PreCompile(processing.core.PApplet app, processing.core.PImage image, int[][] layerList)
    Precompiles the layers and colors of an image into a list
    static boolean
     
    static int[]
    pushBack(int[] a, int b)
     
    static <T> T[]
    pushBack(T[] a, T b)
     
    static boolean
    rectApp(float x, float y, float w, float h)
     
    static boolean
    rectRectCollide(float r1x, float r1y, float r1w, float r1h, float r2x, float r2y, float r2w, float r2h)
     
    static float[]
    rectRectCollideCoords(float px, float py, float x1, float y1, float w1, float h1, float x2, float y2, float w2, float h2)
    Checks if two rectangles collide and returns the EXACT coordinates that the moving rectangle should be in
    static boolean
    rectRectCollideNotExact(float r1x, float r1y, float r1w, float r1h, float r2x, float r2y, float r2w, float r2h)
     
    static <T> ArrayList<T>
    removeAll(T val, ArrayList<T> arr)
     
    static void
    resetColor(processing.core.PApplet app, processing.core.PImage image, ArrayList<Integer> colorList)
    Takes in an image that has been recompiled and resets it back to its original colors
    static boolean
    setApp(processing.core.PApplet app)
     
    static void
    setKey(int key, boolean state)
     
    static void
    sharpen(processing.core.PApplet app, processing.core.PImage image, int[] backgroundColor, int[] replacementColor)
    ngl gang i forgot what this one does, I think it was supposed to replace colors with more range
    static processing.core.PImage
    squareImage(processing.core.PApplet app, float x, float y, int res, float thickness, float sizeDisplay)
     
    static processing.core.PImage
    squareImage(processing.core.PApplet app, float x, float y, int res, float thickness, float sizeDisplay, int[] color1)
     
    static processing.core.PImage
    squareImage(processing.core.PApplet app, float x, float y, int res, float thickness, float sizeDisplay, int[] color1, boolean gradient)
     
    static processing.core.PImage
    squareImage(processing.core.PApplet app, float x, float y, int res, float thickness, float sizeDisplay, int[] color1, boolean gradient, int[] color2)
    Returns an image of squared dimensions with a nice gradient (pixelated circle)
    static Point
    unstick(float[] c)
    Takes rectRectCollideCoords() list output in and returns a point that can wont get stuck

    Methods inherited from class java.lang.Object

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

  • Constructor Details

    • ToolKit

      public ToolKit()
  • Method Details

    • PreCompile

      public static ArrayList<Integer> PreCompile(processing.core.PApplet app, processing.core.PImage image, int[][] layerList)
      Precompiles the layers and colors of an image into a list
      Parameters:
      app - PApplet instance that is being used
      image - The (presumably greyscale) spritesheet being compiled
      layerList - An array separated by layer holding greyscale colors (EX: [ [a, b, c], [d, e], [f] ],
      Returns:
      Returns a 1d ArrayList thats formatted with the index of color, the layer it belongs to, and the color
    • changeColor

      public static void changeColor(processing.core.PApplet app, processing.core.PImage image, ArrayList<Integer> colorList, int[] tintList)
      Given the list that is returned from PreCompile(), this function changes the color of input image
      Parameters:
      app - PApplet instance that is being used
      image - The (presumably greyscale) spritesheet being recolored
      colorList - List returned from PreCompile()
      tintList - The color you want to tint the image with in [R, G, B] format
    • changeSingleColor

      public static void changeSingleColor(processing.core.PApplet app, processing.core.PImage image, int[] ogColorRGB, int[] newColorRGB)
      Takes in an image along with a color from the image and a new color. Replaces the old color with a new one
      Parameters:
      app - PApplet instance that is being used
      image - The image that is getting changed
      ogColorRGB -
      newColorRGB -
    • resetColor

      public static void resetColor(processing.core.PApplet app, processing.core.PImage image, ArrayList<Integer> colorList)
      Takes in an image that has been recompiled and resets it back to its original colors
      Parameters:
      app - PApplet instance that is being used
      image - The image that is getting changed
      colorList - List returned from PreCompile()
    • clearImage

      public static void clearImage(processing.core.PApplet app, processing.core.PImage image)
      Takes an image and sets its alpha value to 0, making the image completely transparent
      Parameters:
      app - PApplet instance that is being used
      image - The image that is getting changed
    • pixelate

      public static void pixelate(processing.core.PApplet app, int res, float x, float y, float w, float h)
      Takes a chunk of the PApplet and pixelates it, automatically drawing it over the given area of PApplet
      Parameters:
      app - PApplet instance that is being used
      res - Resolution of pixelated area
      x - X coordinate indicating where to pixelate
      y - Y coordinate indicating where to pixelate
      w - Width of pixelated area
      h - Height of pixelated area
    • pixelate

      public static void pixelate(processing.core.PApplet app, processing.core.PImage image, int res, float x, float y, float w, float h)
      Takes a chunk of an image and pixelates it, automatically drawing it over the given area of the image
      Parameters:
      app - PApplet instance that is being used
      image - The image that is getting pixelated
      res - Resolution of pixelated area
      x - X coordinate indicating where to pixelate
      y - Y coordinate indicating where to pixelate
      w - Width of pixelated area
      h - Height of pixelated area
    • lineRadius

      public static float[] lineRadius(float centerX, float centerY, float endX, float endY, float radius, boolean forceRadius)
      Returns a set of coordinates that keep a line within a certain radius
      Parameters:
      centerX - X coordinate of where the line begins from
      centerY - Y coordinate of where the line begins from
      endX - X coordinate of where the line wants to end
      endY - Y coordinate of where the line wants to end
      radius - Radius that line must stay within
      forceRadius - Boolean that dictates if the line length will be the radius
      Returns:
      Set of coordinates in form [X, Y] that should be used instead of endpoint
    • getLimbCoords

      public static float[] getLimbCoords(float centerX, float centerY, float length1, float length2, float endX, float endY, boolean bendRight)
      Returns a set of coordinates that create an arm with one joint
      Parameters:
      centerX - X coordinate of where the arm begins from
      centerY - Y coordinate of where the arm begins from
      length1 - length of the first line that begins on centerX/Y
      length2 - length of the second line that begins on first lines end
      endX - X coordinate of where the arm wants to end
      endY - Y coordinate of where the arm wants to end
      bendRight - Boolean that dictates if the arms joint bends to the left or right
      Returns:
      Set of coordinates in form [X1, Y1, X2, Y2] that should be used as such: line(centerX, centerY, X1, Y1); line(X1, Y1, X2, Y2)
    • copy

      public static void copy(processing.core.PApplet app, processing.core.PImage image1, processing.core.PImage image2)
      Copies image1 onto image2
      Parameters:
      app - PApplet instance that is being used
      image1 - Image that is being overridden
      image2 - Source image being used to copy from
    • lineLineCollide

      public static float[] lineLineCollide(float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4)
      Calculates if and where two lines collide
      Parameters:
      x1 - One of the two X coordinates belonging to line1
      y1 - One of the two Y coordinates belonging to line1
      x2 - One of the two X coordinates belonging to line1
      y2 - One of the two Y coordinates belonging to line1
      x3 - One of the two X coordinates belonging to line2
      y3 - One of the two Y coordinates belonging to line2
      x4 - One of the two X coordinates belonging to line2
      y4 - One of the two Y coordinates belonging to line2
      Returns:
      Returns the set of coordinates in form [X, Y] if there is a collision. If there is no collision, returns empty array
    • closestPointLine

      public static float[] closestPointLine(float px, float py, float x1, float y1, float x2, float y2, boolean rounded)
      Finds the closest spot on a line from a point
      Parameters:
      px - X coordinate of point
      py - Y coordinate of point
      x1 - One of the two X coordinates belonging to line
      y1 - One of the two Y coordinates belonging to line
      x2 - One of the two X coordinates belonging to line
      y2 - One of the two Y coordinates belonging to line
      rounded - boolean that dictates if points towards the end of a line form sharp corners or not
      Returns:
      Returns the set of coordinates in form [X, Y] of the nearest point on the line
    • lineImage

      public static processing.core.PImage lineImage(processing.core.PApplet app, float x1, float y1, float x2, float y2, int res, float thickness, float sizeDisplay, int[] color)
      Returns an image of a line with varying thickness, resolution, and color (pixelated line)
      Parameters:
      app - PApplet instance that is being used
      x1 - One of the two X coordinates belonging to line
      y1 - One of the two Y coordinates belonging to line
      x2 - One of the two X coordinates belonging to line
      y2 - One of the two Y coordinates belonging to line
      res - Resolution of line in pixels
      thickness - How thick the line should be
      sizeDisplay - Size to display line at
      color - Color of line in [R, G, B, A] format
      Returns:
      image that contains pixelated line
    • lineDraw

      public static void lineDraw(processing.core.PApplet app, float x1, float y1, float x2, float y2)
      simple version of pixelated line that draws line instead of returning it
      Parameters:
      app - PApplet instance that is being used
      x1 - One of the two X coordinates belonging to line
      y1 - One of the two Y coordinates belonging to line
      x2 - One of the two X coordinates belonging to line
      y2 - One of the two Y coordinates belonging to line
    • circleImage

      public static processing.core.PImage circleImage(processing.core.PApplet app, float x, float y, int res, float thickness, float sizeDisplay, int[] color1, boolean gradient, int[] color2)
      Returns an image of a circle with varying thickness, resolution, and color (pixelated circle). Can have gradient too
      Parameters:
      app - PApplet instance that is being used
      x - Center X coordinate of circle
      y - Center Y coordinate of circle
      res - Resolution of circle in pixels
      thickness - Radius of circle
      sizeDisplay - Size to display circle at
      color1 - Color of circle in [R, G, B, A] format
      gradient - Boolean that dictated if there is a gradient
      color2 - Color of circle gradient in [R, G, B, A] format
      Returns:
      image that contains pixelated circle
    • squareImage

      public static processing.core.PImage squareImage(processing.core.PApplet app, float x, float y, int res, float thickness, float sizeDisplay, int[] color1, boolean gradient, int[] color2)
      Returns an image of squared dimensions with a nice gradient (pixelated circle)
      Parameters:
      app - PApplet instance that is being used
      x - Center X coordinate of square
      y - Center Y coordinate of square
      res - Resolution of square in pixels
      thickness - Radius of square
      sizeDisplay - Size to display square at
      color1 - Color of square in [R, G, B, A] format
      gradient - Boolean that dictated if there is a gradient
      color2 - Color of square gradient in [R, G, B, A] format
      Returns:
      image of squared dimensions with a nice gradient
    • outline

      public static processing.core.PImage outline(processing.core.PApplet app, processing.core.PImage image, int[] color1, int[] color2)
      Returns the image given but with usually a single pixel outline around it (some cases may get 2 pixels, faster than outlineThin tho)
      Parameters:
      app - PApplet instance that is being used
      image - Image that is getting outlined
      color1 - Color of background in [R, G, B, A] format
      color2 - Color of outline in [R, G, B, A] format
      Returns:
      Image with outline
    • outlineThin

      public static processing.core.PImage outlineThin(processing.core.PApplet app, processing.core.PImage image, int[] color1, int[] color2)
      Returns the image given but with a single pixel outline around it
      Parameters:
      app - PApplet instance that is being used
      image - Image that is getting outlined
      color1 - Color of background in [R, G, B, A] format
      color2 - Color of outline in [R, G, B, A] format
      Returns:
      Image with outline
    • sharpen

      public static void sharpen(processing.core.PApplet app, processing.core.PImage image, int[] backgroundColor, int[] replacementColor)
      ngl gang i forgot what this one does, I think it was supposed to replace colors with more range
      Parameters:
      app - PApplet instance that is being used
      image - Image that is getting changed
      backgroundColor - Color of background in [R, G, B, A] format
      replacementColor - Color of replacement in [R, G, B, A] format
    • rectRectCollideCoords

      public static float[] rectRectCollideCoords(float px, float py, float x1, float y1, float w1, float h1, float x2, float y2, float w2, float h2)
      Checks if two rectangles collide and returns the EXACT coordinates that the moving rectangle should be in
      Parameters:
      px - Previous X coordinate of moving rectangle
      py - Previous Y coordinate of moving rectangle
      x1 - Current X coordinate of moving rectangle
      y1 - Current X coordinate of moving rectangle
      w1 - Width of moving rectangle
      h1 - Height of moving rectangle
      x2 - Current X coordinate of non-moving rectangle
      y2 - Current Y coordinate of non-moving rectangle
      w2 - Width of non-moving rectangle
      h2 - Height of non-moving rectangle
      Returns:
      Coordinates in form of [X, Y, SIDE] with SIDE being which side the moving rectangle collided with (0 is top, 1 is right, 2 is bottom, 3 is left)
    • nRectRectCollideCoords

      public static float[] nRectRectCollideCoords(float px, float py, float x1, float y1, float w1, float h1, float x2, float y2, float w2, float h2)
      Checks if two rectangles collide and returns the EXACT coordinates that the moving rectangle should be in, except moving rectangle is INSIDE non-moving rectangle
      Parameters:
      px - Previous X coordinate of moving rectangle
      py - Previous Y coordinate of moving rectangle
      x1 - Current X coordinate of moving rectangle
      y1 - Current X coordinate of moving rectangle
      w1 - Width of moving rectangle
      h1 - Height of moving rectangle
      x2 - Current X coordinate of non-moving rectangle
      y2 - Current Y coordinate of non-moving rectangle
      w2 - Width of non-moving rectangle
      h2 - Height of non-moving rectangle
      Returns:
      Coordinates in form of [X, Y, SIDE] with SIDE being which side the moving rectangle collided with (0 is top, 1 is right, 2 is bottom, 3 is left)
    • nRectRectCollide

      public static boolean nRectRectCollide(float r1x, float r1y, float r1w, float r1h, float r2x, float r2y, float r2w, float r2h)
      Checks if rectangle is fully inside another rectangle
      Parameters:
      r1x - First rectangles X coordinate
      r1y - First rectangles Y coordinate
      r1w - First rectangles Width
      r1h - First rectangles Height
      r2x - Second rectangles X coordinate
      r2y - Second rectangles Y coordinate
      r2w - Second rectangles Width
      r2h - Second rectangles Height
      Returns:
      Boolean that represents if rectangle is fully inside another rectangle
    • pLineCollide

      public static boolean pLineCollide(float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4)
      Checks if two parallel lines are colliding (useful for rectangle collision)
      Parameters:
      x1 - One of the two X coordinates belonging to first line
      y1 - One of the two Y coordinates belonging to first line
      x2 - One of the two X coordinates belonging to first line
      y2 - One of the two Y coordinates belonging to first line
      x3 - One of the two X coordinates belonging to second line
      y3 - One of the two Y coordinates belonging to second line
      x4 - One of the two X coordinates belonging to second line
      y4 - One of the two Y coordinates belonging to second line
      Returns:
      Boolean representing if colliding with other line
    • compareListList

      public static boolean compareListList(float[] list1, float[] list2)
      Checks if two lines are identical
      Parameters:
      list1 - First list to compare
      list2 - Second list to compare
      Returns:
      Boolean representing if lists are same
    • unstick

      public static Point unstick(float[] c)
      Takes rectRectCollideCoords() list output in and returns a point that can wont get stuck
      Parameters:
      c - rectRectCollideCoords() output
      Returns:
      New unstuck point
      See Also:
    • lineRectCollide

      public static float[][] lineRectCollide(float x1, float y1, float x2, float y2, float rx, float ry, float rw, float rh)
      Checks if a line and rectangle collide
      Parameters:
      x1 -
      y1 -
      x2 -
      y2 -
      rx -
      ry -
      rw -
      rh -
      Returns:
    • lRectRectCollide

      public static boolean[] lRectRectCollide(float rx1, float ry1, float rw1, float rh1, float rx2, float ry2, float rw2, float rh2)
      Parameters:
      rx1 -
      ry1 -
      rw1 -
      rh1 -
      rx2 -
      ry2 -
      rw2 -
      rh2 -
      Returns:
    • rectRectCollide

      public static boolean rectRectCollide(float r1x, float r1y, float r1w, float r1h, float r2x, float r2y, float r2w, float r2h)
      Parameters:
      r1x -
      r1y -
      r1w -
      r1h -
      r2x -
      r2y -
      r2w -
      r2h -
      Returns:
    • rectRectCollideNotExact

      public static boolean rectRectCollideNotExact(float r1x, float r1y, float r1w, float r1h, float r2x, float r2y, float r2w, float r2h)
      Parameters:
      r1x -
      r1y -
      r1w -
      r1h -
      r2x -
      r2y -
      r2w -
      r2h -
      Returns:
    • circRectCollide

      public static boolean circRectCollide(float cx, float cy, float cr, float rx, float ry, float rw, float rh)
      Parameters:
      cx -
      cy -
      cr -
      rx -
      ry -
      rw -
      rh -
      Returns:
    • pointRectCollide

      public static boolean pointRectCollide(float px, float py, float rx, float ry, float rw, float rh)
      Parameters:
      px -
      py -
      rx -
      ry -
      rw -
      rh -
      Returns:
    • pointRectCollideNotExact

      public static boolean pointRectCollideNotExact(float px, float py, float rx, float ry, float rw, float rh)
      Parameters:
      px -
      py -
      rx -
      ry -
      rw -
      rh -
      Returns:
    • pointCircCollide

      public static boolean pointCircCollide(float px, float py, float cx, float cy, float cr)
      Parameters:
      px -
      py -
      cx -
      cy -
      cr -
      Returns:
    • compareProcessingColorList

      public static boolean compareProcessingColorList(processing.core.PApplet app, int color1, int[] color2)
      Parameters:
      app -
      color1 -
      color2 -
      Returns:
    • compareColorList

      public static boolean compareColorList(int r, int g, int b, int a, int[] col)
      Parameters:
      r -
      g -
      b -
      a -
      col -
      Returns:
    • compareColorColor

      public static boolean compareColorColor(int[] col1, int[] col2)
      Parameters:
      col1 -
      col2 -
      Returns:
    • getImageWH

      public static Point getImageWH(processing.core.PImage p)
      Parameters:
      p -
      Returns:
    • pixelate

      public static void pixelate(processing.core.PApplet app, int res)
      Parameters:
      app -
      res -
    • pixelate

      public static void pixelate(processing.core.PApplet app, processing.core.PImage image, int res)
      Parameters:
      app -
      image -
      res -
    • lineRadius

      public static float[] lineRadius(float centerX, float centerY, float endX, float endY, float radius)
      Parameters:
      centerX -
      centerY -
      endX -
      endY -
      radius -
      Returns:
    • getLimbCoords

      public static float[] getLimbCoords(float centerX, float centerY, float length1, float length2, float endX, float endY)
      Parameters:
      centerX -
      centerY -
      length1 -
      length2 -
      endX -
      endY -
      Returns:
    • closestPointLine

      public static float[] closestPointLine(float px, float py, float x1, float y1, float x2, float y2)
      Parameters:
      px -
      py -
      x1 -
      y1 -
      x2 -
      y2 -
      Returns:
    • lineImage

      public static processing.core.PImage lineImage(processing.core.PApplet app, float x1, float y1, float x2, float y2, int res, float thickness, float sizeDisplay)
      Parameters:
      app -
      x1 -
      y1 -
      x2 -
      y2 -
      res -
      thickness -
      sizeDisplay -
      Returns:
    • lineImage

      public static processing.core.PImage lineImage(processing.core.PApplet app, float x1, float y1, float x2, float y2)
      Parameters:
      app -
      x1 -
      y1 -
      x2 -
      y2 -
      Returns:
    • circleImage

      public static processing.core.PImage circleImage(processing.core.PApplet app, float x, float y, int res, float thickness, float sizeDisplay, int[] color1, boolean gradient)
      Parameters:
      app -
      x -
      y -
      res -
      thickness -
      sizeDisplay -
      color1 -
      gradient -
      Returns:
    • circleImage

      public static processing.core.PImage circleImage(processing.core.PApplet app, float x, float y, int res, float thickness, float sizeDisplay, int[] color1)
      Parameters:
      app -
      x -
      y -
      res -
      thickness -
      sizeDisplay -
      color1 -
      Returns:
    • circleImage

      public static processing.core.PImage circleImage(processing.core.PApplet app, float x, float y, int res, float thickness, float sizeDisplay)
      Parameters:
      app -
      x -
      y -
      res -
      thickness -
      sizeDisplay -
      Returns:
    • squareImage

      public static processing.core.PImage squareImage(processing.core.PApplet app, float x, float y, int res, float thickness, float sizeDisplay, int[] color1, boolean gradient)
      Parameters:
      app -
      x -
      y -
      res -
      thickness -
      sizeDisplay -
      color1 -
      gradient -
      Returns:
    • squareImage

      public static processing.core.PImage squareImage(processing.core.PApplet app, float x, float y, int res, float thickness, float sizeDisplay, int[] color1)
      Parameters:
      app -
      x -
      y -
      res -
      thickness -
      sizeDisplay -
      color1 -
      Returns:
    • squareImage

      public static processing.core.PImage squareImage(processing.core.PApplet app, float x, float y, int res, float thickness, float sizeDisplay)
      Parameters:
      app -
      x -
      y -
      res -
      thickness -
      sizeDisplay -
      Returns:
    • outline

      public static processing.core.PImage outline(processing.core.PApplet app, processing.core.PImage image, int[] color1)
      Parameters:
      app -
      image -
      color1 -
      Returns:
    • outline

      public static processing.core.PImage outline(processing.core.PApplet app, processing.core.PImage image)
      Parameters:
      app -
      image -
      Returns:
    • outlineThin

      public static processing.core.PImage outlineThin(processing.core.PApplet app, processing.core.PImage image, int[] color1)
      Parameters:
      app -
      image -
      color1 -
      Returns:
    • outlineThin

      public static processing.core.PImage outlineThin(processing.core.PApplet app, processing.core.PImage image)
      Parameters:
      app -
      image -
      Returns:
    • removeAll

      public static <T> ArrayList<T> removeAll(T val, ArrayList<T> arr)
      Type Parameters:
      T -
      Parameters:
      val -
      arr -
      Returns:
    • keyIsDown

      public static boolean keyIsDown(int key)
      Parameters:
      key -
      Returns:
    • setKey

      public static void setKey(int key, boolean state)
      Parameters:
      key -
      state -
    • pushBack

      public static <T> T[] pushBack(T[] a, T b)
      Type Parameters:
      T -
      Parameters:
      a -
      b -
      Returns:
    • pushBack

      public static int[] pushBack(int[] a, int b)
      Parameters:
      a -
      b -
      Returns:
    • notInArray

      public static boolean notInArray(ArrayList<Integer> a, int[] b)
      Parameters:
      a -
      b -
      Returns:
    • addNotInArray

      public static ArrayList<Integer> addNotInArray(ArrayList<Integer> a, int[] b)
      Parameters:
      a -
      b -
      Returns:
    • add

      public static ArrayList<Integer> add(ArrayList<Integer> a, int[] b)
      Parameters:
      a -
      b -
      Returns:
    • hash

      public static int hash(int x, int y)
      Parameters:
      x -
      y -
      Returns:
    • getNeighbors

      public static <E extends Entity> ArrayList<E> getNeighbors(E obj, HashMap<Integer,ArrayList<E>> h, int wid, int hgt, int size)
      Type Parameters:
      E -
      Parameters:
      obj -
      h -
      wid -
      hgt -
      size -
      Returns:
    • getNeighborsRender

      public static <E extends Entity> ArrayList<E> getNeighborsRender(E obj, HashMap<Integer,ArrayList<E>> h, int wid, int hgt, int size)
      Type Parameters:
      E -
      Parameters:
      obj -
      h -
      wid -
      hgt -
      size -
      Returns:
    • getApp

      public static processing.core.PApplet getApp()
      Returns:
    • getAppWidth

      public static int getAppWidth()
      Returns:
    • getAppHeight

      public static int getAppHeight()
      Returns:
    • getHasApp

      public static boolean getHasApp()
      Returns:
    • setApp

      public static boolean setApp(processing.core.PApplet app)
      Parameters:
      app -
      Returns:
    • pushApp

      public static boolean pushApp()
      Returns:
    • popApp

      public static boolean popApp()
      Returns:
    • fillApp

      public static boolean fillApp(int r, int g, int b)
      Parameters:
      r -
      g -
      b -
      Returns:
    • rectApp

      public static boolean rectApp(float x, float y, float w, float h)
      Parameters:
      x -
      y -
      w -
      h -
      Returns: