Record Class GuiSoftwareCursor

java.lang.Object
java.lang.Record
com.render.api.gui.paint.GuiSoftwareCursor
Record Components:
image - cursor image
width - painted width
height - painted height
hotspotX - horizontal hotspot measured from the painted left edge
hotspotY - vertical hotspot measured from the painted top edge

public record GuiSoftwareCursor(GuiImage image, float width, float height, float hotspotX, float hotspotY) extends Record
Immutable software cursor painted above a managed GuiView.

The image may be any reusable GuiImage, including gradients, retained SVG, mesh gradients, and paint worklets. Size and hotspot are in RenderLib design-space pixels. The native cursor remains visible while an asynchronous raster or SVG image is still loading.

  • Constructor Details

    • GuiSoftwareCursor

      public GuiSoftwareCursor(GuiImage image, float width, float height, float hotspotX, float hotspotY)
      Creates an instance of a GuiSoftwareCursor record class.
      Parameters:
      image - the value for the image record component
      width - the value for the width record component
      height - the value for the height record component
      hotspotX - the value for the hotspotX record component
      hotspotY - the value for the hotspotY record component
  • Method Details

    • of

      public static GuiSoftwareCursor of(GuiImage image, float width, float height)
      Creates a cursor whose hotspot is its upper-left corner.
      Parameters:
      image - cursor image
      width - painted width
      height - painted height
      Returns:
      cursor definition
    • centered

      public static GuiSoftwareCursor centered(GuiImage image, float width, float height)
      Creates a cursor whose hotspot is centered.
      Parameters:
      image - cursor image
      width - painted width
      height - painted height
      Returns:
      cursor definition
    • withHotspot

      public GuiSoftwareCursor withHotspot(float x, float y)
      Returns a copy with a new hotspot.
      Parameters:
      x - horizontal hotspot
      y - vertical hotspot
      Returns:
      updated cursor
    • toString

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • image

      public GuiImage image()
      Returns the value of the image record component.
      Returns:
      the value of the image record component
    • width

      public float width()
      Returns the value of the width record component.
      Returns:
      the value of the width record component
    • height

      public float height()
      Returns the value of the height record component.
      Returns:
      the value of the height record component
    • hotspotX

      public float hotspotX()
      Returns the value of the hotspotX record component.
      Returns:
      the value of the hotspotX record component
    • hotspotY

      public float hotspotY()
      Returns the value of the hotspotY record component.
      Returns:
      the value of the hotspotY record component