Search in sources :

Example 11 with NinePatchDrawable

use of com.badlogic.gdx.scenes.scene2d.utils.NinePatchDrawable in project Eidolons by IDemiurge.

the class EditorControlPanel method init.

public void init() {
    // 
    setSize(GdxMaster.getWidth() / 3 * 2, 64);
    TextButtonStyle style = StyleHolder.getTextButtonStyle(FONT.AVQ, GdxColorMaster.GOLDEN_WHITE, 18);
    for (MAP_EDITOR_FUNCTION sub : MAP_EDITOR_FUNCTION.values()) {
        TextButton button = new TextButton(sub.name(), style);
        button.setBackground(new NinePatchDrawable(NinePatchFactory.getTooltip()));
        button.addListener(new ClickListener() {

            @Override
            public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
                try {
                    handleFunction(sub);
                } catch (Exception e) {
                    main.system.ExceptionMaster.printStackTrace(e);
                }
                return super.touchDown(event, x, y, pointer, button);
            }
        });
        addActor(button);
    }
}
Also used : TextButton(com.badlogic.gdx.scenes.scene2d.ui.TextButton) TextButtonStyle(com.badlogic.gdx.scenes.scene2d.ui.TextButton.TextButtonStyle) InputEvent(com.badlogic.gdx.scenes.scene2d.InputEvent) ClickListener(com.badlogic.gdx.scenes.scene2d.utils.ClickListener) NinePatchDrawable(com.badlogic.gdx.scenes.scene2d.utils.NinePatchDrawable)

Example 12 with NinePatchDrawable

use of com.badlogic.gdx.scenes.scene2d.utils.NinePatchDrawable in project Eidolons by IDemiurge.

the class EditorPalette method init.

public void init() {
    clearChildren();
    clearListeners();
    addListener(new ClickListener() {

        @Override
        public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
            // updateRequired=true;
            return super.touchDown(event, x, y, pointer, button);
        }
    });
    setSize(GdxMaster.getWidth() / 3 * 2, 256);
    int columns = (int) (getWidth() / 64);
    for (EDITOR_PALETTE sub : EDITOR_PALETTE.values()) {
        OBJ_TYPE TYPE = ContentManager.getOBJ_TYPE(sub.name());
        if (TYPE == null) {
            addCustomTab(sub);
            continue;
        }
        TabbedPanel tabbedPanel = new TabbedPanel();
        TablePanel<Actor> table;
        if (TYPE == null)
            continue;
        List<String> list = DataManager.getTabsGroup(TYPE);
        if (list.isEmpty())
            list.add("");
        for (String group : list) {
            table = new TablePanel<>();
            table.defaults().width(64).height(64);
            table.top().left().padLeft(64).padTop(64);
            table.setFillParent(true);
            ArrayList<ObjType> types = new ArrayList<>(DataManager.getTypesGroup(TYPE, group));
            int i = 0;
            int rows = 0;
            for (ObjType type : types) {
                TextureRegion texture = TextureCache.getOrCreateR(type.getImagePath());
                ValueContainer item = new ValueContainer(texture);
                item.setBackground(new NinePatchDrawable(NinePatchFactory.getTooltip()));
                item.overrideImageSize(64, 64);
                item.addListener(new ValueTooltip(type.getName()).getController());
                item.addListener(getItemListener(item));
                table.add(item).left();
                item.setUserObject(type);
                i++;
                if (i >= columns) {
                    i = 0;
                    table.row();
                    rows++;
                }
            }
            table.pack();
            if (rows > 3) {
                ScrollPanel scrollPanel = new ScrollPanel();
                scrollPanel.addElement(table);
                tabbedPanel.addTab(scrollPanel, group);
            } else {
                tabbedPanel.addTab(table, group);
            }
        }
        addTab(tabbedPanel, sub.name());
    }
