Example usage for com.badlogic.gdx.scenes.scene2d Group addActorAt

List of usage examples for com.badlogic.gdx.scenes.scene2d Group addActorAt

Introduction

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

Prototype

public void addActorAt(int index, Actor actor) 

Source Link

Document

Adds an actor as a child of this group, at a specific index.

Usage

From source file:es.eucm.ead.editor.control.actions.editor.CreateSceneThumbnail.java

License:Open Source License

@Override
public void perform(Object... args) {
    ModelEntity scene;//  w  ww . j av a  2s .com
    CreateThumbnailListener listener;

    if (args[0] instanceof ModelEntity) {
        scene = (ModelEntity) args[0];
        EngineEntity sceneEngineEntity = entitiesLoader.toEngineEntity(scene);
        listener = new CreateThumbnailModelListener(sceneEngineEntity);
    } else {
        Group sceneGroup = (Group) args[0];
        scene = Q.getModelEntity(sceneGroup);
        Group parent = sceneGroup.getParent();
        int index = sceneGroup.getZIndex();
        FrameBuffer frameBuffer = drawActor(sceneGroup);
        if (parent != null) {
            parent.addActorAt(index, sceneGroup);
        }
        listener = new CreateThumbnailListener(frameBuffer);
    }

    FileHandle thumbnailsFolder = assets.resolveProject(ModelStructure.THUMBNAILS_PATH);
    thumbnailsFolder.mkdirs();

    String thumbnailPath = Q.getThumbnailPath(model.getIdFor(scene));

    Thumbnail thumbnail = Q.getComponent(scene, Thumbnail.class);
    thumbnail.setPath(thumbnailPath);

    listener.thumbnailPath = thumbnailPath;

    controller.action(ExecuteWorker.class, StepsWorker.class, listener, STEPS, assets);
}