Class Button


  • public class Button
    extends GameObject
    Class that represents a button in the 2d or 3d world
    Author:
    Darius Dinger
    • Constructor Detail

      • Button

        public Button​(GUIPane parent)
        Creating new Button and setting its parent or null, if no parent gui exist
        Parameters:
        parent - Parent gui or null
    • Method Detail

      • onUpdate

        public void onUpdate()
        Description copied from class: GameObject
        This method gets called every frame before the render method. Here is place for the GameObject logic updates, e.g. input handling, physics, actions, ...
        Overrides:
        onUpdate in class GameObject
      • getPane

        public GUIPane getPane()
        Returns:
        Gui pane of the button
      • onRender

        public void onRender()
        Description copied from class: GameObject
        In this method the GameObject gets rendered onto the screen (if it has an graphical representation). Its primary used for MasterRenderer calls.
        Overrides:
        onRender in class GameObject
      • isClicked

        public boolean isClicked()
        Returns:
        Is the button get clicked
      • isMouseEntered

        public boolean isMouseEntered()
        Returns:
        Is the mouse entered the button since the last update
      • isMouseLeaved

        public boolean isMouseLeaved()
        Returns:
        Is the mouse leaved the button since the last update
      • isPressed

        public boolean isPressed()
        Returns:
        Is the button getting pressed
      • isMouseOver

        public boolean isMouseOver()
      • setTexture

        public void setTexture​(String texture)
      • setListener

        public void setListener​(ButtonListener listener)
        Setting the listener to call at state changes or null, to call no listener
        Parameters:
        listener - New Listener
      • setOverTexture

        public void setOverTexture​(String overTexture)
        Setting texture to change to, at mouse entering button or Material.NO_TEXTURE_SET for no change.
        Parameters:
        overTexture - New mouse over texture
      • setPressedTexture

        public void setPressedTexture​(String pressedTexture)
        Setting texture to change to, at mouse pressing button or Material.NO_TEXTURE_SET for no change.
        Parameters:
        pressedTexture - New mouse pressed texture