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 TypeMethodDescriptionvoid
add
(Interactable interactable) Adds an interactable component to the lookup map(package private) void
debug()
findNextDown
(Interactable interactable) Starting from a particularInteractable
and going down, which is the next interactable?findNextLeft
(Interactable interactable) Starting from a particularInteractable
and going left, which is the next interactable?private Interactable
findNextLeftOrRight
(Interactable interactable, boolean isRight) findNextRight
(Interactable interactable) Starting from a particularInteractable
and going right, which is the next interactable?findNextUp
(Interactable interactable) Starting from a particularInteractable
and going up, which is the next interactable?private Interactable
findNextUpOrDown
(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) TerminalSize
getSize()
(package private) void
reset()
-
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
Interactable
component at the specified location ornull
if there's nothing there
-
findNextUp
Starting from a particularInteractable
and going up, which is the next interactable?- Parameters:
interactable
- WhatInteractable
to start searching from- Returns:
- The next
Interactable
above the one specified ornull
if there are no moreInteractable
:s above it
-
findNextDown
Starting from a particularInteractable
and going down, which is the next interactable?- Parameters:
interactable
- WhatInteractable
to start searching from- Returns:
- The next
Interactable
below the one specified ornull
if there are no moreInteractable
:s below it
-
findNextUpOrDown
-
findNextLeft
Starting from a particularInteractable
and going left, which is the next interactable?- Parameters:
interactable
- WhatInteractable
to start searching from- Returns:
- The next
Interactable
left of the one specified ornull
if there are no moreInteractable
:s left of it
-
findNextRight
Starting from a particularInteractable
and going right, which is the next interactable?- Parameters:
interactable
- WhatInteractable
to start searching from- Returns:
- The next
Interactable
right of the one specified ornull
if there are no moreInteractable
:s right of it
-
findNextLeftOrRight
-
getDisqualifiedInteractables
private Set<Interactable> getDisqualifiedInteractables(TerminalPosition startPosition, boolean scanHorizontally) -
debug
void debug()
-