- All Implemented Interfaces:
- IRenderable
The Button UI class for SypherEngine
- Since:
- 0.3.1
- Author:
- AurumByte
- 
Nested Class SummaryNested Classes
- 
Field SummaryFieldsModifier 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.UIElementcolor, defaultColor, defaultFont, defaultTextColour, font, radius, textColorFields inherited from class dev.aurumbyte.sypherengine.ecs.Entityheight, keyListener, mouseListener, rotation, width
- 
Constructor SummaryConstructors
- 
Method SummaryModifier 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.EntityaddComponent, addComponents, addComponents, collidesWith, getCenter, getComponents, getHeight, getPosition, getRotation, getScale, getTag, getWidth, isDead, rotate, setBoundary, setBoundary, setHeight, setIsDead, setPosition, setScale, setTag, setWidth, toString
- 
Field Details- 
buttonTextString buttonTextThe button text
- 
buttonShapeButton.ButtonShape buttonShapeThe shape of button, whether round or rectangular
- 
buttonGraphicsjavafx.scene.image.Image buttonGraphicsGraphical buttons, one for regular, one for on hovering
- 
buttonGraphicsOnHoverjavafx.scene.image.Image buttonGraphicsOnHoverGraphical buttons, one for regular, one for on hovering
- 
buttonPosVector2 buttonPosThe position of the button
- 
hoverEventpublic boolean hoverEventThe hover and click events of a Button
- 
clickEventpublic boolean clickEventThe hover and click events of a Button
 
- 
- 
Constructor Details- 
ButtonCreate 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
 
- 
ButtonCreate 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- 
updatepublic void update(float deltaTime) Description copied from class:EntityThe entity's update loop - Specified by:
- updatein interface- IRenderable
- Specified by:
- updatein class- Entity
- Parameters:
- deltaTime- The deltaTime
 
- 
renderDescription copied from class:EntityThe entity's render loop - Specified by:
- renderin interface- IRenderable
- Specified by:
- renderin class- Entity
- Parameters:
- engine- the main engine
 
- 
setPositionpublic 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
 
- 
getxPospublic float getxPos()Gets the x position - Since:
- 0.3.1
 
- 
getyPospublic float getyPos()Gets the y position - Since:
- 0.3.1
 
- 
getButtonWidthpublic int getButtonWidth()Gets the button width (if it is rectangular) - Since:
- 0.3.1
 
- 
getButtonHeightpublic int getButtonHeight()Gets the button height (if it is rectangular) - Since:
- 0.3.1
 
- 
getRadiuspublic int getRadius()Gets the radius of the button (if is it is round) - Since:
- 0.3.1
 
- 
getColorpublic javafx.scene.paint.Color getColor()Gets the color of the button - Since:
- 0.3.1
 
- 
setWidthpublic 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
 
- 
setHeightpublic void setHeight(int height) Sets the button height (if it is rectangular) - Parameters:
- height- The height of the button
- Since:
- 0.3.1
 
- 
setButtonTextSets the button text (if it is rectangular) - Parameters:
- text- The text of the button
- Since:
- 0.3.1
 
- 
setxPospublic void setxPos(int xPos) Sets the x position of the button - Parameters:
- xPos- The x Position
- Since:
- 0.3.1
 
- 
setyPospublic void setyPos(int yPos) Sets the y position of the button - Parameters:
- yPos- The y Position
- Since:
- 0.3.1
 
- 
setColorpublic void setColor(javafx.scene.paint.Color color) Sets the color of the button - Parameters:
- color- The color of the button
- Since:
- 0.3.1
 
- 
setTextColorpublic void setTextColor(javafx.scene.paint.Color textColor) Sets the text color of the button - Parameters:
- textColor- The text Color
- Since:
- 0.3.1
 
- 
setRadiuspublic 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
 
- 
setFontpublic void setFont(javafx.scene.text.Font font) Sets the font of the button - Parameters:
- font- The font of the button
- Since:
- 0.3.1
 
- 
setButtonGraphicspublic void setButtonGraphics(javafx.scene.image.Image buttonGraphics) Sets the graphics of the button - Parameters:
- buttonGraphics- The graphics of the button
- Since:
- 0.3.1
 
- 
setButtonGraphicsOnHoverpublic 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
 
 
-