Search in sources :

Example 1 with VisLabel

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();
}
Also used : VisTextButton(com.kotcrab.vis.ui.widget.VisTextButton) VisLabel(com.kotcrab.vis.ui.widget.VisLabel) Image(com.badlogic.gdx.scenes.scene2d.ui.Image)

Example 2 with VisLabel

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();
}
Also used : VisLabel(com.kotcrab.vis.ui.widget.VisLabel)

Example 3 with VisLabel

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);
}
Also used : KeyboardListener(games.rednblack.editor.event.KeyboardListener) VisLabel(com.kotcrab.vis.ui.widget.VisLabel) CheckBoxChangeListener(games.rednblack.editor.event.CheckBoxChangeListener)

Example 4 with VisLabel

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);
}
Also used : Vector2(com.badlogic.gdx.math.Vector2) VisLabel(com.kotcrab.vis.ui.widget.VisLabel)

Example 5 with VisLabel

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;
}
Also used : VisTable(com.kotcrab.vis.ui.widget.VisTable) TextureRegionDrawable(com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable) VisLabel(com.kotcrab.vis.ui.widget.VisLabel) ResourceManager(games.rednblack.editor.proxy.ResourceManager) Image(com.badlogic.gdx.scenes.scene2d.ui.Image)

Aggregations

VisLabel (com.kotcrab.vis.ui.widget.VisLabel)28 VisTable (com.kotcrab.vis.ui.widget.VisTable)10 Actor (com.badlogic.gdx.scenes.scene2d.Actor)4 ChangeListener (com.badlogic.gdx.scenes.scene2d.utils.ChangeListener)4 JsonValue (com.badlogic.gdx.utils.JsonValue)4 VisValidatableTextField (com.kotcrab.vis.ui.widget.VisValidatableTextField)4 HorizontalGroup (com.badlogic.gdx.scenes.scene2d.ui.HorizontalGroup)3 TextureRegionDrawable (com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable)3 VisTextButton (com.kotcrab.vis.ui.widget.VisTextButton)3 InputEvent (com.badlogic.gdx.scenes.scene2d.InputEvent)2 Image (com.badlogic.gdx.scenes.scene2d.ui.Image)2 ClickListener (com.badlogic.gdx.scenes.scene2d.utils.ClickListener)2 VisImageButton (com.kotcrab.vis.ui.widget.VisImageButton)2 Color (com.badlogic.gdx.graphics.Color)1 Batch (com.badlogic.gdx.graphics.g2d.Batch)1 TextureAtlas (com.badlogic.gdx.graphics.g2d.TextureAtlas)1 Vector2 (com.badlogic.gdx.math.Vector2)1 TextButton (com.badlogic.gdx.scenes.scene2d.ui.TextButton)1 BaseDrawable (com.badlogic.gdx.scenes.scene2d.utils.BaseDrawable)1 Drawable (com.badlogic.gdx.scenes.scene2d.utils.Drawable)1