use of com.kotcrab.vis.ui.widget.color.ColorPickerAdapter in project talos by rockbite.
the class ColorPropertyWidget method getSubWidget.
@Override
public Actor getSubWidget() {
Skin skin = TalosMain.Instance().getSkin();
box = new Image(skin.newDrawable(ColorLibrary.SHAPE_SQUARE));
box.setSize(20, 20);
box.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
TalosMain.Instance().UIStage().showColorPicker(new ColorPickerAdapter() {
@Override
public void changed(Color newColor) {
super.changed(newColor);
box.setColor(newColor);
callValueChanged(box.getColor());
}
});
}
});
return box;
}
use of com.kotcrab.vis.ui.widget.color.ColorPickerAdapter in project talos by rockbite.
the class GradientColorModuleWrapper method configureSlots.
@Override
protected void configureSlots() {
addInputSlot("alpha (0 to 1)", InterpolationModule.ALPHA);
addOutputSlot("output", 0);
gradientWidget = new GradientWidget(getSkin());
contentWrapper.add(gradientWidget).expandX().fillX().growX().height(60).padTop(25).padRight(3).padBottom(3);
leftWrapper.add(new Table()).expandY();
rightWrapper.add(new Table()).expandY();
picker = new ColorPicker();
gradientWidget.setListener(new GradientWidget.GradientWidgetListener() {
@Override
public void colorPickerShow(final ColorPoint point) {
picker.setListener(null);
picker.setColor(point.color);
TalosMain.Instance().UIStage().getStage().addActor(picker.fadeIn());
picker.setListener(new ColorPickerAdapter() {
@Override
public void changed(Color newColor) {
super.changed(newColor);
point.color.set(newColor);
gradientWidget.updateGradientData();
}
});
}
});
picker.padTop(32);
picker.padLeft(16);
picker.setHeight(330);
picker.setWidth(430);
picker.padRight(26);
}
use of com.kotcrab.vis.ui.widget.color.ColorPickerAdapter in project talos by rockbite.
the class ColorModuleWrapper method configureSlots.
@Override
protected void configureSlots() {
rField = addInputSlotWithTextField("R: ", 0, 40);
gField = addInputSlotWithTextField("G: ", 1, 40);
bField = addInputSlotWithTextField("B: ", 2, 40);
rField.setText("255");
gField.setText("0");
bField.setText("0");
rField.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
float r = floatFromText(rField);
module.setR(r / 255f);
update();
}
});
gField.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
float g = floatFromText(gField);
module.setG(g / 255f);
update();
}
});
bField.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
float b = floatFromText(bField);
module.setB(b / 255f);
update();
}
});
addOutputSlot("position", 0);
picker = new ColorPicker(new ColorPickerAdapter() {
@Override
public void changed(Color newColor) {
if (colorBtn != null) {
colorBtn.setColor(newColor);
rField.setText("" + (int) (newColor.r * 255f));
gField.setText("" + (int) (newColor.g * 255f));
bField.setText("" + (int) (newColor.b * 255f));
module.setR(newColor.r);
module.setG(newColor.g);
module.setB(newColor.b);
}
}
});
// create color picker Btn
colorBtn = new Image(getSkin().getDrawable("white"));
contentWrapper.add(colorBtn).width(50).height(50).right().padLeft(26);
colorBtn.setColor(1f, 0, 0, 1f);
colorBtn.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
super.clicked(event, x, y);
TalosMain.Instance().UIStage().getStage().addActor(picker.fadeIn());
}
});
picker.padTop(32);
picker.padLeft(16);
picker.setHeight(330);
picker.setWidth(430);
picker.padRight(26);
}
use of com.kotcrab.vis.ui.widget.color.ColorPickerAdapter in project talos by rockbite.
the class NodeGroup method init.
public void init(Skin skin) {
this.skin = skin;
frameImage = new Image(skin.getDrawable("group_frame"));
frameImage.setColor(44 / 255f, 140 / 255f, 209 / 255f, 1f);
addActor(frameImage);
topHit = new Actor();
topHit.setTouchable(Touchable.enabled);
addActor(topHit);
title = new EditableLabel("GROUP NAME", skin);
addActor(title);
settings = new ImageButton(skin, "settings");
settings.setSize(25, 25);
addActor(settings);
settings.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
final Vector2 vec = new Vector2(Gdx.input.getX(), Gdx.input.getY());
(TalosMain.Instance().UIStage().getStage().getViewport()).unproject(vec);
settingsPopup.showMenu(TalosMain.Instance().UIStage().getStage(), vec.x, vec.y);
}
});
settingsPopup = new PopupMenu();
MenuItem changeColorMenuItem = new MenuItem("Change Color");
MenuItem ungroupMenuItem = new MenuItem("Ungroup");
settingsPopup.addItem(changeColorMenuItem);
settingsPopup.addItem(ungroupMenuItem);
changeColorMenuItem.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
TalosMain.Instance().UIStage().showColorPicker(new ColorPickerAdapter() {
@Override
public void changed(Color newColor) {
super.changed(newColor);
frameImage.setColor(newColor);
}
});
}
});
ungroupMenuItem.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
super.clicked(event, x, y);
nodeBoard.removeGroup(NodeGroup.this);
}
});
topHit.addListener(new ClickListener() {
Vector2 tmp = new Vector2();
Vector2 pos = new Vector2();
Vector2 diff = new Vector2();
@Override
public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
pos.set(x, y);
topHit.localToStageCoordinates(pos);
nodeBoard.setSelectedNodes(nodes);
return true;
}
@Override
public void touchDragged(InputEvent event, float x, float y, int pointer) {
tmp.set(x, y);
topHit.localToStageCoordinates(tmp);
diff.set(tmp).sub(pos);
moveGroupBy(diff.x, diff.y);
pos.set(tmp);
super.touchDragged(event, x, y, pointer);
}
@Override
public void touchUp(InputEvent event, float x, float y, int pointer, int button) {
event.cancel();
}
});
setTouchable(Touchable.childrenOnly);
frameImage.setTouchable(Touchable.disabled);
}
use of com.kotcrab.vis.ui.widget.color.ColorPickerAdapter in project talos by rockbite.
the class ColorWidget method init.
@Override
public void init(Skin skin) {
super.init(skin);
Label label = new Label("Color", skin);
colorButton = new Table();
colorButton.setBackground(skin.newDrawable(ColorLibrary.SHAPE_SQUIRCLE));
content.add(label).left().expandX().height(32);
content.add(colorButton).right().expandX().height(32).width(96);
color.set(Color.CORAL);
colorButton.setColor(color);
colorButton.setTouchable(Touchable.enabled);
colorButton.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
TalosMain.Instance().UIStage().showColorPicker(new ColorPickerAdapter() {
@Override
public void changed(Color newColor) {
super.changed(newColor);
color.set(newColor);
colorButton.setColor(newColor);
fireChangedEvent();
}
});
}
});
}
Aggregations