Class InteractableLookupMap


  • public class InteractableLookupMap
    extends java.lang.Object
    This class is used to keep a 'map' of the usable area and note where all the interact:ables are. It can then be used to find the next interactable in any direction. It is used inside the GUI system to drive arrow key navigation.
    • Field Detail

      • lookupMap

        private final int[][] lookupMap
      • interactables

        private final java.util.List<Interactable> interactables
    • Constructor Detail

      • InteractableLookupMap

        InteractableLookupMap​(TerminalSize size)
    • Method Detail

      • reset

        void reset()
      • add

        public void add​(Interactable interactable)
        Adds an interactable component to the lookup map
        Parameters:
        interactable - Interactable to add to the lookup map
      • getInteractableAt

        public Interactable getInteractableAt​(TerminalPosition position)
        Looks up what interactable component is as a particular location in the map
        Parameters:
        position - Position to look up
        Returns:
        The Interactable component at the specified location or null if there's nothing there
      • findNextUp

        public Interactable findNextUp​(Interactable interactable)
        Starting from a particular Interactable and going up, which is the next interactable?
        Parameters:
        interactable - What Interactable to start searching from
        Returns:
        The next Interactable above the one specified or null if there are no more Interactable:s above it
      • findNextDown

        public Interactable findNextDown​(Interactable interactable)
        Starting from a particular Interactable and going down, which is the next interactable?
        Parameters:
        interactable - What Interactable to start searching from
        Returns:
        The next Interactable below the one specified or null if there are no more Interactable:s below it
      • findNextLeft

        public Interactable findNextLeft​(Interactable interactable)
        Starting from a particular Interactable and going left, which is the next interactable?
        Parameters:
        interactable - What Interactable to start searching from
        Returns:
        The next Interactable left of the one specified or null if there are no more Interactable:s left of it
      • findNextRight

        public Interactable findNextRight​(Interactable interactable)
        Starting from a particular Interactable and going right, which is the next interactable?
        Parameters:
        interactable - What Interactable to start searching from
        Returns:
        The next Interactable right of the one specified or null if there are no more Interactable:s right of it
      • getDisqualifiedInteractables

        private java.util.Set<Interactable> getDisqualifiedInteractables​(TerminalPosition startPosition,
                                                                         boolean scanHorizontally)
      • debug

        void debug()