Package com.shr4pnel.casino.util
Class ButtonGroupManager
java.lang.Object
com.shr4pnel.casino.util.ButtonGroupManager
Used to handle grouped, related buttons. Handles keyboard navigation, as well as button actions.
- Since:
- 0.1.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanenter()Fired when enter is pressed in a scene that uses a buttoncom.badlogic.gdx.scenes.scene2d.ui.TextButtonbooleanleft()Toggle the button to the left of the toggled buttonbooleanright()Toggle the button to the right of the toggled buttonvoidsetActiveButton(com.badlogic.gdx.scenes.scene2d.ui.TextButton activeButton) Set the button that is being hovered overvoidsetListener(ButtonGroupListener listener) Assign a listener to the buttongroupmanagervoidsetMenuButtonGroup(com.badlogic.gdx.scenes.scene2d.ui.TextButton... t) Set the internal button group to t
-
Constructor Details
-
ButtonGroupManager
public ButtonGroupManager(com.badlogic.gdx.scenes.scene2d.ui.TextButton... t)
-
-
Method Details
-
setMenuButtonGroup
public void setMenuButtonGroup(com.badlogic.gdx.scenes.scene2d.ui.TextButton... t) Set the internal button group to t- Parameters:
t- A variable amount of textbuttons
-
getActiveButton
public com.badlogic.gdx.scenes.scene2d.ui.TextButton getActiveButton()- Returns:
- The button that is being hovered over
-
setActiveButton
public void setActiveButton(com.badlogic.gdx.scenes.scene2d.ui.TextButton activeButton) Set the button that is being hovered over- Parameters:
activeButton- The button to be hovered over
-
left
public boolean left()Toggle the button to the left of the toggled button- Returns:
- True, to mark a successful left shift
- See Also:
-
right
public boolean right()Toggle the button to the right of the toggled button- Returns:
- True, to mark a successful right shift
- See Also:
-
enter
public boolean enter()Fired when enter is pressed in a scene that uses a button- Returns:
- true/false depending on if action goes to default in switch case
- See Also:
-
setListener
Assign a listener to the buttongroupmanager
-