Class InteractableRectangle
- java.lang.Object
-
- java.awt.geom.RectangularShape
-
- java.awt.geom.Rectangle2D
-
- java.awt.Rectangle
-
- com.runemate.game.api.hybrid.local.hud.InteractableRectangle
-
- All Implemented Interfaces:
Interactable
,Renderable
,java.awt.Shape
,java.io.Serializable
,java.lang.Cloneable
public final class InteractableRectangle extends java.awt.Rectangle implements Interactable, Renderable
A java.awt.Rectangle wrapped to provide Interactable functionality, use of this class is discouraged.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description InteractableRectangle(int x, int y, int width, int height)
InteractableRectangle(java.awt.Rectangle rectangle)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
click()
Clicks this entity in an interactable pointInteractablePoint
getCenterPoint()
InteractablePoint
getInteractionPoint(java.awt.Point origin)
Gets a point within the entity that can be interacted with.double
getVisibility()
Returns a rough estimate of how visible this entity is as a percent (0 to 100)boolean
hasDynamicBounds()
boolean
interact(java.lang.String action)
boolean
interact(java.lang.String action, java.util.regex.Pattern target)
boolean
interact(java.util.regex.Pattern action)
boolean
interact(java.util.regex.Pattern action, java.lang.String target)
boolean
interact(java.util.regex.Pattern action, java.util.regex.Pattern target)
Attempts to match action and target using Matcher.find() and then interacts with the appropriate menu itemboolean
isVisible()
Whether the entity is visiblevoid
render(@NonNull java.awt.Graphics2D g2d)
Renders this entity onto the givenGraphics2D
, use is discouragedvoid
render(@NonNull javafx.scene.canvas.GraphicsContext gc)
Renders this entity onto the givenGraphicsContext
@NonNull java.lang.String
toString()
-
Methods inherited from class java.awt.Rectangle
add, add, add, contains, contains, contains, contains, createIntersection, createUnion, equals, getBounds, getBounds2D, getHeight, getLocation, getSize, getWidth, getX, getY, grow, inside, intersection, intersects, isEmpty, move, outcode, reshape, resize, setBounds, setBounds, setLocation, setLocation, setRect, setSize, setSize, translate, union
-
Methods inherited from class java.awt.geom.Rectangle2D
add, add, add, contains, contains, getPathIterator, getPathIterator, hashCode, intersect, intersects, intersectsLine, intersectsLine, outcode, setFrame, setRect, union
-
Methods inherited from class java.awt.geom.RectangularShape
clone, contains, contains, getCenterX, getCenterY, getFrame, getMaxX, getMaxY, getMinX, getMinY, intersects, setFrame, setFrame, setFrameFromCenter, setFrameFromCenter, setFrameFromDiagonal, setFrameFromDiagonal
-
Methods inherited from interface com.runemate.game.api.hybrid.entities.details.Interactable
contains, getInteractionPoint, hover, interact, isHovered
-
-
-
-
Method Detail
-
isVisible
public boolean isVisible()
Description copied from interface:Interactable
Whether the entity is visible- Specified by:
isVisible
in interfaceInteractable
- Returns:
- true if visible, and false if not visible
-
getVisibility
public double getVisibility()
Description copied from interface:Interactable
Returns a rough estimate of how visible this entity is as a percent (0 to 100)- Specified by:
getVisibility
in interfaceInteractable
-
hasDynamicBounds
public boolean hasDynamicBounds()
- Specified by:
hasDynamicBounds
in interfaceInteractable
-
getInteractionPoint
public InteractablePoint getInteractionPoint(java.awt.Point origin)
Description copied from interface:Interactable
Gets a point within the entity that can be interacted with. Takes into account the direction of movement from the origin point.- Specified by:
getInteractionPoint
in interfaceInteractable
-
getCenterPoint
public InteractablePoint getCenterPoint()
-
click
public boolean click()
Description copied from interface:Interactable
Clicks this entity in an interactable point- Specified by:
click
in interfaceInteractable
- Returns:
- true if successfully clicked
-
interact
public boolean interact(java.lang.String action)
- Specified by:
interact
in interfaceInteractable
-
interact
public boolean interact(java.util.regex.Pattern action)
- Specified by:
interact
in interfaceInteractable
-
interact
public boolean interact(java.util.regex.Pattern action, java.util.regex.Pattern target)
Description copied from interface:Interactable
Attempts to match action and target using Matcher.find() and then interacts with the appropriate menu item- Specified by:
interact
in interfaceInteractable
- Parameters:
action
- The pattern to match the action with, if null it's ignoredtarget
- The pattern to match the target with, if null it's ignored
-
interact
public boolean interact(java.util.regex.Pattern action, java.lang.String target)
- Specified by:
interact
in interfaceInteractable
-
interact
public boolean interact(java.lang.String action, java.util.regex.Pattern target)
- Specified by:
interact
in interfaceInteractable
-
toString
@NonNull public @NonNull java.lang.String toString()
- Overrides:
toString
in classjava.awt.Rectangle
-
render
public void render(@NonNull @NonNull java.awt.Graphics2D g2d)
Description copied from interface:Renderable
Renders this entity onto the givenGraphics2D
, use is discouraged- Specified by:
render
in interfaceRenderable
-
render
public void render(@NonNull @NonNull javafx.scene.canvas.GraphicsContext gc)
Description copied from interface:Renderable
Renders this entity onto the givenGraphicsContext
- Specified by:
render
in interfaceRenderable
-
-