Search in sources :

Example 1 with DialogSceneComposer

use of com.ray3k.skincomposer.dialog.scenecomposer.DialogSceneComposer in project skin-composer by raeleus.

the class SliderListeners method sliderAnimationListener.

public static EventListener sliderAnimationListener(final DialogSceneComposer dialogSceneComposer) {
    var simSlider = (DialogSceneComposerModel.SimSlider) dialogSceneComposer.simActor;
    var popTableClickListener = new PopTableClickListener(skin) {

        {
            getPopTable().key(Keys.ENTER, popTable::hide);
            getPopTable().key(Keys.NUMPAD_ENTER, popTable::hide);
            getPopTable().key(Keys.ESCAPE, popTable::hide);
        }

        @Override
        public void clicked(InputEvent event, float x, float y) {
            super.clicked(event, x, y);
            update();
        }

        public void update() {
            var popTable = getPopTable();
            popTable.clearChildren();
            var table = new Table();
            popTable.add(table);
            table.defaults().spaceRight(5);
            var textButton = new TextButton("Animate Interpolation", skin, "scene-med");
            table.add(textButton).uniformX().fillX().colspan(2);
            textButton.addListener(handListener);
            textButton.addListener(GeneralListeners.interpolationListener(dialogSceneComposer, selection -> dialogSceneComposer.events.sliderAnimateInterpolation(selection)));
            table.row();
            textButton = new TextButton("Visual Interpolation", skin, "scene-med");
            table.add(textButton).uniformX().fillX().colspan(2);
            textButton.addListener(handListener);
            textButton.addListener(GeneralListeners.interpolationListener(dialogSceneComposer, selection -> dialogSceneComposer.events.sliderVisualInterpolation(selection)));
            table.row();
            var label = new Label("Animation Duration:", skin, "scene-label-colored");
            table.add(label).right();
            var durationSpinner = new Spinner(simSlider.animationDuration, 1, false, Spinner.Orientation.RIGHT_STACK, skin, "scene");
            durationSpinner.setMinimum(0);
            table.add(durationSpinner).left();
            durationSpinner.getTextField().addListener(ibeamListener);
            durationSpinner.getButtonMinus().addListener(handListener);
            durationSpinner.getButtonPlus().addListener(handListener);
            durationSpinner.addListener(new TextTooltip("The animation duration of the Slider as the value changes.", tooltipManager, skin, "scene"));
            durationSpinner.addListener(new ChangeListener() {

                @Override
                public void changed(ChangeEvent event, Actor actor) {
                    dialogSceneComposer.events.sliderAnimationDuration((float) durationSpinner.getValue());
                }
            });
        }
    };
    popTableClickListener.update();
    return popTableClickListener;
}
Also used : InputListener(com.badlogic.gdx.scenes.scene2d.InputListener) PopTableClickListener(com.ray3k.stripe.PopTableClickListener) com.badlogic.gdx.scenes.scene2d.ui(com.badlogic.gdx.scenes.scene2d.ui) DialogSceneComposer(com.ray3k.skincomposer.dialog.scenecomposer.DialogSceneComposer) InputEvent(com.badlogic.gdx.scenes.scene2d.InputEvent) TEXT_FIELD_WIDTH(com.ray3k.skincomposer.dialog.scenecomposer.menulisteners.ListenersUtils.TEXT_FIELD_WIDTH) Spinner(com.ray3k.stripe.Spinner) Actor(com.badlogic.gdx.scenes.scene2d.Actor) DialogSceneComposerEvents(com.ray3k.skincomposer.dialog.scenecomposer.DialogSceneComposerEvents) DialogSceneComposerModel(com.ray3k.skincomposer.dialog.scenecomposer.DialogSceneComposerModel) SimActor(com.ray3k.skincomposer.dialog.scenecomposer.DialogSceneComposerModel.SimActor) ChangeListener(com.badlogic.gdx.scenes.scene2d.utils.ChangeListener) Keys(com.badlogic.gdx.Input.Keys) Main(com.ray3k.skincomposer.Main) Input(com.badlogic.gdx.Input) StyleData(com.ray3k.skincomposer.data.StyleData) DraggableTextList(com.ray3k.stripe.DraggableTextList) StyleSelectorPopTable(com.ray3k.skincomposer.dialog.scenecomposer.StyleSelectorPopTable) EventListener(com.badlogic.gdx.scenes.scene2d.EventListener) StyleSelectorPopTable(com.ray3k.skincomposer.dialog.scenecomposer.StyleSelectorPopTable) Spinner(com.ray3k.stripe.Spinner) PopTableClickListener(com.ray3k.stripe.PopTableClickListener) Actor(com.badlogic.gdx.scenes.scene2d.Actor) SimActor(com.ray3k.skincomposer.dialog.scenecomposer.DialogSceneComposerModel.SimActor) ChangeListener(com.badlogic.gdx.scenes.scene2d.utils.ChangeListener) InputEvent(com.badlogic.gdx.scenes.scene2d.InputEvent)

