Enum Class MKHudAnchor

java.lang.Object
java.lang.Enum<MKHudAnchor>
com.trevlar.menukit.hud.MKHudAnchor
All Implemented Interfaces:
Serializable, Comparable<MKHudAnchor>, Constable

public enum MKHudAnchor extends Enum<MKHudAnchor>
Screen-edge anchor positions for HUD panels.

Legacy positioning enum. HudRegion is the intended primary HUD positioning system — it carries auto-stacking, priority(...), fail-loud overflow, and is shared by HUD panels + notifications + vanilla-screen panels through RegionMath.resolveHud. MKHudAnchor predates HudRegion and is retained as the raw-anchor fallback for MKHudPanel/MKHudNotification. Prefer HudRegion for new code; reach for MKHudAnchor only for the vertical-center positions (CENTER_LEFT/CENTER_RIGHT) or a one-off raw offset.

Each position anchors the panel to a screen edge or corner. Offsets move the panel inward from the anchor point: positive X = right, positive Y = down. For right/bottom anchors, use negative offsets to move inward (e.g., BOTTOM_RIGHT, -4, -24).

Part of the MenuKit framework.

  • Enum Constant Details

    • TOP_LEFT

      public static final MKHudAnchor TOP_LEFT
    • TOP_CENTER

      public static final MKHudAnchor TOP_CENTER
    • TOP_RIGHT

      public static final MKHudAnchor TOP_RIGHT
    • CENTER_LEFT

      public static final MKHudAnchor CENTER_LEFT
    • CENTER

      public static final MKHudAnchor CENTER
    • CENTER_RIGHT

      public static final MKHudAnchor CENTER_RIGHT
    • BOTTOM_LEFT

      public static final MKHudAnchor BOTTOM_LEFT
    • BOTTOM_CENTER

      public static final MKHudAnchor BOTTOM_CENTER
    • BOTTOM_RIGHT

      public static final MKHudAnchor BOTTOM_RIGHT
  • Method Details

    • values

      public static MKHudAnchor[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static MKHudAnchor valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • resolve

      public int[] resolve(int screenW, int screenH, int panelW, int panelH, int offsetX, int offsetY)
      Resolves this anchor + offset to absolute screen coordinates.
      Parameters:
      screenW - GUI-scaled screen width
      screenH - GUI-scaled screen height
      panelW - the panel's computed width
      panelH - the panel's computed height
      offsetX - X offset from anchor (positive = right)
      offsetY - Y offset from anchor (positive = down)
      Returns:
      int[]{x, y} absolute screen position