Search in sources :

Example 16 with VisImageButton

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

the class AbstractGridTilesTab method initView.

@Override
public void initView() {
    if (isDrop = savedTiles.size == 0) {
        VisImageButton.VisImageButtonStyle dropBoxStyle = new VisImageButton.VisImageButtonStyle();
        dropBoxStyle.up = new TextureRegionDrawable(resourcesManager.getTextureRegion("tiles-drop-here-normal", -1));
        dropBoxStyle.imageOver = new TextureRegionDrawable(resourcesManager.getTextureRegion("tiles-drop-here-over", -1));
        VisImageButton dropRegion = new VisImageButton(dropBoxStyle);
        content.clear();
        content.add(dropRegion).center().padRight(6).padBottom(6).padTop(10).row();
        content.add(new VisLabel("Drop an image from resources box")).expandX().center().padBottom(5);
        content.pack();
    } else {
        if (tileIndex > tilesCount) {
            tilesCount = tileIndex;
        }
        initTiles();
    }
}
Also used : VisImageButton(com.kotcrab.vis.ui.widget.VisImageButton) TextureRegionDrawable(com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable) VisLabel(com.kotcrab.vis.ui.widget.VisLabel)

Example 17 with VisImageButton

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

the class AbstractGridTilesTab method initTiles.

private void initTiles(String tileName, int type) {
    content.clear();
    tiles.clear();
    VisTable listTable = new VisTable();
    pane = StandardWidgetsFactory.createScrollPane(listTable);
    pane.setScrollingDisabled(true, false);
    content.add(pane).padTop(10);
    listTable.top();
    if (tileIndex >= tilesCount && !tileName.equals("")) {
        tilesCount = tileIndex + 1;
    }
    for (int i = 0; i < tilesCount + 1; i++) {
        VisImageButton ct;
        VisImageButton.VisImageButtonStyle imageBoxStyle = new VisImageButton.VisImageButtonStyle();
        NinePatchDrawable inactive = new NinePatchDrawable(new NinePatch(resourcesManager.getPluginNinePatch("image-Box-inactive")));
        NinePatchDrawable active = new NinePatchDrawable(new NinePatch(resourcesManager.getPluginNinePatch("image-Box-active")));
        imageBoxStyle.up = inactive;
        imageBoxStyle.down = active;
        imageBoxStyle.checked = active;
        imageBoxStyle.over = active;
        Drawable tileDrawable = null;
        if (i < savedTiles.size) {
            int t = savedTiles.get(i).getEntityType();
            if (t == SpineItemType.SPINE_TYPE) {
                tileDrawable = resourcesManager.getSpineDrawable(savedTiles.get(i).getRegionName());
            } else {
                tileDrawable = new TextureRegionDrawable(resourcesManager.getTextureRegion(savedTiles.get(i).getRegionName(), t));
            }
        } else if (!tileName.equals("")) {
            if (i == tileIndex) {
                if (type == SpineItemType.SPINE_TYPE) {
                    tileDrawable = resourcesManager.getSpineDrawable(tileName);
                } else {
                    tileDrawable = new TextureRegionDrawable(resourcesManager.getTextureRegion(tileName, type));
                }
            }
        }
        imageBoxStyle.imageUp = tileDrawable;
        imageBoxStyle.imageDown = tileDrawable;
        imageBoxStyle.imageChecked = tileDrawable;
        imageBoxStyle.imageOver = tileDrawable;
        ct = new VisImageButton(imageBoxStyle);
        if (i < savedTiles.size) {
            ct.setUserObject(savedTiles.get(i).getRegionName());
        }
        int index = i;
        ct.addListener(getGridTabInputListener(index));
        listTable.add(ct).width(40).height(40).pad(3);
        if ((i + 1) % 4 == 0) {
            listTable.row();
        }
        tiles.add(ct);
    }
    content.pack();
}
Also used : VisImageButton(com.kotcrab.vis.ui.widget.VisImageButton) VisTable(com.kotcrab.vis.ui.widget.VisTable) NinePatch(com.badlogic.gdx.graphics.g2d.NinePatch) TextureRegionDrawable(com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable) Drawable(com.badlogic.gdx.scenes.scene2d.utils.Drawable) SpineDrawable(games.rednblack.editor.plugin.tiled.view.SpineDrawable) NinePatchDrawable(com.badlogic.gdx.scenes.scene2d.utils.NinePatchDrawable) TextureRegionDrawable(com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable) NinePatchDrawable(com.badlogic.gdx.scenes.scene2d.utils.NinePatchDrawable)

