Record Class GuiEnvironment

java.lang.Object
java.lang.Record
com.render.api.gui.GuiEnvironment
Record Components:
framebufferWidth - actual framebuffer width
framebufferHeight - actual framebuffer height
windowWidth - actual logical native-window width
windowHeight - actual logical native-window height
guiWidth - actual Minecraft GUI width
guiHeight - actual Minecraft GUI height
guiScale - actual Minecraft GUI scale
canvasPolicy - managed canvas policy
canvasWidth - logical design width
canvasHeight - logical design height
designScale - uniform design-to-GUI scale
offsetX - horizontal design origin in GUI coordinates
offsetY - vertical design origin in GUI coordinates

public record GuiEnvironment(int framebufferWidth, int framebufferHeight, int windowWidth, int windowHeight, int guiWidth, int guiHeight, double guiScale, GuiCanvasPolicy canvasPolicy, float canvasWidth, float canvasHeight, float designScale, float offsetX, float offsetY) extends Record
Immutable actual viewport and canvas mapping of an attached managed view.

Framebuffer dimensions describe physical pixels, window dimensions describe the native pointer surface, and GUI dimensions describe Minecraft input/render coordinates. Canvas dimensions and offsets describe RenderLib design coordinates. Keep these spaces distinct on dense displays and when Minecraft rounds GUI dimensions.

  • Constructor Details

    • GuiEnvironment

      public GuiEnvironment(int framebufferWidth, int framebufferHeight, int windowWidth, int windowHeight, int guiWidth, int guiHeight, double guiScale, GuiCanvasPolicy canvasPolicy, float canvasWidth, float canvasHeight, float designScale, float offsetX, float offsetY)
      Validates that this snapshot represents an attached, nonempty surface.
  • Method Details

    • toGuiX

      public double toGuiX(double designX)
      Parameters:
      designX - design X coordinate
      Returns:
      horizontal design point mapped into Minecraft GUI coordinates
    • toGuiY

      public double toGuiY(double designY)
      Parameters:
      designY - design Y coordinate
      Returns:
      vertical design point mapped into Minecraft GUI coordinates
    • toDesignX

      public double toDesignX(double guiX)
      Parameters:
      guiX - GUI X coordinate
      Returns:
      horizontal GUI point mapped into design coordinates
    • toDesignY

      public double toDesignY(double guiY)
      Parameters:
      guiY - GUI Y coordinate
      Returns:
      vertical GUI point mapped into design coordinates
    • deviceScaleX

      public double deviceScaleX()
      Returns:
      physical framebuffer pixels per horizontal design pixel
    • deviceScaleY

      public double deviceScaleY()
      Returns:
      physical framebuffer pixels per vertical design pixel
    • 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.
    • framebufferWidth

      public int framebufferWidth()
      Returns the value of the framebufferWidth record component.
      Returns:
      the value of the framebufferWidth record component
    • framebufferHeight

      public int framebufferHeight()
      Returns the value of the framebufferHeight record component.
      Returns:
      the value of the framebufferHeight record component
    • windowWidth

      public int windowWidth()
      Returns the value of the windowWidth record component.
      Returns:
      the value of the windowWidth record component
    • windowHeight

      public int windowHeight()
      Returns the value of the windowHeight record component.
      Returns:
      the value of the windowHeight record component
    • guiWidth

      public int guiWidth()
      Returns the value of the guiWidth record component.
      Returns:
      the value of the guiWidth record component
    • guiHeight

      public int guiHeight()
      Returns the value of the guiHeight record component.
      Returns:
      the value of the guiHeight record component
    • guiScale

      public double guiScale()
      Returns the value of the guiScale record component.
      Returns:
      the value of the guiScale record component
    • canvasPolicy

      public GuiCanvasPolicy canvasPolicy()
      Returns the value of the canvasPolicy record component.
      Returns:
      the value of the canvasPolicy record component
    • canvasWidth

      public float canvasWidth()
      Returns the value of the canvasWidth record component.
      Returns:
      the value of the canvasWidth record component
    • canvasHeight

      public float canvasHeight()
      Returns the value of the canvasHeight record component.
      Returns:
      the value of the canvasHeight record component
    • designScale

      public float designScale()
      Returns the value of the designScale record component.
      Returns:
      the value of the designScale record component
    • offsetX

      public float offsetX()
      Returns the value of the offsetX record component.
      Returns:
      the value of the offsetX record component
    • offsetY

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