Example 2 with DialogSceneComposer

use of com.ray3k.skincomposer.dialog.scenecomposer.DialogSceneComposer in project skin-composer by raeleus.

the class DialogFactory method showSceneComposerDialog.

public void showSceneComposerDialog() {
    DialogSceneComposer dialog = new DialogSceneComposer();
    dialog.show(stage);
}
Also used : DialogSceneComposer(com.ray3k.skincomposer.dialog.scenecomposer.DialogSceneComposer)

Example 3 with DialogSceneComposer

use of com.ray3k.skincomposer.dialog.scenecomposer.DialogSceneComposer in project skin-composer by raeleus.

the class ProgressBarListeners method progressBarAnimationListener.

public static EventListener progressBarAnimationListener(final DialogSceneComposer dialogSceneComposer) {
    var simProgressBar = (DialogSceneComposerModel.SimProgressBar) dialogSceneComposer.simActor;
    var popTableClickListener = new PopTableClickListener(skin) {

        {
            getPopTable().key(Keys.ESCAPE, popTable::hide);
        }

        @Override
        public void clicked(InputEvent event, float x, float y) {
            super.clicked(event, x, y);
            update();
        }

        public void update() {
            var popTable = getPopTable();
            popTable.clearChildren();
            var table = new Table();
            popTable.add(table);
            table.defaults().spaceRight(5);
            var textButton = new TextButton("Animate Interpolation", skin, "scene-med");
            table.add(textButton).uniformX().fillX().colspan(2);
            textButton.addListener(handListener);
            textButton.addListener(GeneralListeners.interpolationListener(dialogSceneComposer, selection -> dialogSceneComposer.events.progressBarAnimateInterpolation(selection)));
            table.row();
            textButton = new TextButton("Visual Interpolation", skin, "scene-med");
            table.add(textButton).uniformX().fillX().colspan(2);
            textButton.addListener(handListener);
            textButton.addListener(GeneralListeners.interpolationListener(dialogSceneComposer, selection -> dialogSceneComposer.events.progressBarVisualInterpolation(selection)));
            table.row();
            var label = new Label("Animation Duration:", skin, "scene-label-colored");
            table.add(label).right();
            var durationSpinner = new Spinner(simProgressBar.animationDuration, 1, false, Spinner.Orientation.RIGHT_STACK, skin, "scene");
            durationSpinner.setMinimum(0);
            table.add(durationSpinner).left();
            durationSpinner.getTextField().addListener(ibeamListener);
            durationSpinner.getButtonMinus().addListener(handListener);
            durationSpinner.getButtonPlus().addListener(handListener);
            durationSpinner.addListener(new TextTooltip("The animation duration of the ProgressBar as the value changes.", tooltipManager, skin, "scene"));
            durationSpinner.addListener(new ChangeListener() {

                @Override
                public void changed(ChangeEvent event, Actor actor) {
                    dialogSceneComposer.events.progressBarAnimationDuration((float) durationSpinner.getValue());
                }
            });
        }
    };
    popTableClickListener.update();
    return popTableClickListener;
}
Also used : InputListener(com.badlogic.gdx.scenes.scene2d.InputListener) PopTableClickListener(com.ray3k.stripe.PopTableClickListener) com.badlogic.gdx.scenes.scene2d.ui(com.badlogic.gdx.scenes.scene2d.ui) DialogSceneComposer(com.ray3k.skincomposer.dialog.scenecomposer.DialogSceneComposer) InputEvent(com.badlogic.gdx.scenes.scene2d.InputEvent) TEXT_FIELD_WIDTH(com.ray3k.skincomposer.dialog.scenecomposer.menulisteners.ListenersUtils.TEXT_FIELD_WIDTH) Spinner(com.ray3k.stripe.Spinner) Actor(com.badlogic.gdx.scenes.scene2d.Actor) DialogSceneComposerEvents(com.ray3k.skincomposer.dialog.scenecomposer.DialogSceneComposerEvents) DialogSceneComposerModel(com.ray3k.skincomposer.dialog.scenecomposer.DialogSceneComposerModel) SimActor(com.ray3k.skincomposer.dialog.scenecomposer.DialogSceneComposerModel.SimActor) ChangeListener(com.badlogic.gdx.scenes.scene2d.utils.ChangeListener) Keys(com.badlogic.gdx.Input.Keys) Main(com.ray3k.skincomposer.Main) Input(com.badlogic.gdx.Input) StyleData(com.ray3k.skincomposer.data.StyleData) DraggableTextList(com.ray3k.stripe.DraggableTextList) StyleSelectorPopTable(com.ray3k.skincomposer.dialog.scenecomposer.StyleSelectorPopTable) EventListener(com.badlogic.gdx.scenes.scene2d.EventListener) StyleSelectorPopTable(com.ray3k.skincomposer.dialog.scenecomposer.StyleSelectorPopTable) Spinner(com.ray3k.stripe.Spinner) PopTableClickListener(com.ray3k.stripe.PopTableClickListener) Actor(com.badlogic.gdx.scenes.scene2d.Actor) SimActor(com.ray3k.skincomposer.dialog.scenecomposer.DialogSceneComposerModel.SimActor) ChangeListener(com.badlogic.gdx.scenes.scene2d.utils.ChangeListener) InputEvent(com.badlogic.gdx.scenes.scene2d.InputEvent)

