Example usage for com.badlogic.gdx.scenes.scene2d Event getTarget

List of usage examples for com.badlogic.gdx.scenes.scene2d Event getTarget

Introduction

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

Prototype

public Actor getTarget() 

Source Link

Document

Returns the actor that the event originated from.

Usage

From source file:com.blastedstudios.gdxworld.util.ui.Scene2DUtils.java

License:Apache License

/** @param c the event to copy to
 *  @param e the event to copy from */
public static void copy(Event c, Event e) {
    c.setTarget(e.getTarget());
    c.setStage(e.getStage());//from  ww  w.ja  v  a  2  s . c om
    c.setCapture(e.isCapture());
    c.setBubbles(e.getBubbles());
    c.setListenerActor(e.getListenerActor());
}

From source file:com.maplescot.loggerbill.ui.AboutDialog.java

License:Creative Commons License

@Override
public boolean handle(Event event) {
    if (!(event instanceof ChangeEvent))
        return false;
    changed((ChangeEvent) event, event.getTarget());
    return false;
}

From source file:com.vlaaad.common.GdxHelper.java

License:Open Source License

public static void showStageEvents(final Stage stage) {
    EventListener listener = new EventListener() {
        private final Vector2 tmp = new Vector2();
        private Actor actor = new Actor() {
            @Override/*from  w w  w.ja v a  2  s.c om*/
            public void draw(Batch batch, float parentAlpha) {
                if (target == null)
                    return;
                batch.end();
                Config.shapeRenderer.begin(ShapeRenderer.ShapeType.Line);
                Config.shapeRenderer.setProjectionMatrix(stage.getCamera().combined);
                Gdx.gl.glLineWidth(6);
                Config.shapeRenderer.setColor(Color.ORANGE);
                Vector2 pos = target.localToStageCoordinates(tmp.set(0, 0));
                float x = pos.x, y = pos.y;
                Vector2 top = target.localToStageCoordinates(tmp.set(target.getWidth(), target.getHeight()));
                float maxX = top.x, maxY = top.y;
                Config.shapeRenderer.rect(x, y, maxX - x, maxY - y);

                Config.shapeRenderer.end();
                batch.begin();
            }
        };

        {
            stage.addActor(actor);
        }

        public Actor target;

        @Override
        public boolean handle(Event event) {
            target = event.getTarget();
            return false;
        }
    };
    stage.addListener(listener);
}

From source file:net.dermetfan.gdx.scenes.scene2d.Scene2DUtils.java

License:Apache License

/** @param c the event to copy from
 *  @param e the event to copy to */
public static void copy(Event e, Event c) {
    c.setTarget(e.getTarget());
    c.setStage(e.getStage());//from   ww w  . j  a  va  2s. co  m
    c.setCapture(e.isCapture());
    c.setBubbles(e.getBubbles());
    c.setListenerActor(e.getListenerActor());
}