com.badlogic.gdx.scenes.scene2d.actors
Class Button
java.lang.Object
com.badlogic.gdx.scenes.scene2d.Actor
com.badlogic.gdx.scenes.scene2d.actors.Button
- All Implemented Interfaces:
- Layout
public class Button
- extends Actor
- implements Layout
A simple Button Actor
, useful for simple UIs
- Author:
- mzechner
Fields inherited from class com.badlogic.gdx.scenes.scene2d.Actor |
actions, color, height, name, originX, originY, parent, rotation, scaleX, scaleY, touchable, width, x, y |
Constructor Summary |
Button(java.lang.String name)
Creates a new Button instance with the given name. |
Button(java.lang.String name,
Texture texture)
Creates a new Button instance with the given name, using the complete supplied texture for displaying the pressed and
unpressed state of the button. |
Button(java.lang.String name,
TextureRegion region)
|
Button(java.lang.String name,
TextureRegion unpressedRegion,
TextureRegion pressedRegion)
|
Methods inherited from class com.badlogic.gdx.scenes.scene2d.Actor |
act, action, clearActions, isMarkedToRemove, keyDown, keyTyped, keyUp, markToRemove, remove, scrolled, toLocalCoordinates, toString, touchMoved |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
pressedRegion
public TextureRegion pressedRegion
unpressedRegion
public TextureRegion unpressedRegion
clickListener
public Button.ClickListener clickListener
pressed
public boolean pressed
pointer
protected int pointer
Button
public Button(java.lang.String name)
- Creates a new Button instance with the given name.
- Parameters:
name
- the name
Button
public Button(java.lang.String name,
Texture texture)
- Creates a new Button instance with the given name, using the complete supplied texture for displaying the pressed and
unpressed state of the button.
- Parameters:
name
- the nametexture
- the Texture
Button
public Button(java.lang.String name,
TextureRegion region)
Button
public Button(java.lang.String name,
TextureRegion unpressedRegion,
TextureRegion pressedRegion)
draw
protected void draw(SpriteBatch batch,
float parentAlpha)
- Description copied from class:
Actor
- Draws the Actor. The spriteBatch is configured so that the Actor can draw in its parents coordinate system. The parent's
alpha is passed to the method in order for the Actor to multiply it with its own alpha. This will allow
FadeIn
and
other Actions to have an effect even if they are only set on the parent of the Actor.
- Specified by:
draw
in class Actor
- Parameters:
batch
- the spritebatch to render withparentAlpha
- the parent's alpha value.
touchDown
protected boolean touchDown(float x,
float y,
int pointer)
- Specified by:
touchDown
in class Actor
touchUp
protected boolean touchUp(float x,
float y,
int pointer)
- Specified by:
touchUp
in class Actor
touchDragged
protected boolean touchDragged(float x,
float y,
int pointer)
- Specified by:
touchDragged
in class Actor
hit
public Actor hit(float x,
float y)
- Specified by:
hit
in class Actor
layout
public void layout()
- Specified by:
layout
in interface Layout
invalidate
public void invalidate()
- Specified by:
invalidate
in interface Layout
getPrefWidth
public float getPrefWidth()
- Specified by:
getPrefWidth
in interface Layout
getPrefHeight
public float getPrefHeight()
- Specified by:
getPrefHeight
in interface Layout
Copyright 2010 Mario Zechner (contact@badlogicgames.com), Nathan Sweet (admin@esotericsoftware.com)