Enum Class InsideRegion

java.lang.Object
java.lang.Enum<InsideRegion>
com.trevlar.menukit.api.panel.InsideRegion
All Implemented Interfaces:
Serializable, Comparable<InsideRegion>, Constable

public enum InsideRegion extends Enum<InsideRegion>
A region on a reference rectangle: one of nine spots, the four corners, the four edge midpoints, and the center, inset from the edge.

This names the vocabulary, not the reference. The reference is decided by the call site: a HUD panel is placed against the game window, and so is a standalone screen's chrome. One enum serves both. (Before 5.0.0 this was two identical enums, HudRegion and ScreenRegion.)

Every host resolves these spots through RegionMath.resolveInside(InsideRegion, int, int, int, int, int, RegionMath.Insets); what differs per context is only its RegionMath.Insets: the HUD sits RegionConstants.EDGE_INSET in and drops CENTER below the crosshair by RegionConstants.CENTER_CROSSHAIR_CLEARANCE, a vanilla screen uses the same inset without the crosshair, and a standalone screen's chrome sits RegionConstants.SCREEN_EDGE_MARGIN in and never hides for overflow.

Stacking order among siblings on one spot is the panel's PanelPosition.priority(int).

Its counterpart is OutsideRegion, the thirteen placements outside a rectangle. The two are shaped differently and do not merge.

  • Enum Constant Details

    • TOP_LEFT

      public static final InsideRegion TOP_LEFT
    • TOP_CENTER

      public static final InsideRegion TOP_CENTER
    • TOP_RIGHT

      public static final InsideRegion TOP_RIGHT
    • LEFT_CENTER

      public static final InsideRegion LEFT_CENTER
    • CENTER

      public static final InsideRegion CENTER
      Centered horizontally and vertically. Flows down (injection path).
    • RIGHT_CENTER

      public static final InsideRegion RIGHT_CENTER
    • BOTTOM_LEFT

      public static final InsideRegion BOTTOM_LEFT
    • BOTTOM_CENTER

      public static final InsideRegion BOTTOM_CENTER
    • BOTTOM_RIGHT

      public static final InsideRegion BOTTOM_RIGHT
  • Method Details

    • values

      public static InsideRegion[] 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 InsideRegion 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