Search in sources :

Example 1 with VisTextButton

use of com.kotcrab.vis.ui.widget.VisTextButton 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 VisTextButton

use of com.kotcrab.vis.ui.widget.VisTextButton in project HyperLap2D by rednblackgames.

the class TagsPanel method updateView.

public void updateView() {
    mainTable.clear();
    tagTable = new VisTable();
    VisTable inputTable = new VisTable();
    List<String> sorted = new LinkedList<>(tags);
    Collections.sort(sorted);
    for (String tag : sorted) {
        tagTable.add(new TagItem(tag, tagItemListener)).pad(5).left().expandX().fillX();
        tagTable.row();
    }
    VisTextField newTagField = StandardWidgetsFactory.createTextField();
    VisTextButton createTagBtn = new VisTextButton("add");
    inputTable.add(newTagField).width(200);
    inputTable.add(createTagBtn).padLeft(5);
    createTagBtn.addListener(new ClickListener() {

        @Override
        public void clicked(InputEvent event, float x, float y) {
            String tag = newTagField.getText();
            if (!tagExists(tag)) {
                newTagField.setText("");
                addTag(tag);
                facade.sendNotification(ITEM_ADD, tag);
            }
        }
    });
    mainTable.add(inputTable);
    mainTable.row();
    mainTable.add(tagTable).expandX().fillX();
    invalidateHeight();
}
Also used : VisTextField(com.kotcrab.vis.ui.widget.VisTextField) VisTextButton(com.kotcrab.vis.ui.widget.VisTextButton) VisTable(com.kotcrab.vis.ui.widget.VisTable) InputEvent(com.badlogic.gdx.scenes.scene2d.InputEvent) ClickListener(com.badlogic.gdx.scenes.scene2d.utils.ClickListener)

Example 3 with VisTextButton

use of com.kotcrab.vis.ui.widget.VisTextButton in project HyperLap2D by rednblackgames.

the class AlternativeAutoTileDialog method initView.

/**
 * Initiates the view of the dialog.
 */
