Class Button
- java.lang.Object
-
- de.coreengine.system.GameObject
-
- de.coreengine.system.gameObjects.gui.Button
-
public class Button extends GameObject
Class that represents a button in the 2d or 3d world- Author:
- Darius Dinger
-
-
Field Summary
-
Fields inherited from class de.coreengine.system.GameObject
parent
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description GUIPane
getPane()
boolean
isClicked()
boolean
isMouseEntered()
boolean
isMouseLeaved()
boolean
isMouseOver()
boolean
isPressed()
void
onRender()
In this method the GameObject gets rendered onto the screen (if it has an graphical representation).void
onUpdate()
This method gets called every frame before the render method.void
setListener(ButtonListener listener)
Setting the listener to call at state changes or null, to call no listenervoid
setOverTexture(String overTexture)
Setting texture to change to, at mouse entering button or Material.NO_TEXTURE_SET for no change.void
setPressedTexture(String pressedTexture)
Setting texture to change to, at mouse pressing button or Material.NO_TEXTURE_SET for no change.void
setTexture(String texture)
-
Methods inherited from class de.coreengine.system.GameObject
addActionToPhysicWorld, addChild, addRigidBodyToWorld, getScene, onAdd, onInit, onLoad, onPauseUpdate, onRemove, onSave, onSyncronize, removeChild, setShouldRender, setShouldSyncronize, setShouldUpdate
-
-
-
-
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 classGameObject
-
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 classGameObject
-
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
-
-