Aggregations

DialogSceneComposer (com.ray3k.skincomposer.dialog.scenecomposer.DialogSceneComposer)3 Input (com.badlogic.gdx.Input)2 Keys (com.badlogic.gdx.Input.Keys)2 Actor (com.badlogic.gdx.scenes.scene2d.Actor)2 EventListener (com.badlogic.gdx.scenes.scene2d.EventListener)2 InputEvent (com.badlogic.gdx.scenes.scene2d.InputEvent)2 InputListener (com.badlogic.gdx.scenes.scene2d.InputListener)2 com.badlogic.gdx.scenes.scene2d.ui (com.badlogic.gdx.scenes.scene2d.ui)2 ChangeListener (com.badlogic.gdx.scenes.scene2d.utils.ChangeListener)2 Main (com.ray3k.skincomposer.Main)2 StyleData (com.ray3k.skincomposer.data.StyleData)2 DialogSceneComposerEvents (com.ray3k.skincomposer.dialog.scenecomposer.DialogSceneComposerEvents)2 DialogSceneComposerModel (com.ray3k.skincomposer.dialog.scenecomposer.DialogSceneComposerModel)2 SimActor (com.ray3k.skincomposer.dialog.scenecomposer.DialogSceneComposerModel.SimActor)2 StyleSelectorPopTable (com.ray3k.skincomposer.dialog.scenecomposer.StyleSelectorPopTable)2 TEXT_FIELD_WIDTH (com.ray3k.skincomposer.dialog.scenecomposer.menulisteners.ListenersUtils.TEXT_FIELD_WIDTH)2 DraggableTextList (com.ray3k.stripe.DraggableTextList)2 PopTableClickListener (com.ray3k.stripe.PopTableClickListener)2 Spinner (com.ray3k.stripe.Spinner)2