Class DualDimension

java.lang.Object
dev.prozilla.pine.common.math.dimension.DualDimension
All Implemented Interfaces:
Cloneable<DualDimension>, Printable
Direct Known Subclasses:
QuadDimension

public class DualDimension extends Object implements Printable, Cloneable<DualDimension>
Represents a pair of dimensions (X and Y) for a UI element. Each dimension is defined using a DimensionBase.
See Also:
  • Field Details

  • Constructor Details

    • DualDimension

      public DualDimension()
      Creates a default pair of dimensions with all values set to 0 pixels.
    • DualDimension

      public DualDimension(String xy)
      Creates a pair of dimensions with two equal values based on a string.
    • DualDimension

      public DualDimension(int xy)
      Creates a pair of dimensions with two equal values, in pixels.
    • DualDimension

      public DualDimension(DimensionBase xy)
      Creates a pair of dimensions with two equal values.
    • DualDimension

      public DualDimension(String x, String y)
      Creates a pair of dimensions based on two strings.
    • DualDimension

      public DualDimension(int x, int y)
      Creates a pair of dimensions.
      Parameters:
      x - Value of x dimension, in pixels
      y - Value of y dimension, in pixels
    • DualDimension

      public DualDimension(DimensionBase x, DimensionBase y)
      Creates a pair of dimensions
  • Method Details

    • reset

      public void reset()
    • set

      public void set(String xy)
    • set

      public void set(int xy)
    • set

      public void set(DimensionBase xy)
    • set

      public void set(String x, String y)
    • set

      public void set(int x, int y)
    • set

      public void set(DimensionBase x, DimensionBase y)
    • computeX

      public int computeX(RectTransform element)
      Computes the X-dimension for a given element.
    • computeY

      public int computeY(RectTransform element)
      Computes the Y-dimension for a given element.
    • isZero

      public boolean isZero(RectTransform element)
      Checks whether this pair of dimensions computes to 0 for a given element.
    • clone

      public DualDimension clone()
      Description copied from interface: Cloneable
      Returns a new object that is equal to this object.
      Specified by:
      clone in interface Cloneable<DualDimension>
      Overrides:
      clone in class Object
      Returns:
      Clone of this object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • equals

      public boolean equals(DualDimension other)
      Description copied from interface: Cloneable
      Checks if the given object is equal to this object.
      Specified by:
      equals in interface Cloneable<DualDimension>
      Parameters:
      other - Other object
      Returns:
      true if both objects are equal.
    • parse

      public static DualDimension parse(String input)
    • zero

      public static DualDimension zero()
      Creates a pair of dimensions with all values set to 0.
    • fullscreen

      public static DualDimension fullscreen()
      Creates a pair of dimensions based on the viewport width and height.
    • parentSize

      public static DualDimension parentSize()
    • parentWidth

      public static DualDimension parentWidth()
    • parentHeight

      public static DualDimension parentHeight()
    • toString

      public String toString()
      Description copied from interface: Printable
      Returns a string representation of this object.
      Specified by:
      toString in interface Printable
      Overrides:
      toString in class Object
      Returns:
      String representation of this object.