Package engine.guis

Class UiButton


public class UiButton extends UiComponent
Button component which extends UIComponent. Button is a 2d clickable object on screen for the user to interact with the game.
  • Constructor Details

    • UiButton

      public UiButton(int texture, org.joml.Vector2f position, org.joml.Vector2f scale, ButtonEnum buttonEnum)
      Constructor for the button.
      Parameters:
      texture - Texture ID of the button.
      position - Position on screen as a Vector2f - center point of the object.
      scale - Scale in X and Y from Centre point as Vector2f
      buttonEnum - Type of the button - used for distinction when the button is pressed.
  • Method Details

    • getButtonEnum

      public ButtonEnum getButtonEnum()
      Returns:
      Enum of the button type.
    • setEnabled

      public void setEnabled(boolean enabled)
      Parameters:
      enabled -
    • isEnabled

      public boolean isEnabled()
      Returns:
      if button is enabled
    • isClicked

      public boolean isClicked()
      Checks if the mouse is within the position of the button. If mouse is and method is called - returns true.
      Returns:
      boolean value