com.badlogic.gdx.scenes.scene2d.actions.RunnableAction Java Examples

The following examples show how to use com.badlogic.gdx.scenes.scene2d.actions.RunnableAction. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PauseMenuStage.java    From Klooni1010 with GNU General Public License v3.0 6 votes vote down vote up
private void hide() {
    shown = false;
    hiding = true;
    Gdx.input.setInputProcessor(lastInputProcessor);

    addAction(Actions.sequence(
            Actions.moveTo(0, Gdx.graphics.getHeight(), 0.5f, Interpolation.swingIn),
            new RunnableAction() {
                @Override
                public void run() {
                    hiding = false;
                }
            }
    ));
    scorer.resume();
}
 
Example #2
Source File: DialogLoading.java    From skin-composer with MIT License 5 votes vote down vote up
@Override
public Dialog show(Stage stage) {
    Dialog dialog = super.show(stage);
    RunnableAction runnableAction = new RunnableAction();
    runnableAction.setRunnable(() -> {
        if (Utils.isMac()) {
            if (runnable != null) {
                runnable.run();
            }
            hide();
        } else {
            Thread thread = new Thread(() -> {
                if (runnable != null) {
                    runnable.run();
                }
                Gdx.app.postRunnable(() -> {
                    hide();
                });
            });
            thread.start();
        }
    });
    Action action = new SequenceAction(new DelayAction(.5f), runnableAction);
    addAction(action);
    
    return dialog;
}