use of com.esotericsoftware.spine.Bone in project talos by rockbite.
the class AttachmentPointWidget method getSubWidget.
@Override
public Actor getSubWidget() {
attachmentPointBox = new AttachmentPointBox(TalosMain.Instance().UIStage().getSkin(), "position");
Array<String> boneNameList = new Array<>();
boneNameList.clear();
for (Bone bone : boneListSuppler.get()) {
boneNameList.add(bone.getData().getName());
}
attachmentPointBox.setBoneList(boneNameList);
return attachmentPointBox;
}
use of com.esotericsoftware.spine.Bone in project skin-composer by raeleus.
the class SpineDrawable method draw.
@Override
public void draw(Batch batch, float x, float y, float width, float height) {
for (Bone bone : widthBones) {
bone.setScaleX(width);
}
for (Bone bone : heightBones) {
bone.setScaleY(height);
}
skeleton.setPosition(x, y);
animationState.apply(skeleton);
skeleton.updateWorldTransform();
skeletonRenderer.draw(batch, skeleton);
// reset to normal blending
batch.setBlendFunction(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
}
use of com.esotericsoftware.spine.Bone in project talos by rockbite.
the class BoundEffect method update.
public void update(float delta) {
// value attachments
for (AttachmentPoint attachmentPoint : valueAttachments) {
if (attachmentPoint.isStatic()) {
scopePayload.setDynamicValue(attachmentPoint.getSlotId(), attachmentPoint.getStaticValue());
} else {
Bone bone = parent.getBoneByName(attachmentPoint.getBoneName());
attachmentPoint.setBoneScale(bone.getWorldScaleX());
float rotation = bone.getWorldRotationX();
Color color = Color.WHITE;
for (Slot slot : parent.getSkeleton().getSlots()) {
if (slot.getBone().getData().getName().equals(bone.getData().getName())) {
// can be many
color = slot.getColor();
break;
}
}
tmpVec.set(attachmentPoint.getWorldOffsetX(), attachmentPoint.getWorldOffsetY());
tmpVec.rotate(rotation);
tmpVec.add(parent.getBonePosX(attachmentPoint.getBoneName()), parent.getBonePosY(attachmentPoint.getBoneName()));
if (attachmentPoint.getAttachmentType() == AttachmentPoint.AttachmentType.POSITION) {
val.set(tmpVec.x, tmpVec.y);
} else if (attachmentPoint.getAttachmentType() == AttachmentPoint.AttachmentType.ROTATION) {
val.set(rotation);
} else if (attachmentPoint.getAttachmentType() == AttachmentPoint.AttachmentType.TRANSPARENCY) {
val.set(color.a);
} else if (attachmentPoint.getAttachmentType() == AttachmentPoint.AttachmentType.COLOR) {
val.set(color.r, color.g, color.b);
}
scopePayload.setDynamicValue(attachmentPoint.getSlotId(), val);
}
}
// update position for each instance and update effect itself
removeList.clear();
for (ParticleEffectInstance instance : particleEffects) {
if (instance.isComplete()) {
removeList.add(instance);
}
if (positionAttachment != null) {
if (positionAttachment.isStatic()) {
instance.setPosition(positionAttachment.getStaticValue().get(0), positionAttachment.getStaticValue().get(1));
} else {
Bone bone = parent.getBoneByName(positionAttachment.getBoneName());
positionAttachment.setBoneScale(bone.getWorldScaleX());
tmpVec.set(positionAttachment.getWorldOffsetX(), positionAttachment.getWorldOffsetY());
float rotation = bone.getWorldRotationX();
tmpVec.rotate(rotation);
tmpVec.add(parent.getBonePosX(positionAttachment.getBoneName()), parent.getBonePosY(positionAttachment.getBoneName()));
instance.setPosition(tmpVec.x, tmpVec.y);
}
instance.update(delta);
}
}
for (ParticleEffectInstance instance : removeList) {
particleEffects.removeValue(instance, true);
}
}
Aggregations