Class MenuItem

java.lang.Object
rekit.logic.gui.GuiElement
rekit.logic.gui.menu.MenuItem
Direct Known Subclasses:
BoolSetting, MenuActionItem, SubMenu, TextItem

public abstract class MenuItem extends GuiElement
This class realizes an Item of a menu.
  • Field Details

    • selected

      protected boolean selected
      Indicates whether the item is selected.
    • parent

      protected MenuItem parent
      The parent of the Item or null if none exist.
  • Constructor Details

    • MenuItem

      protected MenuItem(IScene scene, String text)
      Create an Item.
      Parameters:
      scene - the scene
      text - the text (name)
    • MenuItem

      protected MenuItem(IScene scene, String text, Vec size)
      Create an Item.
      Parameters:
      scene - the scene
      text - the text
      size - the size
  • Method Details

    • getText

      protected String getText()
      Get the text of the item.
      Returns:
      the text
    • setHover

      public void setHover(boolean value)
      Set a hover (e.g. a mouseover)
      Parameters:
      value - the hover
    • select

      public void select()
      Select the Item.
    • unselect

      public void unselect()
      Deselect the Item.
    • up

      public void up()
      This method will be invoked to indicate an UP request.
    • down

      public void down()
      This method will be invoked to indicate an DOWN request.
    • left

      public void left()
      This method will be invoked to indicate an LEFT request.
    • right

      public void right()
      This method will be invoked to indicate an RIGHT request.
    • focus

      protected void focus()
      This method will be invoked to indicate an focus request.
    • setParent

      public void setParent(MenuItem i)
      Set the parent of the MenuItem.
      Parameters:
      i - the parent
    • internalRender

      protected void internalRender(GameGrid f)
      Description copied from class: GuiElement

      Template method that will be called periodically after being added to a IScene. Must be as performant as possible to keep the FPS low, since it will be called in every render-loop.

      Should be overwritten in sub classes for custom visualization using the GameGrid.

      Specified by:
      internalRender in class GuiElement
      Parameters:
      f - the GameGrid that represents the games field and supplies primitive drawing operations.
    • renderItem

      protected void renderItem(GameGrid f)
      Render the Item itself.
      Parameters:
      f - the field
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • isSelectable

      public boolean isSelectable()
      Indicates whether the item is selectable.
      Returns:
      true iff selectable, false otherwise
    • hasChildren

      public abstract boolean hasChildren()
      Indicates whether has children.
      Returns:
      true if children are available false otherwise