public class Switch extends Panel
| Modifier and Type | Class and Description |
|---|---|
protected class |
Switch.InputHandler |
protected static class |
Switch.LogicalState |
static class |
Switch.SwitchState |
static class |
Switch.SwitchStyle |
| Modifier and Type | Field and Description |
|---|---|
protected Modifier |
animationModifier
Modifier used to interpolate switch movement.
|
protected float |
borderValue
Height of the top/bottom border
|
protected float |
borderValueLeft
Left border for the
switchSprite. |
protected float |
borderValueRight
Right border for the
switchSprite. |
protected Switch.LogicalState |
inputState
State of the touch gesture.
|
protected Switch.SwitchState |
state
State of the switch
Switch.SwitchState. |
protected com.badlogic.gdx.scenes.scene2d.ui.Image |
stateRect
For displaying a bar.
|
protected com.badlogic.gdx.scenes.scene2d.ui.Image |
switchSprite
Moveable part of the switch.
|
| Constructor and Description |
|---|
Switch(com.badlogic.gdx.scenes.scene2d.utils.Drawable background,
com.badlogic.gdx.scenes.scene2d.utils.Drawable button,
com.badlogic.gdx.scenes.scene2d.utils.Drawable whitePixel,
com.badlogic.gdx.graphics.Color state)
Crreates a switch.
|
Switch(com.badlogic.gdx.scenes.scene2d.ui.Skin skin,
com.badlogic.gdx.scenes.scene2d.utils.Drawable background) |
Switch(Switch.SwitchStyle style,
com.badlogic.gdx.scenes.scene2d.utils.Drawable background) |
| Modifier and Type | Method and Description |
|---|---|
void |
act(float secondsElapsed) |
boolean |
isOn()
Returns true if the current state is
SwitchState.ON. |
protected void |
setBorderValueLeft(float borderValueLeft)
Setter for
borderValueLeft. |
protected void |
setBorderValueRight(float borderValueRight)
Setter for
borderValueRight. |
void |
setHeight(float height) |
void |
setWidth(float width) |
protected void |
switchState()
Switches the state, depending on the current state.
|
void |
switchToState(boolean state)
Switches to the given state.
|
void |
switchToState(Switch.SwitchState switchState)
Switches to the given state.
|
void |
updateBackground(com.badlogic.gdx.scenes.scene2d.utils.Drawable background)
Convenience method to apply a new background.
|
void |
updateButton(com.badlogic.gdx.scenes.scene2d.utils.Drawable button)
Convenience method to apply a new button image.
|
void |
updatePixel(com.badlogic.gdx.scenes.scene2d.utils.Drawable whitePixel)
Convenience method to apply a new image.
|
draw, setAlpha, setBackground, setXPadding, setYPaddingchildrenChanged, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getPrefHeight, getPrefWidth, invalidate, invalidateHierarchy, layout, needsLayout, pack, setFillParent, setLayoutEnabled, sizeChanged, validateaddActor, addActorAfter, addActorAt, addActorBefore, applyTransform, applyTransform, clear, clearChildren, computeTransform, debugAll, drawChildren, drawDebug, drawDebugChildren, findActor, getChildren, getCullingArea, hasChildren, hit, isTransform, localToDescendantCoordinates, removeActor, removeActor, resetTransform, resetTransform, setCullingArea, setDebug, setStage, setTransform, swapActor, swapActor, toStringaddAction, addCaptureListener, addListener, clearActions, clearListeners, clipBegin, clipBegin, clipEnd, debug, drawDebugBounds, fire, firstAscendant, getActions, getCaptureListeners, getColor, getDebug, getHeight, getListeners, getName, getOriginX, getOriginY, getParent, getRight, getRotation, getScaleX, getScaleY, getStage, getTop, getTouchable, getUserObject, getWidth, getX, getX, getY, getY, getZIndex, hasActions, hasParent, isAscendantOf, isDescendantOf, isTouchable, isVisible, localToAscendantCoordinates, localToParentCoordinates, localToStageCoordinates, moveBy, notify, parentToLocalCoordinates, positionChanged, remove, removeAction, removeCaptureListener, removeListener, rotateBy, rotationChanged, scaleBy, scaleBy, screenToLocalCoordinates, setBounds, setColor, setColor, setDebug, setName, setOrigin, setOrigin, setOriginX, setOriginY, setParent, setPosition, setPosition, setRotation, setScale, setScale, setScaleX, setScaleY, setSize, setTouchable, setUserObject, setVisible, setX, setY, setZIndex, sizeBy, sizeBy, stageToLocalCoordinates, toBack, toFrontprotected com.badlogic.gdx.scenes.scene2d.ui.Image switchSprite
protected com.badlogic.gdx.scenes.scene2d.ui.Image stateRect
protected Switch.SwitchState state
Switch.SwitchState.protected Switch.LogicalState inputState
protected Modifier animationModifier
protected float borderValueLeft
switchSprite.protected float borderValueRight
switchSprite.protected float borderValue
public Switch(com.badlogic.gdx.scenes.scene2d.ui.Skin skin,
com.badlogic.gdx.scenes.scene2d.utils.Drawable background)
public Switch(Switch.SwitchStyle style, com.badlogic.gdx.scenes.scene2d.utils.Drawable background)
public Switch(com.badlogic.gdx.scenes.scene2d.utils.Drawable background,
com.badlogic.gdx.scenes.scene2d.utils.Drawable button,
com.badlogic.gdx.scenes.scene2d.utils.Drawable whitePixel,
com.badlogic.gdx.graphics.Color state)
background - background of the switchbutton - the moveable button of the switchpublic void updateBackground(com.badlogic.gdx.scenes.scene2d.utils.Drawable background)
background - background imagepublic void updateButton(com.badlogic.gdx.scenes.scene2d.utils.Drawable button)
button - new button imagepublic void updatePixel(com.badlogic.gdx.scenes.scene2d.utils.Drawable whitePixel)
whitePixel - new drawablepublic boolean isOn()
SwitchState.ON.SwitchState.OFFprotected void setBorderValueRight(float borderValueRight)
borderValueRight.borderValueRight - right border for switchSpriteprotected void setBorderValueLeft(float borderValueLeft)
borderValueLeft.borderValueLeft - left border for switchSprite.public void switchToState(boolean state)
state - as booleanpublic void switchToState(Switch.SwitchState switchState)
switchState - Switch.SwitchStateprotected void switchState()
public void act(float secondsElapsed)
act in class com.badlogic.gdx.scenes.scene2d.Grouppublic void setHeight(float height)
setHeight in class com.badlogic.gdx.scenes.scene2d.Actorpublic void setWidth(float width)
setWidth in class com.badlogic.gdx.scenes.scene2d.Actor