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 int
The current index.protected boolean
This bool indicates whether this Menu (false) or its Items (true) shall be rendered.protected Vec
The 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 TypeMethodDescriptionvoid
Add an Item.protected abstract void
Calculate the new Position of each Item.final void
down()
This method will be invoked to indicate an DOWN request.protected void
focus()
This method will be invoked to indicate an focus request.boolean
Indicates whether has children.protected void
Template method that will be called periodically after being added to aIScene
.final void
left()
This method will be invoked to indicate an LEFT request.protected void
menuDown()
Process down while this menu is selected.protected void
menuLeft()
Process left while this menu is selected.protected void
Process right while this menu is selected.protected void
menuUp()
Process up while this menu is selected.void
Remove an Item.protected void
Renders all items of this menu.final void
right()
This method will be invoked to indicate an RIGHT request.void
select()
Select the Item.void
setIndex
(int index) Set the index (only when the menu is currently shown).void
setItemSize
(Vec value) Set the size of Items.void
unselect()
Deselect the Item.final void
up()
This method will be invoked to indicate an UP request.Methods inherited from class rekit.logic.gui.menu.MenuItem
getText, isSelectable, renderItem, setHover, setParent, toString
Methods 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:MenuItem
This method will be invoked to indicate an UP request. -
down
public final void down()Description copied from class:MenuItem
This method will be invoked to indicate an DOWN request. -
left
public final void left()Description copied from class:MenuItem
This method will be invoked to indicate an LEFT request. -
right
public final void right()Description copied from class:MenuItem
This method will be invoked to indicate an RIGHT request. -
select
public void select()Description copied from class:MenuItem
Select the Item. -
unselect
public void unselect()Description copied from class:MenuItem
Deselect the Item. -
focus
protected void focus()Description copied from class:MenuItem
This method will be invoked to indicate an focus request. -
internalRender
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
.- Overrides:
internalRender
in classMenuItem
- Parameters:
f
- theGameGrid
that 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:MenuItem
Indicates whether has children.- Specified by:
hasChildren
in classMenuItem
- Returns:
true
if children are availablefalse
otherwise