use of com.kotcrab.vis.ui.widget.VisTextButton in project HyperLap2D by rednblackgames.
the class ArrayActionBoxProducer method addPart.
private void addPart(Skin skin, GraphBoxImpl<ActionFieldType> graphBox) {
Map<String, GraphNodeInput<ActionFieldType>> inputs = graphBox.getConfiguration().getNodeInputs();
VisTextButton addButton = StandardWidgetsFactory.createTextButton("+ Add Pin");
VisTextButton removeButton = StandardWidgetsFactory.createTextButton("- Remove Pin");
removeButton.setDisabled(inputs.size() <= 2);
addButton.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
addPin(skin, graphBox);
addButton.fire(new GraphChangedEvent(true, false));
if (inputs.size() > 2) {
removeButton.setDisabled(false);
}
}
});
addButton.addListener(new ClickListener() {
@Override
public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
event.cancel();
return true;
}
});
GraphBoxPartImpl<ActionFieldType> addPart = new GraphBoxPartImpl<>(addButton, null);
graphBox.addHeaderGraphBoxPart(addPart);
removeButton.addListener(new ClickListener() {
@Override
public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
event.cancel();
return true;
}
});
removeButton.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
Map<String, GraphNodeInput<ActionFieldType>> inputs = graphBox.getConfiguration().getNodeInputs();
GraphNodeInput<ActionFieldType> n = inputs.get("action" + (inputs.size() - 1));
inputs.remove(n.getFieldId());
graphBox.removeGraphBoxPart(inputs.size());
graphBox.invalidate();
addButton.fire(new GraphChangedEvent(true, false));
if (inputs.size() == 2) {
removeButton.setDisabled(true);
}
}
});
GraphBoxPartImpl<ActionFieldType> removePart = new GraphBoxPartImpl<>(removeButton, null);
graphBox.addFooterGraphBoxPart(removePart);
graphBox.setSerializeCallback(object -> {
object.put("pins", String.valueOf(inputs.size()));
});
}
use of com.kotcrab.vis.ui.widget.VisTextButton in project vis-ui by kotcrab.
the class ColorPicker method createButtons.
private VisTable createButtons() {
ButtonBar buttonBar = new ButtonBar();
buttonBar.setIgnoreSpacing(true);
buttonBar.setButton(ButtonType.LEFT, restoreButton = new VisTextButton(RESTORE.get()));
buttonBar.setButton(ButtonType.OK, okButton = new VisTextButton(OK.get()));
buttonBar.setButton(ButtonType.CANCEL, cancelButton = new VisTextButton(CANCEL.get()));
return buttonBar.createTable();
}
use of com.kotcrab.vis.ui.widget.VisTextButton in project talos by rockbite.
the class ParticleControlTest method create.
@Override
public void create() {
orthographicCamera = new OrthographicCamera();
float width = 2000f;
float aspect = (float) Gdx.graphics.getWidth() / (float) Gdx.graphics.getHeight();
orthographicCamera.setToOrtho(false, width, width / aspect);
shapeRenderer = new ShapeRenderer();
batch = new SpriteBatch();
particleRenderer = new SpriteBatchParticleRenderer(batch);
cameraController = new CameraController(orthographicCamera);
ParticleEffectDescriptor descriptor = new ParticleEffectDescriptor();
TextureAtlas atlas = new TextureAtlas();
atlas.addRegion("fire", new TextureRegion(new TextureRegion(new Texture(Gdx.files.internal("fire.png")))));
descriptor.setAssetProvider(new TestAssetProvider(atlas));
descriptor.load(Gdx.files.internal("test.p"));
particleEffectInstance = descriptor.createEffectInstance();
particleEffectInstance.loopable = true;
stage = new Stage();
VisUI.load();
VisTextButton start = new VisTextButton("Start/Resume");
VisTextButton pause = new VisTextButton("Pause");
VisTextButton restart = new VisTextButton("Restart");
VisTextButton allowCompletion = new VisTextButton("Allow Completion");
start.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
particleEffectInstance.resume();
}
});
pause.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
particleEffectInstance.pause();
}
});
restart.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
particleEffectInstance.restart();
}
});
allowCompletion.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
particleEffectInstance.allowCompletion();
}
});
Table table = new Table();
table.setFillParent(true);
table.defaults().pad(10).top().left();
table.top().left();
table.add(start);
table.row();
table.add(pause);
table.row();
table.add(restart);
table.row();
table.add(allowCompletion);
stage.addActor(table);
Gdx.input.setInputProcessor(new InputMultiplexer(stage, cameraController));
}
use of com.kotcrab.vis.ui.widget.VisTextButton in project HyperLap2D by rednblackgames.
the class UIPolygonComponentProperties method initView.
public void initView() {
mainTable.clear();
verticesCountLbl = new VisLabel("", Align.left);
copyBtn = new VisTextButton("Copy");
pasteBtn = new VisTextButton("Paste");
openEndedCheckbox = StandardWidgetsFactory.createCheckBox("Open Ended");
mainTable.add(new VisLabel("Vertices: ", Align.left)).left().padRight(3);
mainTable.add(verticesCountLbl).left().width(67);
mainTable.add(copyBtn).right().padRight(4);
mainTable.add(pasteBtn).right().padRight(4);
mainTable.row();
mainTable.add(openEndedCheckbox).left().colspan(4).padTop(5).row();
initListeners();
}
use of com.kotcrab.vis.ui.widget.VisTextButton in project HyperLap2D by rednblackgames.
the class MainPanel method initPreView.
private void initPreView() {
previewTable.clear();
previewWidget = new PreviewWidget();
previewWidget.setHeight(205);
previewTable.add(previewWidget).width(200).height(205).top();
previewTable.row();
previewWidget.update((TextureAtlas.AtlasRegion) texture, ((TextureAtlas.AtlasRegion) texture).findValue("split"));
VisLabel label = new VisLabel("Note: after saving, your \n scene will reload to \n apply changes.");
label.setAlignment(Align.center);
previewTable.add(label).pad(10).fillY().expandY();
previewTable.row();
VisTextButton saveBtn = new VisTextButton("apply and save");
previewTable.add(saveBtn).pad(5);
previewTable.row();
saveBtn.addListener(new ClickListener() {
public void clicked(InputEvent event, float x, float y) {
facade.sendNotification(SAVE_CLICKED);
}
});
}
Aggregations