Example 18 with VisImageButton

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

the class UIToolBox method createButton.

private VisImageButton createButton(String styleName, String toolId) {
    VisImageButton visImageButton = new VisImageButton(styleName);
    toolsButtonGroup.add(visImageButton);
    visImageButton.addListener(new ToolboxButtonClickListener(toolId));
    return visImageButton;
}
Also used : VisImageButton(com.kotcrab.vis.ui.widget.VisImageButton)

Example 19 with VisImageButton

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

the class UIToolBox method addToolButton.

public void addToolButton(String name, Tool tool) {
    VisImageButton button = createButton("tool-" + name, name);
    String toolTip = tool.getTitle() + (tool.getShortcut() != null ? " (" + tool.getShortcut() + ")" : "");
    StandardWidgetsFactory.addTooltip(button, toolTip);
    buttonMap.put(name, button);
    add(button).width(31).height(31).row();
}
Also used : VisImageButton(com.kotcrab.vis.ui.widget.VisImageButton)

Example 20 with VisImageButton

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

the class UIResolutionBox method init.

private void init() {
    addSeparator(true).padRight(13).padLeft(13);
    VisImageButton.VisImageButtonStyle visImageButtonStyle = new VisImageButton.VisImageButtonStyle(skin.get("dark", VisImageButton.VisImageButtonStyle.class));
    visImageButtonStyle.imageUp = skin.getDrawable("icon-trash");
    visImageButtonStyle.imageOver = skin.getDrawable("icon-trash-over");
    visImageButtonStyle.imageDisabled = skin.getDrawable("icon-trash-disabled");
    deleteBtn = new VisImageButton("dark");
    deleteBtn.setStyle(visImageButtonStyle);
    deleteBtn.addListener(new UIResolutionBoxButtonClickListener(DELETE_RESOLUTION_BTN_CLICKED));
    visSelectBox = StandardWidgetsFactory.createSelectBox(ResolutionEntryVO.class);
    visSelectBox.addListener(new ResolutionChangeListener());
    add("Resolution:").padRight(4);
    add(visSelectBox).padRight(11).width(156);
    add(deleteBtn).height(25);
}
Also used : VisImageButton(com.kotcrab.vis.ui.widget.VisImageButton) ResolutionEntryVO(games.rednblack.editor.renderer.data.ResolutionEntryVO)

Aggregations

VisImageButton (com.kotcrab.vis.ui.widget.VisImageButton)21 InputEvent (com.badlogic.gdx.scenes.scene2d.InputEvent)7 ClickListener (com.badlogic.gdx.scenes.scene2d.utils.ClickListener)7 VisTable (com.kotcrab.vis.ui.widget.VisTable)6 Actor (com.badlogic.gdx.scenes.scene2d.Actor)5 ChangeListener (com.badlogic.gdx.scenes.scene2d.utils.ChangeListener)4 Drawable (com.badlogic.gdx.scenes.scene2d.utils.Drawable)4 TextureRegionDrawable (com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable)4 VisLabel (com.kotcrab.vis.ui.widget.VisLabel)2 NinePatch (com.badlogic.gdx.graphics.g2d.NinePatch)1 Vector2 (com.badlogic.gdx.math.Vector2)1 Touchable (com.badlogic.gdx.scenes.scene2d.Touchable)1 Image (com.badlogic.gdx.scenes.scene2d.ui.Image)1 SelectBox (com.badlogic.gdx.scenes.scene2d.ui.SelectBox)1 Table (com.badlogic.gdx.scenes.scene2d.ui.Table)1 NinePatchDrawable (com.badlogic.gdx.scenes.scene2d.utils.NinePatchDrawable)1 VisUI (com.kotcrab.vis.ui.VisUI)1 FloatValidator (com.kotcrab.vis.ui.util.Validators.FloatValidator)1 Dialogs (com.kotcrab.vis.ui.util.dialog.Dialogs)1 VisImageTextButton (com.kotcrab.vis.ui.widget.VisImageTextButton)1