- All Implemented Interfaces:
IRenderable
The Button UI class for SypherEngine
- Since:
- 0.3.1
- Author:
- AurumByte
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescription(package private) javafx.scene.image.Image
Graphical buttons, one for regular, one for on hovering(package private) javafx.scene.image.Image
Graphical buttons, one for regular, one for on hovering(package private) Vector2
The position of the button(package private) Button.ButtonShape
The shape of button, whether round or rectangular(package private) String
The button textboolean
The hover and click events of a Buttonboolean
The hover and click events of a ButtonFields inherited from class dev.aurumbyte.sypherengine.ui.UIElement
color, defaultColor, defaultFont, defaultTextColour, font, radius, textColor
Fields inherited from class dev.aurumbyte.sypherengine.ecs.Entity
height, keyListener, mouseListener, rotation, width
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
Gets the button height (if it is rectangular)int
Gets the button width (if it is rectangular)javafx.scene.paint.Color
getColor()
Gets the color of the buttonint
Gets the radius of the button (if is it is round)float
getxPos()
Gets the x positionfloat
getyPos()
Gets the y positionvoid
render
(SypherEngine engine) The entity's render loopvoid
setButtonGraphics
(javafx.scene.image.Image buttonGraphics) Sets the graphics of the buttonvoid
setButtonGraphicsOnHover
(javafx.scene.image.Image buttonGraphicsOnHover) Sets the graphics of the button (triggered on hover event)void
setButtonText
(String text) Sets the button text (if it is rectangular)void
setColor
(javafx.scene.paint.Color color) Sets the color of the buttonvoid
setFont
(javafx.scene.text.Font font) Sets the font of the buttonvoid
setHeight
(int height) Sets the button height (if it is rectangular)void
setPosition
(int xPos, int yPos) Sets the position of the buttonvoid
setRadius
(int radius) Sets the radius of the button (if is it is round)void
setTextColor
(javafx.scene.paint.Color textColor) Sets the text color of the buttonvoid
setWidth
(int width) Sets the width of the button (if it is rectangular)void
setxPos
(int xPos) Sets the x position of the buttonvoid
setyPos
(int yPos) Sets the y position of the buttonvoid
update
(float deltaTime) The entity's update loopMethods inherited from class dev.aurumbyte.sypherengine.ecs.Entity
addComponent, addComponents, addComponents, collidesWith, getCenter, getComponents, getHeight, getPosition, getRotation, getScale, getTag, getWidth, isDead, rotate, setBoundary, setBoundary, setHeight, setIsDead, setPosition, setScale, setTag, setWidth, toString
-
Field Details
-
buttonText
String buttonTextThe button text -
buttonShape
Button.ButtonShape buttonShapeThe shape of button, whether round or rectangular -
buttonGraphics
javafx.scene.image.Image buttonGraphicsGraphical buttons, one for regular, one for on hovering -
buttonGraphicsOnHover
javafx.scene.image.Image buttonGraphicsOnHoverGraphical buttons, one for regular, one for on hovering -
buttonPos
Vector2 buttonPosThe position of the button -
hoverEvent
public boolean hoverEventThe hover and click events of a Button -
clickEvent
public boolean clickEventThe hover and click events of a Button
-
-
Constructor Details
-
Button
Create a new button (rectangular) with specified parameters
- Parameters:
text
- The button textposition
- The position of buttonwidth
- The width of buttonheight
- The height of the button- Since:
- 0.3.1
-
Button
Create a new button (round) with specified parameters
- Parameters:
text
- The button textposition
- The position of the buttonradius
- 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 interfaceIRenderable
- Specified by:
update
in classEntity
- Parameters:
deltaTime
- The deltaTime
-
render
Description copied from class:Entity
The entity's render loop
- Specified by:
render
in interfaceIRenderable
- Specified by:
render
in classEntity
- Parameters:
engine
- the main engine
-
setPosition
public void setPosition(int xPos, int yPos) Sets the position of the button
- Parameters:
xPos
- The x positionyPos
- 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
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
-