1
0
forked from Clones/Controlify

Custom button guide HUD scaling

This commit is contained in:
isXander
2023-06-21 19:07:02 +01:00
parent b370572dcc
commit 1e6db9d83b
6 changed files with 53 additions and 10 deletions

View File

@ -22,10 +22,10 @@ public class PositionedComponent<T extends RenderComponent> implements Renderabl
this.origin = origin;
}
public void updatePosition() {
public void updatePosition(int windowWidth, int windowHeight) {
Vector2ic componentSize = component.size();
Vector2ic windowPosition = windowAnchor.getAnchorPosition(Minecraft.getInstance().getWindow().getGuiScaledWidth(), Minecraft.getInstance().getWindow().getGuiScaledHeight());
Vector2ic windowPosition = windowAnchor.getAnchorPosition(windowWidth, windowHeight);
Vector2ic anchoredPosition = origin.getAnchorPosition(componentSize.x(), componentSize.y());
this.x = windowPosition.x() + offsetX - anchoredPosition.x();