Example usage for com.badlogic.gdx.scenes.scene2d Stage getActors

List of usage examples for com.badlogic.gdx.scenes.scene2d Stage getActors

Introduction

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

Prototype

public Array<Actor> getActors() 

Source Link

Document

Returns the root's child actors.

Usage

From source file:com.bladecoder.engineeditor.utils.Message.java

License:Apache License

private static void add(Stage stage, String text) {
    msg.clearActions();//from  www .j  ava2s . c o m

    msg.setText(text);

    GlyphLayout textLayout = new GlyphLayout();

    textLayout.setText(msg.getStyle().font, text, Color.BLACK, stage.getWidth() * .8f, Align.center, true);

    msg.setSize(textLayout.width + textLayout.height, textLayout.height + textLayout.height * 2);

    if (!stage.getActors().contains(msg, true))
        stage.addActor(msg);

    msg.setPosition(Math.round((stage.getWidth() - msg.getWidth()) / 2),
            Math.round((stage.getHeight() - msg.getHeight()) / 2));
    msg.invalidate();
}

From source file:com.calanti.androidnativekeyboardinputtest.libgdxModified_1_9_3.CalTextField.java

License:Apache License

/** Focuses the next  If none is found, the keyboard is hidden. Does nothing if the text field is not in a stage.
 * @param up If true, the TextField with the same or next smallest y coordinate is found, else the next highest. */
public void next(boolean up) {
    Stage stage = getStage();
    if (stage == null)
        return;//from   w  ww  . j av a  2s  .c  o m
    getParent().localToStageCoordinates(tmp1.set(getX(), getY()));
    CalTextField textField = findNextTextField(stage.getActors(), null, tmp2, tmp1, up);
    if (textField == null) { // Try to wrap around.
        if (up)
            tmp1.set(Float.MIN_VALUE, Float.MIN_VALUE);
        else
            tmp1.set(Float.MAX_VALUE, Float.MAX_VALUE);
        textField = findNextTextField(getStage().getActors(), null, tmp2, tmp1, up);
    }
    if (textField != null) {
        stage.setKeyboardFocus(textField);
        /** calanti addition - send EditText focus to next */
        if (androidTextInputInterface != null) {
            androidTextInputInterface.requestKeyboard(textField);
        }
    } else {
        /** calanti addition - also tell stage to unfocus */
        if (androidTextInputInterface != null) {
            androidTextInputInterface.forceHideKeyboard();
        } else {
            Gdx.input.setOnscreenKeyboardVisible(false);
        }
        stage.unfocusAll();
    }
}

From source file:com.minikara.ttfinput.TextField.java

License:Apache License

/** Focuses the next TextField. If none is found, the keyboard is hidden. Does nothing if the text field is not in a stage.
 * @param up If true, the TextField with the same or next smallest y coordinate is found, else the next highest. */
public void next(boolean up) {
    Stage stage = getStage();
    if (stage == null)
        return;//  w ww.  j  ava2  s  .c om
    getParent().localToStageCoordinates(tmp1.set(getX(), getY()));
    TextField textField = findNextTextField(stage.getActors(), null, tmp2, tmp1, up);
    if (textField == null) { // Try to wrap around.
        if (up)
            tmp1.set(Float.MIN_VALUE, Float.MIN_VALUE);
        else
            tmp1.set(Float.MAX_VALUE, Float.MAX_VALUE);
        textField = findNextTextField(getStage().getActors(), null, tmp2, tmp1, up);
    }
    if (textField != null)
        stage.setKeyboardFocus(textField);
    else
        Gdx.input.setOnscreenKeyboardVisible(false);
}

From source file:com.mygdx.jogo.Tabuleiro.java

/**Mtodo utilizado para moficiar o estado do tabuleiro aps a pea realizar um movimento,
* tambm responsavel por remover peas que no so refnciadas no novo estado. 
* @param novo  o estado obtido atravs de um movimento.  
* @param estagio estagio utilizado para deletar a imagem da pea a ser removida.
*//*from   w w  w . j a  v  a  2s .co  m*/
public void setEstado(Estado novo, Stage estagio) {
    estado = novo;
    for (int i = 0; i < estado.matriz.length; i++) {
        for (int j = 0; j < estado.matriz.length; j++) {
            if (matrizCasas[i][j].peca != null && estado.matriz[i][j] == 0) {
                estagio.getActors().removeValue(matrizCasas[i][j].peca.imagem, true);
                matrizCasas[i][j].peca = null;
            }
        }
    }

}

From source file:com.pucpr.game.states.game.basic.Conversation.java

public void hideMessage() {
    startedMessage = null;/*from   w  w  w. j  a v  a  2  s  . c  o  m*/
    waitMessageWithoutMessage = System.currentTimeMillis();

    final Container container = (Container) (currentMessage != null ? currentMessage.getActor() : null);

    if (container != null) {
        final Stage stage = info.getGameState().getStage();
        stage.getActors().removeValue(container, true);
        container.remove();
    }

}

From source file:com.pucpr.game.states.game.basic.ScreenInfo.java

public void hideTimeOut() {
    if (showTimeOut) {
        this.showTimeOut = false;
        this.timeOut = null;

        final Stage stage = gameState.getStage();
        stage.getActors().removeValue(timeOutContainer, true);
        timeOutContainer.remove();//w w w.j  a  va  2 s  .com
    }
}

From source file:com.pucpr.game.states.game.basic.ScreenInfo.java

public void hideImage() {
    if (showImage) {
        this.showImage = false;
        this.timeOutImage = null;

        final Stage stage = gameState.getStage();
        stage.getActors().removeValue(imageContainer, true);
        imageContainer.remove();/*w ww.j a  v  a  2 s.  com*/
    }
}

From source file:com.strategames.engine.game.GameEngine.java

License:Open Source License

private void fixedTimeStep(float delta, Stage stage) {
    this.world.step(BOX2D_UPDATE_FREQUENCY, 6, 2);
    Array<Actor> actors = stage.getActors();
    int size = actors.size;

    for (int i = 0; i < size; i++) {
        GameObject gameObject = (GameObject) actors.get(i);

    }/* ww  w  .j  a  v a  2  s. co  m*/
}

From source file:com.strategames.engine.game.GameEngine.java

License:Open Source License

private void interpolateGameObjectsCurrentPosition(float alpha, Stage stage) {
    Array<Actor> actors = stage.getActors();
    int size = actors.size;

    for (int i = 0; i < size; i++) {
        ((GameObject) actors.get(i)).interpolate(alpha);
    }/*ww w .  j a  v a2s.c  o m*/
}

From source file:com.strategames.engine.utils.Animations.java

License:Open Source License

public static void fadeIn(Stage stage, float duration, Interpolation interpolation) {
    Array<Actor> actors = stage.getActors();
    int size = actors.size;
    for (int i = 0; i < size; i++) {
        Actor actor = actors.get(i);//  w w w . j a  v a 2 s .c  o m
        Color color = actor.getColor();
        color.a = 0;
        actor.addAction(sequence(Actions.fadeIn(duration, interpolation)));
    }
}