Example usage for com.badlogic.gdx.scenes.scene2d Actor setName

List of usage examples for com.badlogic.gdx.scenes.scene2d Actor setName

Introduction

In this page you can find the example usage for com.badlogic.gdx.scenes.scene2d Actor setName.

Prototype

public void setName(String name) 

Source Link

Document

Sets a name for easier identification of the actor in application code.

Usage

From source file:at.highstreeto.xnllayoutparser.element.base.ElementParserHelper.java

License:Apache License

public static void setActorName(Element element, Actor actor) {
    if (element.getAttributes() != null && element.getAttributes().containsKey("name")) {
        actor.setName(element.getAttribute("name"));
    }/*from  w w  w  . jav a  2s.  com*/
}

From source file:es.eucm.ead.editor.ui.maintoolbar.MainToolbar.java

License:Open Source License

/**
 * Create {@link IconButton} initially disabled
 *///from   w  w  w . j av  a 2  s  . c om
private <T extends Action> Actor createIcon(String drawable, Skin skin, String tooltip, Class<T> actionClass,
        Object... args) {
    Actor actor = WidgetsUtils.createIcon(controller, drawable, IMAGE_PADDING, skin, tooltip, actionClass,
            args);
    actor.setName(ClassReflection.getSimpleName(actionClass).toLowerCase());
    return actor;
}

From source file:mobi.shad.s3lib.gui.GuiUtil.java

License:Apache License

/**
 * @param source/*from www . j  av a2 s . c om*/
 * @param destination
 */
public static void copyActor(Actor source, Actor destination) {
    destination.setBounds(source.getX(), source.getY(), source.getWidth(), source.getHeight());
    destination.setColor(source.getColor());
    destination.setName(source.getName());
    destination.setOrigin(source.getOriginX(), source.getOriginY());
    destination.setRotation(source.getRotation());
    destination.setScale(source.getScaleX(), source.getScaleY());
    destination.setTouchable(source.getTouchable());
    destination.setUserObject(source.getUserObject());
    destination.setVisible(source.isVisible());
    destination.setZIndex(source.getZIndex());
    destination.getStage();
}

From source file:mobi.shad.s3lib.gui.ui.Button.java

License:Apache License

@Override
public void setName(String name) {
    super.setName(name);
    final SnapshotArray<Actor> children = getChildren();
    for (Actor child : children) {
        child.setName(name);
    }/*from   w  ww. j  a v  a  2  s.co m*/

}

From source file:mobi.shad.s3lib.gui.ui.TextButton.java

License:Apache License

@Override
public void setName(String name) {
    super.setName(name);
    final SnapshotArray<Actor> children = getChildren();
    for (Actor child : children) {
        child.setName(name);
    }//from   w  w  w  .  j a v  a2s.  co  m
}

From source file:net.mwplay.cocostudio.ui.BaseWidgetParser.java

License:Apache License

/**
 * common attribute parser/* w w  w . j av a2 s  . c  o  m*/
 * according cocstudio ui setting properties of the configuration file
 *
 * @param editor
 * @param widget
 * @param parent
 * @param actor
 * @return
 */
public Actor commonParse(CocoStudioUIEditor editor, ObjectData widget, Group parent, Actor actor) {
    this.editor = editor;
    actor.setName(widget.getName());
    actor.setSize(widget.getSize().getX(), widget.getSize().getY());
    // set origin
    if (widget.getAnchorPoint() != null) {
        actor.setOrigin(widget.getAnchorPoint().getScaleX() * actor.getWidth(),
                widget.getAnchorPoint().getScaleY() * actor.getHeight());
    }

    //?Postion
    if (widget.getPosition() != null) {
        actor.setPosition(widget.getPosition().getX() - actor.getOriginX(),
                widget.getPosition().getY() - actor.getOriginY());
    }

    // CocoStudioScaleX,ScaleY 
    //?Scale
    if (widget.getScale() != null) {
        actor.setScale(widget.getScale().getScaleX(), widget.getScale().getScaleY());
    }

    if (widget.getRotation() != 0) {// CocoStudio ?,?.
        actor.setRotation(360 - widget.getRotation() % 360);
    }
    //
    if (widget.getRotationSkewX() != 0 && widget.getRotationSkewX() == widget.getRotationSkewY()) {
        actor.setRotation(360 - widget.getRotationSkewX() % 360);
    }

    // ??
    actor.setVisible(widget.isVisibleForFrame());

    Color color = editor.getColor(widget.getCColor(), widget.getAlpha());

    actor.setColor(color);

    actor.setTouchable(deduceTouchable(actor, widget));

    // callback

    addCallback(actor, widget);
    // callback

    addActor(editor, actor, widget);

    if (widget.getChildren() == null || widget.getChildren().size() == 0) {
        //Action
        parseAction(actor, widget);

        return actor;
    }

    return null;
}