Class DualDimension
java.lang.Object
dev.prozilla.pine.common.math.dimension.DualDimension
- All Implemented Interfaces:
Cloneable<DualDimension>
,Printable
- Direct Known Subclasses:
QuadDimension
Represents a pair of dimensions (X and Y) for a UI element. Each dimension is defined using a
DimensionBase
.- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCreates a default pair of dimensions with all values set to 0 pixels.DualDimension
(int xy) Creates a pair of dimensions with two equal values, in pixels.DualDimension
(int x, int y) Creates a pair of dimensions.Creates a pair of dimensions with two equal values.Creates a pair of dimensionsDualDimension
(String xy) Creates a pair of dimensions with two equal values based on a string.DualDimension
(String x, String y) Creates a pair of dimensions based on two strings. -
Method Summary
Modifier and TypeMethodDescriptionclone()
Returns a new object that is equal to this object.int
computeX
(RectTransform element) Computes the X-dimension for a given element.int
computeY
(RectTransform element) Computes the Y-dimension for a given element.boolean
equals
(DualDimension other) Checks if the given object is equal to this object.boolean
static DualDimension
Creates a pair of dimensions based on the viewport width and height.boolean
isZero
(RectTransform element) Checks whether this pair of dimensions computes to0
for a given element.static DualDimension
static DualDimension
static DualDimension
static DualDimension
void
reset()
void
set
(int xy) void
set
(int x, int y) void
set
(DimensionBase xy) void
set
(DimensionBase x, DimensionBase y) void
void
toString()
Returns a string representation of this object.static DualDimension
zero()
Creates a pair of dimensions with all values set to0
.
-
Field Details
-
x
-
y
-
DEFAULT_VALUE
public static final int DEFAULT_VALUE- See Also:
-
-
Constructor Details
-
DualDimension
public DualDimension()Creates a default pair of dimensions with all values set to 0 pixels. -
DualDimension
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
Creates a pair of dimensions with two equal values. -
DualDimension
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 pixelsy
- Value of y dimension, in pixels
-
DualDimension
Creates a pair of dimensions
-
-
Method Details
-
reset
public void reset() -
set
-
set
public void set(int xy) -
set
-
set
-
set
public void set(int x, int y) -
set
-
computeX
Computes the X-dimension for a given element. -
computeY
Computes the Y-dimension for a given element. -
isZero
Checks whether this pair of dimensions computes to0
for a given element. -
clone
Description copied from interface:Cloneable
Returns a new object that is equal to this object.- Specified by:
clone
in interfaceCloneable<DualDimension>
- Overrides:
clone
in classObject
- Returns:
- Clone of this object
-
equals
-
equals
Description copied from interface:Cloneable
Checks if the given object is equal to this object.- Specified by:
equals
in interfaceCloneable<DualDimension>
- Parameters:
other
- Other object- Returns:
true
if both objects are equal.
-
parse
-
zero
Creates a pair of dimensions with all values set to0
. -
fullscreen
Creates a pair of dimensions based on the viewport width and height. -
parentSize
-
parentWidth
-
parentHeight
-
toString
Description copied from interface:Printable
Returns a string representation of this object.
-