public void initView() {
    clear();
    String[] allAutoTileVOArray = new String[tiledPlugin.dataToSave.getAutoTiles().size];
    int index = 0;
    // add a "none" to the drop down list
    allAutoTileVOArray[index++] = "";
    for (int i = 0; i < tiledPlugin.dataToSave.getAutoTiles().size; i++) {
        AutoTileVO next = tiledPlugin.dataToSave.getAutoTiles().get(i);
        if (!openingAutoTileVO.equals(next)) {
            allAutoTileVOArray[index++] = next.regionName;
        }
    }
    alternativeSelectBoxArray = new VisSelectBox[allAutoTileVOArray.length - 1];
    alternativePercentTextFieldArray = new VisValidatableTextField[allAutoTileVOArray.length + 0];
    VisTable table = new VisTable();
    table.row().padTop(20);
    table.add(getVisImageButton(openingAutoTileVO.regionName)).maxHeight(32);
    // .width(115);
    table.add(StandardWidgetsFactory.createLabel(openingAutoTileVO.regionName, Align.left)).padLeft(5).left();
    alternativePercentTextFieldArray[0] = StandardWidgetsFactory.createValidableTextField(new FloatValidator());
    alternativePercentTextFieldArray[0].setText(openingAutoTileVO.alternativeAutoTileList.get(0, new AlternativeAutoTileVO()).percent.toString());
    table.add(alternativePercentTextFieldArray[0]).padLeft(5).padRight(5).fillX().left();
    table.row();
    for (int i = 0; i < allAutoTileVOArray.length - 1; i++) {
        String region = openingAutoTileVO.alternativeAutoTileList.get(i + 1, new AlternativeAutoTileVO()).region;
        VisImageButton imgButton = getVisImageButton(region);
        table.add(imgButton).maxHeight(32);
        alternativeSelectBoxArray[i] = StandardWidgetsFactory.createSelectBox(String.class);
        alternativeSelectBoxArray[i].setItems(allAutoTileVOArray);
        alternativeSelectBoxArray[i].setSelected(openingAutoTileVO.alternativeAutoTileList.get(i + 1, new AlternativeAutoTileVO()).region);
        alternativeSelectBoxArray[i].addListener(new ChangeListener() {

            @Override
            public void changed(ChangeEvent event, Actor actor) {
                updateVisImageButton(imgButton, ((SelectBox<String>) actor).getSelected());
                pack();
            }
        });
        table.add(alternativeSelectBoxArray[i]).padLeft(5).left();
        alternativePercentTextFieldArray[i + 1] = StandardWidgetsFactory.createValidableTextField(new FloatValidator());
        alternativePercentTextFieldArray[i + 1].setText(openingAutoTileVO.alternativeAutoTileList.get(i + 1, new AlternativeAutoTileVO()).percent.toString());
        table.add(alternativePercentTextFieldArray[i + 1]).padLeft(5).padRight(5).fillX().left();
        table.row().padTop(5).padBottom(5);
    }
    VisTextButton saveButton = StandardWidgetsFactory.createTextButton("Save");
    saveButton.addListener(new ClickListener() {

        @Override
        public void touchUp(InputEvent event, float x, float y, int pointer, int button) {
            super.touchUp(event, x, y, pointer, button);
            tiledPlugin.facade.sendNotification(TiledPlugin.ACTION_SAVE_ALTERNATIVES_AUTO_TILE);
            hide();
        }
    });
    VisTextButton cancelButton = StandardWidgetsFactory.createTextButton("Cancel");
    cancelButton.addListener(new ClickListener() {

        @Override
        public void touchUp(InputEvent event, float x, float y, int pointer, int button) {
            super.touchUp(event, x, y, pointer, button);
            hide();
        }
    });
    row();
    add(table);
    row();
    add(saveButton).center().padLeft(5).padRight(5);
    add(cancelButton).center().padLeft(5).padRight(5);
    row();
    pack();
}
Also used : VisImageButton(com.kotcrab.vis.ui.widget.VisImageButton) VisTextButton(com.kotcrab.vis.ui.widget.VisTextButton) SelectBox(com.badlogic.gdx.scenes.scene2d.ui.SelectBox) VisSelectBox(com.kotcrab.vis.ui.widget.VisSelectBox) AlternativeAutoTileVO(games.rednblack.editor.plugin.tiled.data.AlternativeAutoTileVO) AlternativeAutoTileVO(games.rednblack.editor.plugin.tiled.data.AlternativeAutoTileVO) AutoTileVO(games.rednblack.editor.plugin.tiled.data.AutoTileVO) VisTable(com.kotcrab.vis.ui.widget.VisTable) Actor(com.badlogic.gdx.scenes.scene2d.Actor) ChangeListener(com.badlogic.gdx.scenes.scene2d.utils.ChangeListener) FloatValidator(com.kotcrab.vis.ui.util.Validators.FloatValidator) InputEvent(com.badlogic.gdx.scenes.scene2d.InputEvent) ClickListener(com.badlogic.gdx.scenes.scene2d.utils.ClickListener)

Example 4 with VisTextButton

use of com.kotcrab.vis.ui.widget.VisTextButton in project HyperLap2D by rednblackgames.

the class OffsetPanel method initView.

private void initView() {
    offsetAttributeX = new AttributeVO(TILE_OFFSET_X, true);
    offsetAttributeY = new AttributeVO(TILE_OFFSET_Y, true);
    Array<AttributeVO> attributeVOs = new Array<>();
    attributeVOs.add(offsetAttributeX);
    attributeVOs.add(offsetAttributeY);
    offsetCategory = new Category(new CategoryVO("", attributeVOs));
    mainTable.add(offsetCategory).pad(7).row();
    VisTextButton addButton = new VisTextButton("Set");
    addButton.addListener(new ClickListener() {

        @Override
        public void clicked(InputEvent event, float x, float y) {
            Vector2 offset = new Vector2(offsetAttributeX.value, offsetAttributeY.value);
            tiledPlugin.facade.sendNotification(TiledPlugin.TILE_GRID_OFFSET_ADDED, offset);
            super.clicked(event, x, y);
        }
    });
    mainTable.add(addButton);
}
Also used : Array(com.badlogic.gdx.utils.Array) VisTextButton(com.kotcrab.vis.ui.widget.VisTextButton) Category(games.rednblack.editor.plugin.tiled.view.Category) AttributeVO(games.rednblack.editor.plugin.tiled.data.AttributeVO) Vector2(com.badlogic.gdx.math.Vector2) InputEvent(com.badlogic.gdx.scenes.scene2d.InputEvent) CategoryVO(games.rednblack.editor.plugin.tiled.data.CategoryVO) ClickListener(com.badlogic.gdx.scenes.scene2d.utils.ClickListener)

