Class InventoryNavigationComponent

java.lang.Object
com.csse3200.game.components.Component
com.csse3200.game.input.InputComponent
com.csse3200.game.components.inventory.InventoryNavigationComponent
All Implemented Interfaces:
com.badlogic.gdx.input.GestureDetector.GestureListener, com.badlogic.gdx.InputProcessor

public class InventoryNavigationComponent extends InputComponent
Input component for handling keyboard navigation within the inventory screen. Handles arrow key input to move selection around the inventory grid and manages all selection state and tooltip display.
  • Constructor Details

    • InventoryNavigationComponent

      public InventoryNavigationComponent(InventoryTab inventoryTab)
  • Method Details

    • enableNavigation

      public void enableNavigation()
      Enables navigation and shows initial tooltip
    • disableNavigation

      public void disableNavigation()
      Disables navigation and hides tooltip
    • getSelectedSlotIndex

      public int getSelectedSlotIndex()
      Gets the currently selected slot index (0-based, row-major order)
    • getSelectedRow

      public int getSelectedRow()
      Gets the current selection coordinates for the UI to highlight
    • getSelectedCol

      public int getSelectedCol()
    • isNavigationEnabled

      public boolean isNavigationEnabled()
    • keyDown

      public boolean keyDown(int keycode)
      Triggers player events on specific keycodes.
      Specified by:
      keyDown in interface com.badlogic.gdx.InputProcessor
      Overrides:
      keyDown in class InputComponent
      Parameters:
      keycode - key pressed
      Returns:
      whether the input was processed
      See Also:
    • setInventoryTab

      public void setInventoryTab(InventoryTab inventoryTab)
      Sets the inventory tab that this component controls