Module technology.sola.engine
Record Class GuiElementBounds
java.lang.Object
java.lang.Record
technology.sola.engine.graphics.gui.GuiElementBounds
- Record Components:
x- the left most coordinatey- the top most coordinatewidth- the widthheight- the height
GuiElementBounds holds the information for the bounding box for part of
GuiElement.-
Constructor Summary
ConstructorsConstructorDescriptionGuiElementBounds(int x, int y, int width, int height) Creates an instance of aGuiElementBoundsrecord class. -
Method Summary
Modifier and TypeMethodDescriptionbooleancontains(float x, float y) Checks to see if a point is within bounds.booleancontains(int x, int y) Checks to see if a point is within bounds.booleancontains(MouseEvent mouseEvent) Checks to see if aMouseEventis within bounds.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.intheight()Returns the value of theheightrecord component.setDimensions(int width, int height) Creates a newGuiElementBoundsinstance with width and height set to the desired values.setPosition(int x, int y) Creates a newGuiElementBoundsinstance with position set to the desired x and y.final StringtoString()Returns a string representation of this record class.intwidth()Returns the value of thewidthrecord component.intx()Returns the value of thexrecord component.inty()Returns the value of theyrecord component.
-
Constructor Details
-
GuiElementBounds
public GuiElementBounds(int x, int y, int width, int height) Creates an instance of aGuiElementBoundsrecord class.
-
-
Method Details
-
setPosition
Creates a newGuiElementBoundsinstance with position set to the desired x and y. The width and height are kept the same.- Parameters:
x- the x of the new instancey- the y of the new instance- Returns:
- the new instance
-
setDimensions
Creates a newGuiElementBoundsinstance with width and height set to the desired values. The position values are kept the same.- Parameters:
width- the width of the new instanceheight- the height of the new instance- Returns:
- the new instance
-
contains
public boolean contains(int x, int y) Checks to see if a point is within bounds.- Parameters:
x- the x of the point to checky- the y of the point to check- Returns:
- true if the point is within the bounds
-
contains
public boolean contains(float x, float y) Checks to see if a point is within bounds.- Parameters:
x- the x of the point to checky- the y of the point to check- Returns:
- true if the point is within the bounds
-
contains
Checks to see if aMouseEventis within bounds.- Parameters:
mouseEvent- the mouse event- Returns:
- true if the mouse event is within the bounds
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with '=='. -
x
public int x()Returns the value of thexrecord component.- Returns:
- the value of the
xrecord component
-
y
public int y()Returns the value of theyrecord component.- Returns:
- the value of the
yrecord component
-
width
public int width()Returns the value of thewidthrecord component.- Returns:
- the value of the
widthrecord component
-
height
public int height()Returns the value of theheightrecord component.- Returns:
- the value of the
heightrecord component
-