- All Implemented Interfaces:
IRenderable
The Button UI class for SypherEngine
- Since:
- 0.3.1
- Author:
- AurumByte
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescription(package private) javafx.scene.image.ImageGraphical buttons, one for regular, one for on hovering(package private) javafx.scene.image.ImageGraphical buttons, one for regular, one for on hovering(package private) Vector2The position of the button(package private) Button.ButtonShapeThe shape of button, whether round or rectangular(package private) StringThe button textbooleanThe hover and click events of a ButtonbooleanThe hover and click events of a ButtonFields inherited from class dev.aurumbyte.sypherengine.ui.UIElement
color, defaultColor, defaultFont, defaultTextColour, font, radius, textColorFields inherited from class dev.aurumbyte.sypherengine.ecs.Entity
height, keyListener, mouseListener, rotation, width -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintGets the button height (if it is rectangular)intGets the button width (if it is rectangular)javafx.scene.paint.ColorgetColor()Gets the color of the buttonintGets the radius of the button (if is it is round)floatgetxPos()Gets the x positionfloatgetyPos()Gets the y positionvoidrender(SypherEngine engine) The entity's render loopvoidsetButtonGraphics(javafx.scene.image.Image buttonGraphics) Sets the graphics of the buttonvoidsetButtonGraphicsOnHover(javafx.scene.image.Image buttonGraphicsOnHover) Sets the graphics of the button (triggered on hover event)voidsetButtonText(String text) Sets the button text (if it is rectangular)voidsetColor(javafx.scene.paint.Color color) Sets the color of the buttonvoidsetFont(javafx.scene.text.Font font) Sets the font of the buttonvoidsetHeight(int height) Sets the button height (if it is rectangular)voidsetPosition(int xPos, int yPos) Sets the position of the buttonvoidsetRadius(int radius) Sets the radius of the button (if is it is round)voidsetTextColor(javafx.scene.paint.Color textColor) Sets the text color of the buttonvoidsetWidth(int width) Sets the width of the button (if it is rectangular)voidsetxPos(int xPos) Sets the x position of the buttonvoidsetyPos(int yPos) Sets the y position of the buttonvoidupdate(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:EntityThe entity's update loop
- Specified by:
updatein interfaceIRenderable- Specified by:
updatein classEntity- Parameters:
deltaTime- The deltaTime
-
render
Description copied from class:EntityThe entity's render loop
- Specified by:
renderin interfaceIRenderable- Specified by:
renderin 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
-