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;
}
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);
}
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;
}
Aggregations