Java Code Examples for com.badlogic.gdx.scenes.scene2d.ui.Image#setDrawable()

The following examples show how to use com.badlogic.gdx.scenes.scene2d.ui.Image#setDrawable() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SlotActor.java    From Cubes with MIT License 6 votes vote down vote up
public SlotActor(Inventory inventory, int num) {
  super(new ButtonStyle());

  Image image = new Image();
  image.setScaling(Scaling.fit);
  image.setDrawable(new SlotDrawable());
  image.setTouchable(Touchable.disabled);
  add(image);
  setSize(getPrefWidth(), getPrefHeight());

  this.inventory = inventory;
  this.num = num;

  InventoryManager.newSlot(this);
  addListener(new SlotTooltipListener(this));
}
 
Example 2
Source File: ImageDrawableLmlAttribute.java    From gdx-vfx with Apache License 2.0 5 votes vote down vote up
@Override
public void process(LmlParser parser, LmlTag tag, Image image, String rawAttributeData) {
    ActorConsumer<Drawable, Image> action = (ActorConsumer<Drawable, Image>) parser.parseAction(rawAttributeData, image);
    if (action == null) {
        parser.throwError("Cannot find action: " + rawAttributeData);
        return;
    }

    Drawable drawable = action.consume(image);
    image.setDrawable(drawable);
}
 
Example 3
Source File: ImageTiledLmlAttribute.java    From gdx-texture-packer-gui with Apache License 2.0 4 votes vote down vote up
@Override
public void process(final LmlParser parser, final LmlTag tag, final Image actor, final String rawAttributeData) {
    Skin skin = parser.getData().getDefaultSkin();
    TiledDrawable drawable = skin.getTiledDrawable(parser.parseString(rawAttributeData, actor));
    actor.setDrawable(drawable);
}