use of com.kotcrab.vis.ui.widget.VisLabel in project HyperLap2D by rednblackgames.
the class ImportPanel method setDroppingView.
public void setDroppingView() {
mainTable.clear();
VisLabel helpLbl = new VisLabel("Supported file types: images, sprite animations (atlas or img sequence), spine animations, particle effects");
helpLbl.setWidth(260);
helpLbl.setWrap(true);
mainTable.add(helpLbl).width(260).padLeft(5);
mainTable.row().padBottom(5);
dropRegion = new Image(VisUI.getSkin().getDrawable("dropHere"));
mainTable.add(dropRegion).padRight(6).padBottom(6).padTop(10);
mainTable.row().pad(5);
mainTable.add(new VisLabel("or browse files on file system"));
mainTable.row().pad(5);
VisTextButton showFileSelectBtn = new VisTextButton("Browse");
mainTable.add(showFileSelectBtn).width(88);
mainTable.row().pad(5);
initDropListeners(showFileSelectBtn);
dragExit();
pack();
}
use of com.kotcrab.vis.ui.widget.VisLabel in project HyperLap2D by rednblackgames.
the class TagsPanel method setEmpty.
public void setEmpty() {
mainTable.clear();
VisLabel label = StandardWidgetsFactory.createLabel("No item selected");
label.setAlignment(Align.center);
mainTable.add(label).pad(10).width(278).center();
invalidateHeight();
}
use of com.kotcrab.vis.ui.widget.VisLabel in project HyperLap2D by rednblackgames.
the class UIGridBox method init.
private void init() {
addSeparator(true).padRight(13).padLeft(13);
lockLinesCheckBox = StandardWidgetsFactory.createCheckBox("Lock lines");
lockLinesCheckBox.addListener(new CheckBoxChangeListener(LOCK_LINES_CHECKBOX_FIELD_UPDATED));
add(lockLinesCheckBox);
addSeparator(true).padRight(13).padLeft(13);
VisLabel lbl = new VisLabel("Grid Size:");
add(lbl).padRight(4);
gridSizeTextField = StandardWidgetsFactory.createValidableTextField("light", new Validators.GreaterThanValidator(0));
gridSizeTextField.addListener(new KeyboardListener(GRID_SIZE_TEXT_FIELD_UPDATED));
gridSizeTextField.setAlignment(Align.center);
add(gridSizeTextField).width(30);
}
use of com.kotcrab.vis.ui.widget.VisLabel in project HyperLap2D by rednblackgames.
the class RulersUI method drawLines.
public void drawLines(float parentAlpha) {
tmpColor.set(LINE_COLOR);
tmpColor.a *= parentAlpha;
shapeDrawer.setColor(tmpColor);
// Static Lines for Aesthetics
shapeDrawer.line(horizontalRect.x + rulerBoxSize, horizontalRect.y, horizontalRect.x + horizontalRect.width, horizontalRect.y, 1f);
shapeDrawer.line(verticalRect.x + verticalRect.width + 1, verticalRect.y, verticalRect.x + verticalRect.width + 1, verticalRect.y + verticalRect.height - rulerBoxSize, 1f);
// Functional lines to show grid
Vector2 startPoint = tmp1.set(horizontalRect.x + rulerBoxSize, verticalRect.y);
Vector2 worldStartPoint = hereToWorld(startPoint);
worldStartPoint.x -= worldStartPoint.x % gridMeasuringSizeInWorld;
worldStartPoint.y -= worldStartPoint.y % gridMeasuringSizeInWorld;
Vector2 worldStartPointCpy = tmp2.set(worldStartPoint);
Vector2 gridCurrPoint = worldToHere(worldStartPoint);
String postFix = "";
if (isShowingPixels) {
postFix = "px";
worldStartPointCpy.x *= Sandbox.getInstance().getPixelPerWU();
worldStartPointCpy.y *= Sandbox.getInstance().getPixelPerWU();
}
float gridSize = gridMeasuringSize * gridMeasureToDisplayScale;
int iterator = 0;
while (gridCurrPoint.x < horizontalRect.x + horizontalRect.getWidth()) {
shapeDrawer.line(gridCurrPoint.x, horizontalRect.y, gridCurrPoint.x, horizontalRect.y + rulerBoxSize, 1f);
shapeDrawer.line(gridCurrPoint.x + gridSize / 2, horizontalRect.y, gridCurrPoint.x + gridSize / 2, horizontalRect.y + rulerBoxSize / 2f, 1f);
VisLabel label = Pools.obtain(VisLabel.class);
label.setPosition(gridCurrPoint.x + 2, horizontalRect.y + 7);
label.setColor(TEXT_COLOR);
label.setText((int) Math.abs(worldStartPointCpy.x + iterator * gridMeasuringSize) + postFix);
label.setWrap(false);
labels.add(label);
gridCurrPoint.x += gridSize;
iterator++;
}
iterator = 0;
while (gridCurrPoint.y < verticalRect.y + verticalRect.getHeight()) {
shapeDrawer.line(verticalRect.x + verticalRect.getWidth(), gridCurrPoint.y, verticalRect.x + verticalRect.getWidth() - rulerBoxSize, gridCurrPoint.y, 1f);
shapeDrawer.line(verticalRect.x + verticalRect.getWidth(), gridCurrPoint.y + gridSize / 2, verticalRect.x + verticalRect.getWidth() - rulerBoxSize / 2f, gridCurrPoint.y + gridSize / 2, 1f);
VisLabel label = Pools.obtain(VisLabel.class);
label.setColor(TEXT_COLOR);
int textNumber = (int) Math.abs(worldStartPointCpy.y + iterator * gridMeasuringSize);
labelTextCache.putIfAbsent(textNumber, "");
String lblText = labelTextCache.get(textNumber);
if (lblText.equals("")) {
lblText = verticalize(textNumber + "");
labelTextCache.put(textNumber, lblText);
}
label.setText(lblText);
label.setWrap(true);
label.setPosition(verticalRect.x + 3, gridCurrPoint.y - label.getPrefHeight() / 2);
labels.add(label);
gridCurrPoint.y += gridSize;
iterator++;
}
drawGuides(parentAlpha);
}
use of com.kotcrab.vis.ui.widget.VisLabel in project HyperLap2D by rednblackgames.
the class ResourceListAdapter method createView.
@Override
protected VisTable createView(String item) {
ResourceManager rm = HyperLap2DFacade.getInstance().retrieveProxy(ResourceManager.NAME);
VisTable table = new VisTable();
table.left();
Image icon = new Image(new TextureRegionDrawable(rm.getTextureRegion(item)), Scaling.contain, Align.center);
table.add(icon).width(45).height(45);
table.add(new VisLabel(item)).padLeft(10).row();
return table;
}
Aggregations