Example 5 with VisTextButton

use of com.kotcrab.vis.ui.widget.VisTextButton in project HyperLap2D by rednblackgames.

the class SettingsTab method initView.

@Override
public void initView() {
    Array<AttributeVO> gridAttributes = new Array<>();
    gridAttributes.add(new AttributeVO("Width", currentParameters.gridWidth));
    gridAttributes.add(new AttributeVO("Height", currentParameters.gridHeight));
    CategoryVO gridVO = new CategoryVO("Grid size: ", gridAttributes);
    grid = new Category(gridVO);
    content.add(grid).expandX().colspan(2).padTop(10).left().top().row();
    panel.tiledPlugin.dataToSave.setParameterVO(currentParameters);
    VisTextButton okBtn = new VisTextButton("Save");
    content.add(okBtn).width(70).pad(20).colspan(2).expandX().center().bottom().row();
    okBtn.addListener(new ClickListener() {

        @Override
        public void clicked(InputEvent event, float x, float y) {
            super.clicked(event, x, y);
            currentParameters.gridWidth = grid.getAttributeVO("Width: ").value;
            currentParameters.gridHeight = grid.getAttributeVO("Height: ").value;
            panel.getFacade().sendNotification(OK_BTN_CLICKED, currentParameters);
        }
    });
}
Also used : Array(com.badlogic.gdx.utils.Array) VisTextButton(com.kotcrab.vis.ui.widget.VisTextButton) Category(games.rednblack.editor.plugin.tiled.view.Category) AttributeVO(games.rednblack.editor.plugin.tiled.data.AttributeVO) InputEvent(com.badlogic.gdx.scenes.scene2d.InputEvent) CategoryVO(games.rednblack.editor.plugin.tiled.data.CategoryVO) ClickListener(com.badlogic.gdx.scenes.scene2d.utils.ClickListener)

Aggregations

VisTextButton (com.kotcrab.vis.ui.widget.VisTextButton)12 InputEvent (com.badlogic.gdx.scenes.scene2d.InputEvent)8 ClickListener (com.badlogic.gdx.scenes.scene2d.utils.ClickListener)8 VisLabel (com.kotcrab.vis.ui.widget.VisLabel)3 TextureAtlas (com.badlogic.gdx.graphics.g2d.TextureAtlas)2 Actor (com.badlogic.gdx.scenes.scene2d.Actor)2 ChangeListener (com.badlogic.gdx.scenes.scene2d.utils.ChangeListener)2 Array (com.badlogic.gdx.utils.Array)2 VisTable (com.kotcrab.vis.ui.widget.VisTable)2 AttributeVO (games.rednblack.editor.plugin.tiled.data.AttributeVO)2 CategoryVO (games.rednblack.editor.plugin.tiled.data.CategoryVO)2 Category (games.rednblack.editor.plugin.tiled.view.Category)2 InputMultiplexer (com.badlogic.gdx.InputMultiplexer)1 OrthographicCamera (com.badlogic.gdx.graphics.OrthographicCamera)1 Texture (com.badlogic.gdx.graphics.Texture)1 SpriteBatch (com.badlogic.gdx.graphics.g2d.SpriteBatch)1 TextureRegion (com.badlogic.gdx.graphics.g2d.TextureRegion)1 ShapeRenderer (com.badlogic.gdx.graphics.glutils.ShapeRenderer)1 Vector2 (com.badlogic.gdx.math.Vector2)1 Stage (com.badlogic.gdx.scenes.scene2d.Stage)1