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

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

Introduction

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

Prototype

public boolean isVisible() 

Source Link

Usage

From source file:com.crashinvaders.common.scene2d.HorizontalGroupExtended.java

License:Apache License

private Array<Actor> getVisibleChildren() {
    tmpActorsArray.clear();//from ww  w  . j a  v a 2s  .  c o  m
    Array<Actor> result = this.tmpActorsArray;

    for (Actor actor : getChildren()) {
        if (actor.isVisible()) {
            result.add(actor);
        }
    }
    return result;
}

From source file:com.kotcrab.vis.ui.util.value.ConstantIfVisibleValue.java

License:Apache License

@Override
public float get(Actor context) {
    if (actor != null)
        context = actor;//from  w  ww.ja va 2  s . c  o m
    return context.isVisible() ? constant : 0;
}

From source file:com.kotcrab.vis.ui.widget.MultiSplitPane.java

License:Apache License

@Override
public void draw(Batch batch, float parentAlpha) {
    validate();//from   ww  w  . j  a v  a 2 s.co  m

    Color color = getColor();

    applyTransform(batch, computeTransform());

    SnapshotArray<Actor> actors = getChildren();
    for (int i = 0; i < actors.size; i++) {
        Actor actor = actors.get(i);
        Rectangle bounds = widgetBounds.get(i);
        Rectangle scissor = scissors.get(i);
        getStage().calculateScissors(bounds, scissor);
        if (ScissorStack.pushScissors(scissor)) {
            if (actor.isVisible())
                actor.draw(batch, parentAlpha * color.a);
            batch.flush();
            ScissorStack.popScissors();
        }
    }

    batch.setColor(color.r, color.g, color.b, parentAlpha * color.a);

    Drawable handle = style.handle;
    Drawable handleOver = style.handle;
    if (isTouchable() && style.handleOver != null)
        handleOver = style.handleOver;
    for (Rectangle rect : handleBounds) {
        if (this.handleOver == rect) {
            handleOver.draw(batch, rect.x, rect.y, rect.width, rect.height);
        } else {
            handle.draw(batch, rect.x, rect.y, rect.width, rect.height);
        }
    }
    resetTransform(batch);
}

From source file:com.quadbits.gdxhelper.controllers.RotationSimpleController.java

License:Apache License

@Override
public void control(Actor actor, float deltaSeconds) {
    // Do nothing on invisible actors
    if (!actor.isVisible()) {
        return;//from  w w w  .  j  ava  2 s.  co  m
    }

    // Calculate actual rotation
    float rotation = this.rotationSpeed * deltaSeconds * 1000;

    // Reverse rotation?
    if (actor instanceof SpriteActor) {
        SpriteActor spriteActor = (SpriteActor) actor;
        if (reverseOnFlip && (spriteActor.isFlipX() && !spriteActor.isFlipY()
                || !spriteActor.isFlipX() && spriteActor.isFlipY())) {
            rotation = -rotation;
        }
    }

    // Apply rotation
    actor.rotateBy(rotation);
}

From source file:com.quadbits.gdxhelper.controllers.RotationSimpleController.java

License:Apache License

@Override
public long getMaxSleepTime(Actor actor) {
    if (actor.isVisible()) {
        return 0;
    }/*from  w  w w .  jav a  2 s  .  c o  m*/

    return Long.MAX_VALUE;
}

From source file:com.ridiculousRPG.ui.ActorFocusUtil.java

License:Apache License

private static boolean isFocusable(Actor a) {
    return a.isVisible() && a.getTouchable() != Touchable.disabled && styleGetter(a.getClass()) != null
            && !(a instanceof Label) && !(a instanceof ScrollPane) && !(a instanceof Image)
            && !(a instanceof Window) && !(a instanceof EventActor);
}

From source file:es.eucm.ead.editor.view.widgets.AbstractWidget.java

License:Open Source License

protected float getChildrenTotalWidth(boolean computeInvisibles) {
    float totalWidth = 0;
    for (Actor a : this.getChildren()) {
        if (a.isVisible() || computeInvisibles) {
            totalWidth += getPrefWidth(a);
        }/*from  ww  w. ja v  a  2s. com*/
    }
    return totalWidth;
}

From source file:es.eucm.ead.editor.view.widgets.AbstractWidget.java

License:Open Source License

protected float getChildrenTotalHeight(boolean computeInvisibles) {
    float totalHeight = 0;
    for (Actor a : this.getChildren()) {
        if (a.isVisible() || computeInvisibles) {
            totalHeight += getPrefHeight(a);
        }/*from w  ww  .j a  v  a  2 s .co  m*/
    }
    return totalHeight;
}

From source file:es.eucm.ead.editor.view.widgets.AbstractWidget.java

License:Open Source License

protected float getChildrenMaxHeight(boolean computeInvisibles) {
    float maxHeight = 0;
    for (Actor a : this.getChildren()) {
        if (a.isVisible() || computeInvisibles) {
            maxHeight = Math.max(getPrefHeight(a), maxHeight);
        }/*www  .  ja  va 2s.c om*/
    }
    return maxHeight;
}

From source file:es.eucm.ead.editor.view.widgets.AbstractWidget.java

License:Open Source License

protected float getChildrenMaxWidth(boolean computeInvisibles) {
    float maxWidth = 0;
    for (Actor a : this.getChildren()) {
        if (a.isVisible() || computeInvisibles) {
            maxWidth = Math.max(getPrefWidth(a), maxWidth);
        }//from  w  ww .  j a v  a2  s.  c o m
    }
    return maxWidth;
}