Record Class GuiEnvironment
java.lang.Object
java.lang.Record
com.render.api.gui.GuiEnvironment
- Record Components:
framebufferWidth- actual framebuffer widthframebufferHeight- actual framebuffer heightwindowWidth- actual logical native-window widthwindowHeight- actual logical native-window heightguiWidth- actual Minecraft GUI widthguiHeight- actual Minecraft GUI heightguiScale- actual Minecraft GUI scalecanvasPolicy- managed canvas policycanvasWidth- logical design widthcanvasHeight- logical design heightdesignScale- uniform design-to-GUI scaleoffsetX- horizontal design origin in GUI coordinatesoffsetY- 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 Summary
ConstructorsConstructorDescriptionGuiEnvironment(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 Summary
Modifier and TypeMethodDescriptionfloatReturns the value of thecanvasHeightrecord component.Returns the value of thecanvasPolicyrecord component.floatReturns the value of thecanvasWidthrecord component.floatReturns the value of thedesignScalerecord component.doubledoublefinal booleanIndicates whether some other object is "equal to" this one.intReturns the value of theframebufferHeightrecord component.intReturns the value of theframebufferWidthrecord component.intReturns the value of theguiHeightrecord component.doubleguiScale()Returns the value of theguiScalerecord component.intguiWidth()Returns the value of theguiWidthrecord component.final inthashCode()Returns a hash code value for this object.floatoffsetX()Returns the value of theoffsetXrecord component.floatoffsetY()Returns the value of theoffsetYrecord component.doubletoDesignX(double guiX) doubletoDesignY(double guiY) doubletoGuiX(double designX) doubletoGuiY(double designY) final StringtoString()Returns a string representation of this record class.intReturns the value of thewindowHeightrecord component.intReturns the value of thewindowWidthrecord component.
-
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
-
hashCode
-
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
framebufferWidth
public int framebufferWidth()Returns the value of theframebufferWidthrecord component.- Returns:
- the value of the
framebufferWidthrecord component
-
framebufferHeight
public int framebufferHeight()Returns the value of theframebufferHeightrecord component.- Returns:
- the value of the
framebufferHeightrecord component
-
windowWidth
public int windowWidth()Returns the value of thewindowWidthrecord component.- Returns:
- the value of the
windowWidthrecord component
-
windowHeight
public int windowHeight()Returns the value of thewindowHeightrecord component.- Returns:
- the value of the
windowHeightrecord component
-
guiWidth
-
guiHeight
-
guiScale
-
canvasPolicy
Returns the value of thecanvasPolicyrecord component.- Returns:
- the value of the
canvasPolicyrecord component
-
canvasWidth
public float canvasWidth()Returns the value of thecanvasWidthrecord component.- Returns:
- the value of the
canvasWidthrecord component
-
canvasHeight
public float canvasHeight()Returns the value of thecanvasHeightrecord component.- Returns:
- the value of the
canvasHeightrecord component
-
designScale
public float designScale()Returns the value of thedesignScalerecord component.- Returns:
- the value of the
designScalerecord component
-
offsetX
-
offsetY
-