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 MenuItemThe parent of the Item ornullif none exist.protected booleanIndicates whether the item is selected.Fields inherited from class rekit.logic.gui.GuiElement
pos, scene, size, visible -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddown()This method will be invoked to indicate an DOWN request.protected voidfocus()This method will be invoked to indicate an focus request.protected StringgetText()Get the text of the item.abstract booleanIndicates whether has children.protected voidTemplate method that will be called periodically after being added to aIScene.booleanIndicates whether the item is selectable.voidleft()This method will be invoked to indicate an LEFT request.protected voidRender the Item itself.voidright()This method will be invoked to indicate an RIGHT request.voidselect()Select the Item.voidsetHover(boolean value) Set a hover (e.g.voidSet the parent of the MenuItem.toString()voidunselect()Deselect the Item.voidup()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 ornullif 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: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.- Specified by:
internalRenderin classGuiElement- Parameters:
f- theGameGridthat 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:
trueiff selectable,falseotherwise
-
hasChildren
public abstract boolean hasChildren()Indicates whether has children.- Returns:
trueif children are availablefalseotherwise
-