Package com.esotericsoftware.spine.attachments

Examples of com.esotericsoftware.spine.attachments.BoundingBoxAttachment


      public boolean touchDown (int screenX, int screenY, int pointer, int button) {
        camera.unproject(point.set(screenX, screenY, 0)); // Convert window to world coordinates.
        bounds.update(skeleton, true); // Update SkeletonBounds with current skeleton bounding box positions.
        if (bounds.aabbContainsPoint(point.x, point.y)) { // Check if inside AABB first. This check is fast.
          BoundingBoxAttachment hit = bounds.containsPoint(point.x, point.y); // Check if inside a bounding box.
          if (hit != null) {
            System.out.println("hit: " + hit);
            skeleton.findSlot("head").getColor().set(Color.RED); // Turn head red until touchUp.
          }
        }
View Full Code Here


      Color.rgba8888ToColor(region.getColor(), input.readInt());
      region.updateOffset();
      return region;
    }
    case boundingbox: {
      BoundingBoxAttachment box = attachmentLoader.newBoundingBoxAttachment(skin, name);
      if (box == null) return null;
      box.setVertices(readFloatArray(input, scale));
      return box;
    }
    case mesh: {
      String path = input.readString();
      if (path == null) path = name;
View Full Code Here

      region.updateOffset();
      return region;
    }
    case boundingbox: {
      BoundingBoxAttachment box = attachmentLoader.newBoundingBoxAttachment(skin, name);
      if (box == null) return null;
      float[] vertices = map.require("vertices").asFloatArray();
      if (scale != 1) {
        for (int i = 0, n = vertices.length; i < n; i++)
          vertices[i] *= scale;
      }
      box.setVertices(vertices);
      return box;
    }
    case mesh: {
      MeshAttachment mesh = attachmentLoader.newMeshAttachment(skin, name, path);
      if (mesh == null) return null;
View Full Code Here

    for (int i = 0; i < slotCount; i++) {
      Slot slot = slots.get(i);
      Attachment attachment = slot.attachment;
      if (attachment instanceof BoundingBoxAttachment) {
        BoundingBoxAttachment boundingBox = (BoundingBoxAttachment)attachment;
        boundingBoxes.add(boundingBox);

        FloatArray polygon = polygonPool.obtain();
        polygons.add(polygon);
        int vertexCount = boundingBox.getVertices().length;
        polygon.ensureCapacity(vertexCount);
        polygon.size = vertexCount;

        boundingBox.computeWorldVertices(slot.bone, polygon.items);
      }
    }

    if (updateAabb) aabbCompute();
  }
View Full Code Here

TOP

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

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.