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();
}
}
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();
}
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;
}
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();
}
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);
}
Aggregations