Class InteractableLookupMap
java.lang.Object
com.googlecode.lanterna.gui2.InteractableLookupMap
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 Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(Interactable interactable) Adds an interactable component to the lookup map(package private) voiddebug()findNextDown(Interactable interactable) Starting from a particularInteractableand going down, which is the next interactable?findNextLeft(Interactable interactable) Starting from a particularInteractableand going left, which is the next interactable?private InteractablefindNextLeftOrRight(Interactable interactable, boolean isRight) findNextRight(Interactable interactable) Starting from a particularInteractableand going right, which is the next interactable?findNextUp(Interactable interactable) Starting from a particularInteractableand going up, which is the next interactable?private InteractablefindNextUpOrDown(Interactable interactable, boolean isDown) private Set<Interactable> getDisqualifiedInteractables(TerminalPosition startPosition, boolean scanHorizontally) getInteractableAt(TerminalPosition position) Looks up what interactable component is as a particular location in the map(package private) TerminalSizegetSize()(package private) voidreset()
-
Field Details
-
lookupMap
private final int[][] lookupMap -
interactables
-
-
Constructor Details
-
InteractableLookupMap
InteractableLookupMap(TerminalSize size)
-
-
Method Details
-
reset
void reset() -
getSize
TerminalSize getSize() -
add
Adds an interactable component to the lookup map- Parameters:
interactable- Interactable to add to the lookup map
-
getInteractableAt
Looks up what interactable component is as a particular location in the map- Parameters:
position- Position to look up- Returns:
- The
Interactablecomponent at the specified location ornullif there's nothing there
-
findNextUp
Starting from a particularInteractableand going up, which is the next interactable?- Parameters:
interactable- WhatInteractableto start searching from- Returns:
- The next
Interactableabove the one specified ornullif there are no moreInteractable:s above it
-
findNextDown
Starting from a particularInteractableand going down, which is the next interactable?- Parameters:
interactable- WhatInteractableto start searching from- Returns:
- The next
Interactablebelow the one specified ornullif there are no moreInteractable:s below it
-
findNextUpOrDown
-
findNextLeft
Starting from a particularInteractableand going left, which is the next interactable?- Parameters:
interactable- WhatInteractableto start searching from- Returns:
- The next
Interactableleft of the one specified ornullif there are no moreInteractable:s left of it
-
findNextRight
Starting from a particularInteractableand going right, which is the next interactable?- Parameters:
interactable- WhatInteractableto start searching from- Returns:
- The next
Interactableright of the one specified ornullif there are no moreInteractable:s right of it
-
findNextLeftOrRight
-
getDisqualifiedInteractables
private Set<Interactable> getDisqualifiedInteractables(TerminalPosition startPosition, boolean scanHorizontally) -
debug
void debug()
-