Package rekit.logic.gui.menu
Class MenuItem
java.lang.Object
rekit.logic.gui.GuiElement
rekit.logic.gui.menu.MenuItem
- Direct Known Subclasses:
BoolSetting
,MenuActionItem
,SubMenu
,TextItem
This class realizes an Item of a menu.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected MenuItem
The parent of the Item ornull
if none exist.protected boolean
Indicates whether the item is selected.Fields inherited from class rekit.logic.gui.GuiElement
pos, scene, size, visible
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
down()
This method will be invoked to indicate an DOWN request.protected void
focus()
This method will be invoked to indicate an focus request.protected String
getText()
Get the text of the item.abstract boolean
Indicates whether has children.protected void
Template method that will be called periodically after being added to aIScene
.boolean
Indicates whether the item is selectable.void
left()
This method will be invoked to indicate an LEFT request.protected void
Render the Item itself.void
right()
This method will be invoked to indicate an RIGHT request.void
select()
Select the Item.void
setHover
(boolean value) Set a hover (e.g.void
Set the parent of the MenuItem.toString()
void
unselect()
Deselect the Item.void
up()
This method will be invoked to indicate an UP request.Methods inherited from class rekit.logic.gui.GuiElement
getPos, getScene, getSize, isVisible, logicLoop, render, setPos, setVisible
-
Field Details
-
selected
protected boolean selectedIndicates whether the item is selected. -
parent
The parent of the Item ornull
if none exist.
-
-
Constructor Details
-
MenuItem
Create an Item.- Parameters:
scene
- the scenetext
- the text (name)
-
MenuItem
Create an Item.- Parameters:
scene
- the scenetext
- the textsize
- the size
-
-
Method Details
-
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. -
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
.- Specified by:
internalRender
in classGuiElement
- Parameters:
f
- theGameGrid
that represents the games field and supplies primitive drawing operations.
-
renderItem
Render the Item itself.- Parameters:
f
- the field
-
toString
-
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 availablefalse
otherwise
-