// scrollable?
}
Also used : ValueTooltip(eidolons.libgdx.gui.tooltips.ValueTooltip) OBJ_TYPE(main.content.OBJ_TYPE) ArrayList(java.util.ArrayList) TabbedPanel(eidolons.libgdx.gui.panels.TabbedPanel) TextureRegion(com.badlogic.gdx.graphics.g2d.TextureRegion) ObjType(main.entity.type.ObjType) Actor(com.badlogic.gdx.scenes.scene2d.Actor) InputEvent(com.badlogic.gdx.scenes.scene2d.InputEvent) ValueContainer(eidolons.libgdx.gui.generic.ValueContainer) ScrollPanel(eidolons.libgdx.gui.panels.ScrollPanel) ClickListener(com.badlogic.gdx.scenes.scene2d.utils.ClickListener) NinePatchDrawable(com.badlogic.gdx.scenes.scene2d.utils.NinePatchDrawable)

Example 13 with NinePatchDrawable

use of com.badlogic.gdx.scenes.scene2d.utils.NinePatchDrawable in project Eidolons by IDemiurge.

the class ValueTooltip method afterUpdateAct.

@Override
public void afterUpdateAct(float delta) {
    super.afterUpdateAct(delta);
    setBackground(new NinePatchDrawable(NinePatchFactory.getTooltip()));
}
Also used : NinePatchDrawable(com.badlogic.gdx.scenes.scene2d.utils.NinePatchDrawable)

Example 14 with NinePatchDrawable

use of com.badlogic.gdx.scenes.scene2d.utils.NinePatchDrawable in project Eidolons by IDemiurge.

the class AttackTooltip method afterUpdateAct.

@Override
public void afterUpdateAct(float delta) {
    // super.afterUpdateAct(delta);
    baseTable.setBackground(new NinePatchDrawable(NinePatchFactory.getTooltip()));
    rangeTable.setBackground(new NinePatchDrawable(NinePatchFactory.getTooltip()));
    textTables.forEach(tablePanel -> {
        tablePanel.setBackground(new NinePatchDrawable(NinePatchFactory.getTooltip()));
    });
}
Also used : NinePatchDrawable(com.badlogic.gdx.scenes.scene2d.utils.NinePatchDrawable)

Example 15 with NinePatchDrawable

use of com.badlogic.gdx.scenes.scene2d.utils.NinePatchDrawable in project Eidolons by IDemiurge.

the class WeaponTooltip method afterUpdateAct.

@Override
public void afterUpdateAct(float delta) {
    super.afterUpdateAct(delta);
    setBackground(new NinePatchDrawable(NinePatchFactory.getTooltip()));
}
Also used : NinePatchDrawable(com.badlogic.gdx.scenes.scene2d.utils.NinePatchDrawable)

Aggregations

NinePatchDrawable (com.badlogic.gdx.scenes.scene2d.utils.NinePatchDrawable)18 SpriteDrawable (com.badlogic.gdx.scenes.scene2d.utils.SpriteDrawable)8 NinePatch (com.badlogic.gdx.graphics.g2d.NinePatch)7 Drawable (com.badlogic.gdx.scenes.scene2d.utils.Drawable)7 TextureRegion (com.badlogic.gdx.graphics.g2d.TextureRegion)6 InputEvent (com.badlogic.gdx.scenes.scene2d.InputEvent)6 TiledDrawable (com.badlogic.gdx.scenes.scene2d.utils.TiledDrawable)6 Actor (com.badlogic.gdx.scenes.scene2d.Actor)5 Sprite (com.badlogic.gdx.graphics.g2d.Sprite)4 TextButton (com.badlogic.gdx.scenes.scene2d.ui.TextButton)4 ClickListener (com.badlogic.gdx.scenes.scene2d.utils.ClickListener)4 DrawableData (com.ray3k.skincomposer.data.DrawableData)4 AtlasRegion (com.badlogic.gdx.graphics.g2d.TextureAtlas.AtlasRegion)3 AtlasSprite (com.badlogic.gdx.graphics.g2d.TextureAtlas.AtlasSprite)3 ChangeListener (com.badlogic.gdx.scenes.scene2d.utils.ChangeListener)3 TextureRegionDrawable (com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable)3 GdxRuntimeException (com.badlogic.gdx.utils.GdxRuntimeException)3 ValueContainer (eidolons.libgdx.gui.generic.ValueContainer)3 FileHandle (com.badlogic.gdx.files.FileHandle)2 Color (com.badlogic.gdx.graphics.Color)2