Module SypherEngine

Class Button

All Implemented Interfaces:
IRenderable

public class Button extends UIElement

The Button UI class for SypherEngine

Since:
0.3.1
Author:
AurumByte
  • Field Details

    • buttonText

      String buttonText
      The button text
    • buttonShape

      Button.ButtonShape buttonShape
      The shape of button, whether round or rectangular
    • buttonGraphics

      javafx.scene.image.Image buttonGraphics
      Graphical buttons, one for regular, one for on hovering
    • buttonGraphicsOnHover

      javafx.scene.image.Image buttonGraphicsOnHover
      Graphical buttons, one for regular, one for on hovering
    • buttonPos

      Vector2 buttonPos
      The position of the button
    • hoverEvent

      public boolean hoverEvent
      The hover and click events of a Button
    • clickEvent

      public boolean clickEvent
      The hover and click events of a Button
  • Constructor Details

    • Button

      public Button(String text, Vector2 position, int width, int height)

      Create a new button (rectangular) with specified parameters

      Parameters:
      text - The button text
      position - The position of button
      width - The width of button
      height - The height of the button
      Since:
      0.3.1
    • Button

      public Button(String text, Vector2 position, int radius)

      Create a new button (round) with specified parameters

      Parameters:
      text - The button text
      position - The position of the button
      radius - The radius of the button
      Since:
      0.3.1
  • Method Details

    • update

      public void update(float deltaTime)
      Description copied from class: Entity

      The entity's update loop

      Specified by:
      update in interface IRenderable
      Specified by:
      update in class Entity
      Parameters:
      deltaTime - The deltaTime
    • render

      public void render(SypherEngine engine)
      Description copied from class: Entity

      The entity's render loop

      Specified by:
      render in interface IRenderable
      Specified by:
      render in class Entity
      Parameters:
      engine - the main engine
    • setPosition

      public void setPosition(int xPos, int yPos)

      Sets the position of the button

      Parameters:
      xPos - The x position
      yPos - The y position
      Since:
      0.3.1
    • getxPos

      public float getxPos()

      Gets the x position

      Since:
      0.3.1
    • getyPos

      public float getyPos()

      Gets the y position

      Since:
      0.3.1
    • getButtonWidth

      public int getButtonWidth()

      Gets the button width (if it is rectangular)

      Since:
      0.3.1
    • getButtonHeight

      public int getButtonHeight()

      Gets the button height (if it is rectangular)

      Since:
      0.3.1
    • getRadius

      public int getRadius()

      Gets the radius of the button (if is it is round)

      Since:
      0.3.1
    • getColor

      public javafx.scene.paint.Color getColor()

      Gets the color of the button

      Since:
      0.3.1
    • setWidth

      public void setWidth(int width)

      Sets the width of the button (if it is rectangular)

      Parameters:
      width - The width of the button
      Since:
      0.3.1
    • setHeight

      public void setHeight(int height)

      Sets the button height (if it is rectangular)

      Parameters:
      height - The height of the button
      Since:
      0.3.1
    • setButtonText

      public void setButtonText(String text)

      Sets the button text (if it is rectangular)

      Parameters:
      text - The text of the button
      Since:
      0.3.1
    • setxPos

      public void setxPos(int xPos)

      Sets the x position of the button

      Parameters:
      xPos - The x Position
      Since:
      0.3.1
    • setyPos

      public void setyPos(int yPos)

      Sets the y position of the button

      Parameters:
      yPos - The y Position
      Since:
      0.3.1
    • setColor

      public void setColor(javafx.scene.paint.Color color)

      Sets the color of the button

      Parameters:
      color - The color of the button
      Since:
      0.3.1
    • setTextColor

      public void setTextColor(javafx.scene.paint.Color textColor)

      Sets the text color of the button

      Parameters:
      textColor - The text Color
      Since:
      0.3.1
    • setRadius

      public void setRadius(int radius)

      Sets the radius of the button (if is it is round)

      Parameters:
      radius - The radius of the button
      Since:
      0.3.1
    • setFont

      public void setFont(javafx.scene.text.Font font)

      Sets the font of the button

      Parameters:
      font - The font of the button
      Since:
      0.3.1
    • setButtonGraphics

      public void setButtonGraphics(javafx.scene.image.Image buttonGraphics)

      Sets the graphics of the button

      Parameters:
      buttonGraphics - The graphics of the button
      Since:
      0.3.1
    • setButtonGraphicsOnHover

      public void setButtonGraphicsOnHover(javafx.scene.image.Image buttonGraphicsOnHover)

      Sets the graphics of the button (triggered on hover event)

      Parameters:
      buttonGraphicsOnHover - The graphics of the button (on hover)
      Since:
      0.3.1