Class ButtonGroupManager

java.lang.Object
com.shr4pnel.casino.util.ButtonGroupManager

public class ButtonGroupManager extends Object
Used to handle grouped, related buttons. Handles keyboard navigation, as well as button actions.
Since:
0.1.0
  • Constructor Summary

    Constructors
    Constructor
    Description
    ButtonGroupManager(com.badlogic.gdx.scenes.scene2d.ui.TextButton... t)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Fired when enter is pressed in a scene that uses a button
    com.badlogic.gdx.scenes.scene2d.ui.TextButton
     
    boolean
    Toggle the button to the left of the toggled button
    boolean
    Toggle the button to the right of the toggled button
    void
    setActiveButton(com.badlogic.gdx.scenes.scene2d.ui.TextButton activeButton)
    Set the button that is being hovered over
    void
    Assign a listener to the buttongroupmanager
    void
    setMenuButtonGroup(com.badlogic.gdx.scenes.scene2d.ui.TextButton... t)
    Set the internal button group to t

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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

      public void setListener(ButtonGroupListener listener)
      Assign a listener to the buttongroupmanager