use of com.kotcrab.vis.ui.layout.HorizontalFlowGroup in project Eidolons by IDemiurge.
the class EmitterPalette method init.
public void init() {
clear();
setSize(GdxMaster.getWidth() - 300, 256);
// int columns = (int) (getWidth() / 64);
defaults().padLeft(200).top().right().width(GdxMaster.getWidth() - 300);
Map<String, List<File>> presets = new LinkedHashMap<>();
List<File> subfolders = FileManager.getFilesFromDirectory(PathFinder.getSfxPath(), true);
subfolders.forEach(file -> {
if (!file.isDirectory()) {
MapMaster.addToListMap(presets, "main", file);
} else
presets.put(file.getName(), FileManager.getFilesFromDirectory(file.getPath(), false));
});
LabelStyle style = StyleHolder.getSizedLabelStyle(FONT.MAIN, 15);
for (String sub : presets.keySet()) {
HorizontalFlowGroup table = new HorizontalFlowGroup(0);
table.setWidth(getWidth() - 100);
boolean bg = presets.get(sub).size() < 55;
for (File preset : presets.get(sub)) {
// textButton?
ValueContainer label = new ValueContainer(new Label(preset.getName(), style));
NinePatch patch = NinePatchFactory.getTooltip();
patch.scale(0.7f, 0.7f);
if (bg)
label.setBackground(new NinePatchDrawable(patch));
label.addListener(new ClickListener() {
@Override
public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
if (Gdx.input.isKeyPressed(Keys.SHIFT_LEFT)) {
// EmitterMaster.
}
EditorManager.setMode(MAP_EDITOR_MOUSE_MODE.EMITTER);
if (selectedLabel != null)
selectedLabel.setColor(1, 1, 1, 1);
if (sub.equals("main"))
selected = preset.getName();
else
selected = StrPathBuilder.build(sub, preset.getName());
selectedLabel = label;
label.setColor(1, 0.3f, 0.8f, 1);
return super.touchDown(event, x, y, pointer, button);
}
});
table.addActor(label);
}
addTab(table, sub);
}
}
use of com.kotcrab.vis.ui.layout.HorizontalFlowGroup in project Eidolons by IDemiurge.
the class MapResourcesPanel method addResGroup.
private void addResGroup(MAP_RESOURCE[] resourceGroup) {
HorizontalFlowGroup group = new HorizontalFlowGroup(5);
group.setWidth(GdxMaster.adjustSize(WIDTH));
for (MAP_RESOURCE sub : resourceGroup) {
MapResourcePanel res = new MapResourcePanel(sub);
group.addActor(res);
elements.add(res);
}
add(group).center();
}
Aggregations