Package com.esotericsoftware.spine.attachments

Examples of com.esotericsoftware.spine.attachments.Attachment


  /** @return May be null. */
  public Attachment getAttachment (int slotIndex, String attachmentName) {
    if (attachmentName == null) throw new IllegalArgumentException("attachmentName cannot be null.");
    if (skin != null) {
      Attachment attachment = skin.getAttachment(slotIndex, attachmentName);
      if (attachment != null) return attachment;
    }
    if (data.defaultSkin != null) return data.defaultSkin.getAttachment(slotIndex, attachmentName);
    return null;
  }
View Full Code Here


    if (slotName == null) throw new IllegalArgumentException("slotName cannot be null.");
    Array<Slot> slots = this.slots;
    for (int i = 0, n = slots.size; i < n; i++) {
      Slot slot = slots.get(i);
      if (slot.data.name.equals(slotName)) {
        Attachment attachment = null;
        if (attachmentName != null) {
          attachment = getAttachment(i, attachmentName);
          if (attachment == null)
            throw new IllegalArgumentException("Attachment not found: " + attachmentName + ", for slot: " + slotName);
        }
View Full Code Here

  public void draw (SpriteBatch batch, Skeleton skeleton) {
    Array<Slot> drawOrder = skeleton.drawOrder;
    boolean additive = false;
    for (int i = 0, n = drawOrder.size; i < n; i++) {
      Slot slot = drawOrder.get(i);
      Attachment attachment = slot.attachment;
      if (attachment instanceof RegionAttachment) {
        RegionAttachment regionAttachment = (RegionAttachment)attachment;
        regionAttachment.updateVertices(slot);
        float[] vertices = regionAttachment.getVertices();
        if (slot.data.getAdditiveBlending() != additive) {
View Full Code Here

  private Attachment readAttachment (DataInput input, Skin skin, String attachmentName) throws IOException {
    String name = input.readString();
    if (name == null) name = attachmentName;

    AttachmentType type = AttachmentType.values()[input.readByte()];
    Attachment attachment = attachmentLoader.newAttachment(skin, type, name);

    if (attachment instanceof RegionSequenceAttachment) {
      RegionSequenceAttachment regionSequenceAttachment = (RegionSequenceAttachment)attachment;
      regionSequenceAttachment.setFrameTime(1 / input.readFloat());
      regionSequenceAttachment.setMode(Mode.values()[input.readInt(true)]);
View Full Code Here

  void attachAll (Skeleton skeleton, Skin oldSkin) {
    for (Entry<Key, Attachment> entry : oldSkin.attachments.entries()) {
      int slotIndex = entry.key.slotIndex;
      Slot slot = skeleton.slots.get(slotIndex);
      if (slot.attachment == entry.value) {
        Attachment attachment = getAttachment(slotIndex, entry.key.name);
        if (attachment != null) slot.setAttachment(attachment);
      }
    }
  }
View Full Code Here

    for (JsonValue skinMap = root.getChild("skins"); skinMap != null; skinMap = skinMap.next()) {
      Skin skin = new Skin(skinMap.name());
      for (JsonValue slotEntry = skinMap.child(); slotEntry != null; slotEntry = slotEntry.next()) {
        int slotIndex = skeletonData.findSlotIndex(slotEntry.name());
        for (JsonValue entry = slotEntry.child(); entry != null; entry = entry.next()) {
          Attachment attachment = readAttachment(skin, entry.name(), entry);
          if (attachment != null) skin.addAttachment(slotIndex, entry.name(), attachment);
        }
      }
      skeletonData.addSkin(skin);
      if (skin.name.equals("default")) skeletonData.setDefaultSkin(skin);
View Full Code Here

  private Attachment readAttachment (Skin skin, String name, JsonValue map) {
    name = map.getString("name", name);

    AttachmentType type = AttachmentType.valueOf(map.getString("type", AttachmentType.region.name()));
    Attachment attachment = attachmentLoader.newAttachment(skin, type, name);

    if (attachment instanceof RegionSequenceAttachment) {
      RegionSequenceAttachment regionSequenceAttachment = (RegionSequenceAttachment)attachment;

      float fps = map.getFloat("fps");
View Full Code Here

    renderer.setColor(slotLineColor);
    Array<Slot> slots = skeleton.getSlots();
    for (int i = 0, n = slots.size; i < n; i++) {
      Slot slot = slots.get(i);
      Attachment attachment = slot.attachment;
      if (attachment instanceof RegionAttachment) {
        RegionAttachment regionAttachment = (RegionAttachment)attachment;
        regionAttachment.updateVertices(slot);
        float[] vertices = regionAttachment.getVertices();
        renderer.line(vertices[X1], vertices[Y1], vertices[X2], vertices[Y2]);
View Full Code Here

    float[] vertices = null;
    short[] triangles = null;
    Array<Slot> drawOrder = skeleton.drawOrder;
    for (int i = 0, n = drawOrder.size; i < n; i++) {
      Slot slot = drawOrder.get(i);
      Attachment attachment = slot.attachment;
      Texture texture = null;
      if (attachment instanceof RegionAttachment) {
        RegionAttachment region = (RegionAttachment)attachment;
        region.updateWorldVertices(slot, premultipliedAlpha);
        vertices = region.getWorldVertices();
View Full Code Here

    boolean additive = false;

    Array<Slot> drawOrder = skeleton.drawOrder;
    for (int i = 0, n = drawOrder.size; i < n; i++) {
      Slot slot = drawOrder.get(i);
      Attachment attachment = slot.attachment;
      if (attachment instanceof RegionAttachment) {
        RegionAttachment regionAttachment = (RegionAttachment)attachment;
        regionAttachment.updateWorldVertices(slot, premultipliedAlpha);
        float[] vertices = regionAttachment.getWorldVertices();
        if (slot.data.getAdditiveBlending() != additive) {
View Full Code Here

TOP

Related Classes of com.esotericsoftware.spine.attachments.Attachment

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.