Package rekit.logic.gui.menu
Class SubMenu
java.lang.Object
rekit.logic.gui.GuiElement
rekit.logic.gui.menu.MenuItem
rekit.logic.gui.menu.SubMenu
This class realizes a Menu displaying a list of MenuItems.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intThe current index.protected booleanThis bool indicates whether this Menu (false) or its Items (true) shall be rendered.protected VecThe size of the items.The contained Items.Fields inherited from class rekit.logic.gui.GuiElement
pos, scene, size, visible -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd an Item.protected abstract voidCalculate the new Position of each Item.final voiddown()This method will be invoked to indicate an DOWN request.protected voidfocus()This method will be invoked to indicate an focus request.booleanIndicates whether has children.protected voidTemplate method that will be called periodically after being added to aIScene.final voidleft()This method will be invoked to indicate an LEFT request.protected voidmenuDown()Process down while this menu is selected.protected voidmenuLeft()Process left while this menu is selected.protected voidProcess right while this menu is selected.protected voidmenuUp()Process up while this menu is selected.voidRemove an Item.protected voidRenders all items of this menu.final voidright()This method will be invoked to indicate an RIGHT request.voidselect()Select the Item.voidsetIndex(int index) Set the index (only when the menu is currently shown).voidsetItemSize(Vec value) Set the size of Items.voidunselect()Deselect the Item.final voidup()This method will be invoked to indicate an UP request.Methods inherited from class rekit.logic.gui.menu.MenuItem
getText, isSelectable, renderItem, setHover, setParent, toStringMethods inherited from class rekit.logic.gui.GuiElement
getPos, getScene, getSize, isVisible, logicLoop, render, setPos, setVisible
-
Field Details
-
inMenu
protected boolean inMenuThis bool indicates whether this Menu (false) or its Items (true) shall be rendered. -
index
protected int indexThe current index. -
itemSize
The size of the items.
-
-
Constructor Details
-
SubMenu
Create the submenu.- Parameters:
scene- the scenetext- the text (name)
-
-
Method Details
-
setIndex
public void setIndex(int index) Set the index (only when the menu is currently shown). On if the index is < 0 or ≥ length it will be set to 0 or length-1- Parameters:
index- the new index.
-
setItemSize
Set the size of Items.- Parameters:
value- the new size
-
up
public final void up()Description copied from class:MenuItemThis method will be invoked to indicate an UP request. -
down
public final void down()Description copied from class:MenuItemThis method will be invoked to indicate an DOWN request. -
left
public final void left()Description copied from class:MenuItemThis method will be invoked to indicate an LEFT request. -
right
public final void right()Description copied from class:MenuItemThis method will be invoked to indicate an RIGHT request. -
select
public void select()Description copied from class:MenuItemSelect the Item. -
unselect
public void unselect()Description copied from class:MenuItemDeselect the Item. -
focus
protected void focus()Description copied from class:MenuItemThis method will be invoked to indicate an focus request. -
internalRender
Description copied from class:GuiElementTemplate 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.- Overrides:
internalRenderin classMenuItem- Parameters:
f- theGameGridthat represents the games field and supplies primitive drawing operations.
-
renderMenu
Renders all items of this menu. Called when this menu is selected (displaying its children).- Parameters:
f- the field for rendering
-
calcItemPos
protected abstract void calcItemPos()Calculate the new Position of each Item. -
hasChildren
public boolean hasChildren()Description copied from class:MenuItemIndicates whether has children.- Specified by:
hasChildrenin classMenuItem- Returns:
trueif children are availablefalseotherwise