Class ButtonManager

  • All Implemented Interfaces:
    com.badlogic.gdx.utils.Disposable

    public class ButtonManager
    extends java.lang.Object
    implements com.badlogic.gdx.utils.Disposable
    A utility which generates UI buttons with the correct background images given specific text, images and colours.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      com.badlogic.gdx.scenes.scene2d.ui.CheckBox createCheckbox​(java.lang.String text, ButtonManager.ButtonColour colour)
      Create a text button with certain parameters.
      com.badlogic.gdx.scenes.scene2d.ui.ImageButton createImageButton​(com.badlogic.gdx.scenes.scene2d.utils.Drawable image, ButtonManager.ButtonColour colour, float yPressedOffset)
      Create an image button with certain parameters.
      com.badlogic.gdx.scenes.scene2d.ui.TextButton createTextButton​(java.lang.String text, ButtonManager.ButtonColour colour)
      Create a text button with certain parameters.
      void dispose()
      Properly dispose of loaded textures from memory.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ButtonManager

        public ButtonManager​(FontManager fontManager)
        Parameters:
        fontManager - the fontManager from which this class can get the right fonts required.
    • Method Detail

      • createTextButton

        public com.badlogic.gdx.scenes.scene2d.ui.TextButton createTextButton​(java.lang.String text,
                                                                              ButtonManager.ButtonColour colour)
        Create a text button with certain parameters.
        Parameters:
        text - The string to display on the button.
        colour - The colour of the base button.
        Returns:
        The text button constructed based on the input.
      • createImageButton

        public com.badlogic.gdx.scenes.scene2d.ui.ImageButton createImageButton​(com.badlogic.gdx.scenes.scene2d.utils.Drawable image,
                                                                                ButtonManager.ButtonColour colour,
                                                                                float yPressedOffset)
        Create an image button with certain parameters.
        Parameters:
        image - The image to display on top of the button. It can have transparency.
        colour - The colour of the base button.
        yPressedOffset - The amount to move the top image when the button has been pressed.
        Returns:
        The image button constructed based on the input with a default of 0 padding.
      • createCheckbox

        public com.badlogic.gdx.scenes.scene2d.ui.CheckBox createCheckbox​(java.lang.String text,
                                                                          ButtonManager.ButtonColour colour)
        Create a text button with certain parameters.
        Parameters:
        text - The string to display on the button.
        colour - The colour of the base button.
        Returns:
        The text button constructed based on the input.
      • dispose

        public void dispose()
        Properly dispose of loaded textures from memory.
        Specified by:
        dispose in interface com.badlogic.gdx.utils.Disposable