libgdx API

com.badlogic.gdx.scenes.scene2d.actors
Class Label

java.lang.Object
  extended by com.badlogic.gdx.scenes.scene2d.Actor
      extended by com.badlogic.gdx.scenes.scene2d.actors.Label
All Implemented Interfaces:
Layout

public class Label
extends Actor
implements Layout


Nested Class Summary
static class Label.VAlignment
           
 
Field Summary
 BitmapFont.TextBounds bounds
           
 BitmapFontCache cache
           
 java.lang.String text
           
 Label.VAlignment valign
           
 
Fields inherited from class com.badlogic.gdx.scenes.scene2d.Actor
actions, color, height, name, originX, originY, parent, rotation, scaleX, scaleY, touchable, visible, width, x, y
 
Constructor Summary
Label(java.lang.String name, BitmapFont font)
           
Label(java.lang.String name, BitmapFont font, java.lang.String text)
           
 
Method Summary
 void draw(SpriteBatch batch, float parentAlpha)
          Draws the Actor.
 float getMaxHeight()
           
 float getMaxWidth()
           
 float getMinHeight()
           
 float getMinWidth()
           
 float getPrefHeight()
           
 float getPrefWidth()
           
 Actor hit(float x, float y)
           
 void invalidate()
          Invalidates the layout, forcing the next call to Layout.layout() to relayout.
 void layout()
          Positions and sizes each child of this actor.
 void setFont(BitmapFont font)
           
 void setMultiLineText(java.lang.String text)
           
 void setText(java.lang.String text)
           
 void setWrappedText(java.lang.String text, BitmapFont.HAlignment halign)
           
 boolean touchDown(float x, float y, int pointer)
           
 void touchDragged(float x, float y, int pointer)
           
 void touchUp(float x, float y, int pointer)
           
 
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
 

Field Detail

cache

public BitmapFontCache cache

valign

public Label.VAlignment valign

text

public java.lang.String text

bounds

public final BitmapFont.TextBounds bounds
Constructor Detail

Label

public Label(java.lang.String name,
             BitmapFont font)

Label

public Label(java.lang.String name,
             BitmapFont font,
             java.lang.String text)
Method Detail

setText

public void setText(java.lang.String text)

setMultiLineText

public void setMultiLineText(java.lang.String text)

setWrappedText

public void setWrappedText(java.lang.String text,
                           BitmapFont.HAlignment halign)

setFont

public void setFont(BitmapFont font)

draw

public 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 with
parentAlpha - the parent's alpha value.

touchDown

public boolean touchDown(float x,
                         float y,
                         int pointer)
Specified by:
touchDown in class Actor

touchUp

public void touchUp(float x,
                    float y,
                    int pointer)
Specified by:
touchUp in class Actor

touchDragged

public void 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()
Description copied from interface: Layout
Positions and sizes each child of this actor. Subsequent calls will not have any affect unless Layout.invalidate() is called.

Specified by:
layout in interface Layout

invalidate

public void invalidate()
Description copied from interface: Layout
Invalidates the layout, forcing the next call to Layout.layout() to relayout. If an actor is resized or otherwise changed in a way that affects its layout, Layout.invalidate() should be called.

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

getMinWidth

public float getMinWidth()
Specified by:
getMinWidth in interface Layout

getMinHeight

public float getMinHeight()
Specified by:
getMinHeight in interface Layout

getMaxWidth

public float getMaxWidth()
Specified by:
getMaxWidth in interface Layout

getMaxHeight

public float getMaxHeight()
Specified by:
getMaxHeight in interface Layout

libgdx API

Copyright 2010 Mario Zechner (contact@badlogicgames.com), Nathan Sweet (admin@esotericsoftware.com)