mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
[flutter] Upgrade to latest ffi, fix pointer types, fix rendering, fix crash
This commit is contained in:
parent
1a676c14fc
commit
a185485d73
@ -50,7 +50,7 @@ class SimpleAnimation extends StatelessWidget {
|
||||
reportLeaks();
|
||||
final controller = SpineWidgetController((controller) {
|
||||
// Set the walk animation on track 0, let it loop
|
||||
controller.animationState?.setAnimation(0, "walk", true);
|
||||
controller.animationState?.setAnimationByName(0, "walk", true);
|
||||
|
||||
print("Skeleton name: ${controller.skeletonData?.getName()}");
|
||||
print("Skeleton version: ${controller.skeletonData?.getVersion()}");
|
||||
@ -81,10 +81,10 @@ class AnimationStateEvents extends StatelessWidget {
|
||||
controller.skeleton?.setScaleY(0.5);
|
||||
controller.skeleton?.findSlot("gun")?.setColor(Color(1, 0, 0, 1));
|
||||
controller.animationStateData?.setDefaultMix(0.2);
|
||||
controller.animationState?.setAnimation(0, "walk", true)?.setListener((type, trackEntry, event) {
|
||||
controller.animationState?.setAnimationByName(0, "walk", true)?.setListener((type, trackEntry, event) {
|
||||
print("Walk animation event ${type}");
|
||||
});
|
||||
controller.animationState?.addAnimation(0, "run", true, 2)?.setListener((type, trackEntry, event) {
|
||||
controller.animationState?.addAnimationByName(0, "run", true, 2)?.setListener((type, trackEntry, event) {
|
||||
print("Run animation event ${type}");
|
||||
});
|
||||
controller.animationState?.setListener((type, trackEntry, event) {
|
||||
|
||||
@ -56,7 +56,7 @@ packages:
|
||||
name: ffi
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.2.1"
|
||||
version: "2.0.1"
|
||||
flutter:
|
||||
dependency: "direct main"
|
||||
description: flutter
|
||||
|
||||
@ -1145,13 +1145,13 @@ class VertexAttachment<T extends Pointer> extends Attachment<T> {
|
||||
|
||||
Int32List getBones() {
|
||||
final num = _bindings.spine_vertex_attachment_get_num_bones(_attachment.cast());
|
||||
final bones = _bindings.spine_region_attachment_get_bones(_attachment.cast());
|
||||
final bones = _bindings.spine_vertex_attachment_get_bones(_attachment.cast());
|
||||
return bones.asTypedList(num);
|
||||
}
|
||||
|
||||
Float32List getVertices() {
|
||||
final num = _bindings.spine_vertex_attachment_get_num_vertices(_attachment.cast());
|
||||
final vertices = _bindings.spine_region_attachment_get_vertices(_attachment.cast());
|
||||
final vertices = _bindings.spine_vertex_attachment_get_vertices(_attachment.cast());
|
||||
return vertices.asTypedList(num);
|
||||
}
|
||||
|
||||
@ -2790,14 +2790,20 @@ class AnimationState {
|
||||
/// @return
|
||||
/// A track entry to allow further customization of animation playback. References to the track entry must not be kept
|
||||
/// after AnimationState.Dispose.
|
||||
TrackEntry setAnimation(int trackIndex, String animationName, bool loop) {
|
||||
TrackEntry setAnimationByName(int trackIndex, String animationName, bool loop) {
|
||||
final animation = animationName.toNativeUtf8();
|
||||
final entry = _bindings.spine_animation_state_set_animation(_state, trackIndex, animation.cast(), loop ? -1 : 0);
|
||||
final entry = _bindings.spine_animation_state_set_animation_by_name(_state, trackIndex, animation.cast(), loop ? -1 : 0);
|
||||
malloc.free(animation);
|
||||
if (entry.address == nullptr.address) throw Exception("Couldn't set animation $animationName");
|
||||
return TrackEntry._(entry, this);
|
||||
}
|
||||
|
||||
TrackEntry setAnimation(int trackIndex, Animation animation, bool loop) {
|
||||
final entry = _bindings.spine_animation_state_set_animation(_state, trackIndex, animation._animation, loop ? -1 : 0);
|
||||
if (entry.address == nullptr.address) throw Exception("Couldn't set animation ${animation.getName()}");
|
||||
return TrackEntry._(entry, this);
|
||||
}
|
||||
|
||||
/// Adds an animation to be played delay seconds after the current or last queued animation
|
||||
/// for a track. If the track is empty, it is equivalent to calling setAnimation.
|
||||
/// @param delay
|
||||
@ -2806,14 +2812,20 @@ class AnimationState {
|
||||
///
|
||||
/// @return A track entry to allow further customization of animation playback. References to the track entry must not be kept
|
||||
/// after AnimationState.Dispose
|
||||
TrackEntry addAnimation(int trackIndex, String animationName, bool loop, double delay) {
|
||||
TrackEntry addAnimationByName(int trackIndex, String animationName, bool loop, double delay) {
|
||||
final animation = animationName.toNativeUtf8();
|
||||
final entry = _bindings.spine_animation_state_add_animation(_state, trackIndex, animation.cast(), loop ? -1 : 0, delay);
|
||||
final entry = _bindings.spine_animation_state_add_animation_by_name(_state, trackIndex, animation.cast(), loop ? -1 : 0, delay);
|
||||
malloc.free(animation);
|
||||
if (entry.address == nullptr.address) throw Exception("Couldn't add animation $animationName");
|
||||
return TrackEntry._(entry, this);
|
||||
}
|
||||
|
||||
TrackEntry addAnimation(int trackIndex, Animation animation, bool loop, double delay) {
|
||||
final entry = _bindings.spine_animation_state_add_animation(_state, trackIndex, animation._animation, loop ? -1 : 0, delay);
|
||||
if (entry.address == nullptr.address) throw Exception("Couldn't add animation ${animation.getName()}");
|
||||
return TrackEntry._(entry, this);
|
||||
}
|
||||
|
||||
/// Sets an empty animation for a track, discarding any queued animations, and mixes to it over the specified mix duration.
|
||||
TrackEntry setEmptyAnimation(int trackIndex, double mixDuration) {
|
||||
final entry = _bindings.spine_animation_state_set_empty_animation(_state, trackIndex, mixDuration);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -11,15 +11,14 @@ dependencies:
|
||||
flutter:
|
||||
sdk: flutter
|
||||
plugin_platform_interface: ^2.0.2
|
||||
ffi: ^1.1.2
|
||||
ffi: ^2.0.1
|
||||
http: ^0.13.5
|
||||
|
||||
dev_dependencies:
|
||||
ffigen: ^4.1.2
|
||||
ffigen: ^6.1.2
|
||||
flutter_test:
|
||||
sdk: flutter
|
||||
flutter_lints: ^2.0.0
|
||||
ffi: ^1.1.2
|
||||
|
||||
# For information on the generic Dart part of this file, see the
|
||||
# following page: https://dart.dev/tools/pub/pubspec
|
||||
|
||||
@ -1,3 +1,32 @@
|
||||
/******************************************************************************
|
||||
* Spine Runtimes License Agreement
|
||||
* Last updated September 24, 2021. Replaces all prior versions.
|
||||
*
|
||||
* Copyright (c) 2013-2021, Esoteric Software LLC
|
||||
*
|
||||
* Integration of the Spine Runtimes into software or otherwise creating
|
||||
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||
* conditions of Section 2 of the Spine Editor License Agreement:
|
||||
* http://esotericsoftware.com/spine-editor-license
|
||||
*
|
||||
* Otherwise, it is permitted to integrate the Spine Runtimes into software
|
||||
* or otherwise create derivative works of the Spine Runtimes (collectively,
|
||||
* "Products"), provided that each user of the Products must obtain their own
|
||||
* Spine Editor license and redistribution of the Products in any form must
|
||||
* include this license and copyright notice.
|
||||
*
|
||||
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
|
||||
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
#include "spine_flutter.h"
|
||||
#include <spine/spine.h>
|
||||
#include <spine/Version.h>
|
||||
@ -454,7 +483,7 @@ FFI_PLUGIN_EXPORT spine_render_command *spine_skeleton_drawable_render(spine_ske
|
||||
uvs = ®ionAttachment->getUVs();
|
||||
indices = &quadIndices;
|
||||
indicesCount = 6;
|
||||
pageIndex = ((AtlasRegion *) regionAttachment->getRendererObject())->page->index;
|
||||
pageIndex = ((AtlasRegion*)regionAttachment->getRegion())->page->index;
|
||||
|
||||
} else if (attachment->getRTTI().isExactly(MeshAttachment::rtti)) {
|
||||
MeshAttachment *mesh = (MeshAttachment *) attachment;
|
||||
@ -467,12 +496,12 @@ FFI_PLUGIN_EXPORT spine_render_command *spine_skeleton_drawable_render(spine_ske
|
||||
}
|
||||
|
||||
worldVertices.setSize(mesh->getWorldVerticesLength(), 0);
|
||||
pageIndex = ((AtlasRegion *) mesh->getRendererObject())->page->index;
|
||||
mesh->computeWorldVertices(slot, 0, mesh->getWorldVerticesLength(), worldVertices.buffer(), 0, 2);
|
||||
verticesCount = (int)(mesh->getWorldVerticesLength() >> 1);
|
||||
uvs = &mesh->getUVs();
|
||||
indices = &mesh->getTriangles();
|
||||
indicesCount = (int)indices->size();
|
||||
pageIndex = ((AtlasRegion*)mesh->getRegion())->page->index;
|
||||
|
||||
} else if (attachment->getRTTI().isExactly(ClippingAttachment::rtti)) {
|
||||
ClippingAttachment *clip = (ClippingAttachment *) slot.getAttachment();
|
||||
@ -1727,6 +1756,14 @@ FFI_PLUGIN_EXPORT void spine_bone_data_set_color(spine_bone_data data, float r,
|
||||
}
|
||||
|
||||
// Bone
|
||||
FFI_PLUGIN_EXPORT void spine_bone_set_is_y_down(int yDown) {
|
||||
Bone::setYDown(yDown);
|
||||
}
|
||||
|
||||
FFI_PLUGIN_EXPORT int spine_bone_get_is_y_down() {
|
||||
return Bone::isYDown() ? -1 : 0;
|
||||
}
|
||||
|
||||
FFI_PLUGIN_EXPORT void spine_bone_update(spine_bone bone) {
|
||||
if (bone == nullptr) return;
|
||||
Bone *_bone = (Bone*)bone;
|
||||
@ -2381,7 +2418,7 @@ FFI_PLUGIN_EXPORT int spine_vertex_attachment_get_num_bones(spine_vertex_attachm
|
||||
return (int)_attachment->getBones().size();
|
||||
}
|
||||
|
||||
FFI_PLUGIN_EXPORT int *spine_region_attachment_get_bones(spine_region_attachment attachment) {
|
||||
FFI_PLUGIN_EXPORT int32_t *spine_vertex_attachment_get_bones(spine_vertex_attachment attachment) {
|
||||
if (attachment == nullptr) return nullptr;
|
||||
VertexAttachment *_attachment = (VertexAttachment*)attachment;
|
||||
return _attachment->getBones().buffer();
|
||||
@ -2394,7 +2431,7 @@ FFI_PLUGIN_EXPORT int spine_vertex_attachment_get_num_vertices(spine_vertex_atta
|
||||
return (int)_attachment->getVertices().size();
|
||||
}
|
||||
|
||||
FFI_PLUGIN_EXPORT float *spine_region_attachment_get_vertices(spine_region_attachment attachment) {
|
||||
FFI_PLUGIN_EXPORT float *spine_vertex_attachment_get_vertices(spine_vertex_attachment attachment) {
|
||||
if (attachment == nullptr) return nullptr;
|
||||
VertexAttachment *_attachment = (VertexAttachment*)attachment;
|
||||
return _attachment->getVertices().buffer();
|
||||
@ -2461,7 +2498,7 @@ FFI_PLUGIN_EXPORT int spine_mesh_attachment_get_num_triangles(spine_mesh_attachm
|
||||
return _attachment->getTriangles().size();
|
||||
}
|
||||
|
||||
FFI_PLUGIN_EXPORT unsigned short *spine_mesh_attachment_get_triangles(spine_mesh_attachment attachment) {
|
||||
FFI_PLUGIN_EXPORT uint16_t *spine_mesh_attachment_get_triangles(spine_mesh_attachment attachment) {
|
||||
if (attachment == nullptr) return nullptr;
|
||||
MeshAttachment *_attachment = (MeshAttachment*)attachment;
|
||||
return _attachment->getTriangles().buffer();
|
||||
@ -2676,6 +2713,13 @@ FFI_PLUGIN_EXPORT void spine_skin_add_skin(spine_skin skin, spine_skin other) {
|
||||
_skin->addSkin((Skin*)other);
|
||||
}
|
||||
|
||||
FFI_PLUGIN_EXPORT void spine_skin_copy_skin(spine_skin skin, spine_skin other) {
|
||||
if (skin == nullptr) return;
|
||||
if (other == nullptr) return;
|
||||
Skin *_skin = (Skin*)skin;
|
||||
_skin->copySkin((Skin*)other);
|
||||
}
|
||||
|
||||
FFI_PLUGIN_EXPORT spine_skin_entries *spine_skin_get_entries(spine_skin skin) {
|
||||
if (skin == nullptr) return nullptr;
|
||||
Skin *_skin = (Skin*)skin;
|
||||
@ -2737,6 +2781,7 @@ FFI_PLUGIN_EXPORT void spine_skin_dispose(spine_skin skin) {
|
||||
delete _skin;
|
||||
}
|
||||
|
||||
// ConstraintData
|
||||
FFI_PLUGIN_EXPORT spine_constraint_type spine_constraint_data_get_type(spine_constraint_data data) {
|
||||
if (data == nullptr) return SPINE_CONSTRAINT_IK;
|
||||
ConstraintData *_data = (ConstraintData*)data;
|
||||
@ -2751,6 +2796,36 @@ FFI_PLUGIN_EXPORT spine_constraint_type spine_constraint_data_get_type(spine_con
|
||||
}
|
||||
}
|
||||
|
||||
FFI_PLUGIN_EXPORT const char* spine_constraint_data_get_name(spine_constraint_data data) {
|
||||
if (data == nullptr) return nullptr;
|
||||
ConstraintData *_data = (ConstraintData*)data;
|
||||
return _data->getName().buffer();
|
||||
}
|
||||
|
||||
FFI_PLUGIN_EXPORT uint64_t spine_constraint_data_get_order(spine_constraint_data data) {
|
||||
if (data == nullptr) return 0;
|
||||
ConstraintData *_data = (ConstraintData*)data;
|
||||
return (uint64_t)_data->getOrder();
|
||||
}
|
||||
|
||||
FFI_PLUGIN_EXPORT void spine_constraint_data_set_order(spine_constraint_data data, uint64_t order) {
|
||||
if (data == nullptr) return;
|
||||
ConstraintData *_data = (ConstraintData*)data;
|
||||
_data->setOrder((size_t)order);
|
||||
}
|
||||
|
||||
FFI_PLUGIN_EXPORT int spine_constraint_data_get_is_skin_required(spine_constraint_data data) {
|
||||
if (data == nullptr) return 0;
|
||||
ConstraintData *_data = (ConstraintData*)data;
|
||||
return _data->isSkinRequired() ? -1 : 0;
|
||||
}
|
||||
|
||||
FFI_PLUGIN_EXPORT void spine_constraint_data_set_is_skin_required(spine_constraint_data data, int isSkinRequired) {
|
||||
if (data == nullptr) return;
|
||||
ConstraintData *_data = (ConstraintData*)data;
|
||||
_data->setSkinRequired(isSkinRequired);
|
||||
}
|
||||
|
||||
// IkConstraintData
|
||||
FFI_PLUGIN_EXPORT int spine_ik_constraint_data_get_num_bones(spine_ik_constraint_data data) {
|
||||
if (data == nullptr) return 0;
|
||||
@ -3525,3 +3600,219 @@ FFI_PLUGIN_EXPORT void spine_path_constraint_set_is_active(spine_path_constraint
|
||||
_constraint->setActive(isActive);
|
||||
}
|
||||
|
||||
// Sequence
|
||||
FFI_PLUGIN_EXPORT void spine_sequence_apply(spine_sequence sequence, spine_slot slot, spine_attachment attachment) {
|
||||
if (sequence == nullptr) return;
|
||||
Sequence *_sequence = (Sequence*)sequence;
|
||||
_sequence->apply((Slot*)slot, (Attachment*)attachment);
|
||||
}
|
||||
|
||||
FFI_PLUGIN_EXPORT const char* spine_sequence_get_path(spine_sequence sequence, const char *basePath, int index) {
|
||||
if (sequence == nullptr) return nullptr;
|
||||
Sequence *_sequence = (Sequence*)sequence;
|
||||
return strdup(_sequence->getPath(basePath, index).buffer());
|
||||
}
|
||||
|
||||
FFI_PLUGIN_EXPORT int spine_sequence_get_id(spine_sequence sequence) {
|
||||
if (sequence == nullptr) return 0;
|
||||
Sequence *_sequence = (Sequence *) sequence;
|
||||
return _sequence->getId();
|
||||
}
|
||||
|
||||
FFI_PLUGIN_EXPORT void spine_sequence_set_id(spine_sequence sequence, int id) {
|
||||
if (sequence == nullptr) return;
|
||||
Sequence *_sequence = (Sequence *) sequence;
|
||||
_sequence->setId(id);
|
||||
}
|
||||
|
||||
FFI_PLUGIN_EXPORT int spine_sequence_get_start(spine_sequence sequence) {
|
||||
if (sequence == nullptr) return 0;
|
||||
Sequence *_sequence = (Sequence *) sequence;
|
||||
return _sequence->getStart();
|
||||
}
|
||||
|
||||
FFI_PLUGIN_EXPORT void spine_sequence_set_start(spine_sequence sequence, int start) {
|
||||
if (sequence == nullptr) return;
|
||||
Sequence *_sequence = (Sequence *) sequence;
|
||||
_sequence->setStart(start);
|
||||
}
|
||||
|
||||
FFI_PLUGIN_EXPORT int spine_sequence_get_digits(spine_sequence sequence) {
|
||||
if (sequence == nullptr) return 0;
|
||||
Sequence *_sequence = (Sequence *) sequence;
|
||||
return _sequence->getDigits();
|
||||
}
|
||||
|
||||
FFI_PLUGIN_EXPORT void spine_sequence_set_digits(spine_sequence sequence, int digits) {
|
||||
if (sequence == nullptr) return;
|
||||
Sequence *_sequence = (Sequence *) sequence;
|
||||
_sequence->setDigits(digits);
|
||||
}
|
||||
|
||||
FFI_PLUGIN_EXPORT int spine_sequence_get_setup_index(spine_sequence sequence) {
|
||||
if (sequence == nullptr) return 0;
|
||||
Sequence *_sequence = (Sequence *) sequence;
|
||||
return _sequence->getSetupIndex();
|
||||
}
|
||||
|
||||
FFI_PLUGIN_EXPORT void spine_sequence_set_setup_index(spine_sequence sequence, int setupIndex) {
|
||||
if (sequence == nullptr) return;
|
||||
Sequence *_sequence = (Sequence *) sequence;
|
||||
_sequence->setSetupIndex(setupIndex);
|
||||
}
|
||||
|
||||
FFI_PLUGIN_EXPORT int spine_sequence_get_num_regions(spine_sequence sequence) {
|
||||
if (sequence == nullptr) return 0;
|
||||
Sequence *_sequence = (Sequence *) sequence;
|
||||
return (int)_sequence->getRegions().size();
|
||||
}
|
||||
|
||||
FFI_PLUGIN_EXPORT spine_texture_region* spine_sequence_get_regions(spine_sequence sequence) {
|
||||
if (sequence == nullptr) return nullptr;
|
||||
Sequence *_sequence = (Sequence *) sequence;
|
||||
return (spine_texture_region*)_sequence->getRegions().buffer();
|
||||
}
|
||||
|
||||
// TextureRegion
|
||||
FFI_PLUGIN_EXPORT void* spine_texture_region_get_texture(spine_texture_region textureRegion) {
|
||||
if (textureRegion == nullptr) return nullptr;
|
||||
TextureRegion *_region = (TextureRegion*)textureRegion;
|
||||
return _region->rendererObject;
|
||||
}
|
||||
|
||||
FFI_PLUGIN_EXPORT void spine_texture_region_set_texture(spine_texture_region textureRegion, void *texture) {
|
||||
if (textureRegion == nullptr) return;
|
||||
TextureRegion *_region = (TextureRegion*)textureRegion;
|
||||
_region->rendererObject = texture;
|
||||
}
|
||||
|
||||
FFI_PLUGIN_EXPORT float spine_texture_region_get_u(spine_texture_region textureRegion) {
|
||||
if (textureRegion == nullptr) return 0;
|
||||
TextureRegion *_region = (TextureRegion*)textureRegion;
|
||||
return _region->u;
|
||||
}
|
||||
|
||||
FFI_PLUGIN_EXPORT void spine_texture_region_set_u(spine_texture_region textureRegion, float u) {
|
||||
if (textureRegion == nullptr) return;
|
||||
TextureRegion *_region = (TextureRegion*)textureRegion;
|
||||
_region->u = u;
|
||||
}
|
||||
|
||||
FFI_PLUGIN_EXPORT float spine_texture_region_get_v(spine_texture_region textureRegion) {
|
||||
if (textureRegion == nullptr) return 0;
|
||||
TextureRegion *_region = (TextureRegion*)textureRegion;
|
||||
return _region->v;
|
||||
}
|
||||
FFI_PLUGIN_EXPORT void spine_texture_region_set_v(spine_texture_region textureRegion, float v) {
|
||||
if (textureRegion == nullptr) return;
|
||||
TextureRegion *_region = (TextureRegion*)textureRegion;
|
||||
_region->v = v;
|
||||
}
|
||||
FFI_PLUGIN_EXPORT float spine_texture_region_get_u2(spine_texture_region textureRegion) {
|
||||
if (textureRegion == nullptr) return 0;
|
||||
TextureRegion *_region = (TextureRegion*)textureRegion;
|
||||
return _region->u2;
|
||||
}
|
||||
|
||||
FFI_PLUGIN_EXPORT void spine_texture_region_set_u2(spine_texture_region textureRegion, float u2) {
|
||||
if (textureRegion == nullptr) return;
|
||||
TextureRegion *_region = (TextureRegion*)textureRegion;
|
||||
_region->u2 = u2;
|
||||
}
|
||||
|
||||
FFI_PLUGIN_EXPORT float spine_texture_region_get_v2(spine_texture_region textureRegion) {
|
||||
if (textureRegion == nullptr) return 0;
|
||||
TextureRegion *_region = (TextureRegion*)textureRegion;
|
||||
return _region->v2;
|
||||
}
|
||||
|
||||
FFI_PLUGIN_EXPORT void spine_texture_region_set_v2(spine_texture_region textureRegion, float v2) {
|
||||
if (textureRegion == nullptr) return;
|
||||
TextureRegion *_region = (TextureRegion*)textureRegion;
|
||||
_region->v2 = v2;
|
||||
}
|
||||
|
||||
FFI_PLUGIN_EXPORT int spine_texture_region_get_degrees(spine_texture_region textureRegion) {
|
||||
if (textureRegion == nullptr) return 0;
|
||||
TextureRegion *_region = (TextureRegion*)textureRegion;
|
||||
return _region->degrees;
|
||||
}
|
||||
|
||||
FFI_PLUGIN_EXPORT void spine_texture_region_set_degrees(spine_texture_region textureRegion, int degrees) {
|
||||
if (textureRegion == nullptr) return;
|
||||
TextureRegion *_region = (TextureRegion*)textureRegion;
|
||||
_region->degrees = degrees;
|
||||
}
|
||||
|
||||
FFI_PLUGIN_EXPORT float spine_texture_region_get_offset_x(spine_texture_region textureRegion) {
|
||||
if (textureRegion == nullptr) return 0;
|
||||
TextureRegion *_region = (TextureRegion*)textureRegion;
|
||||
return _region->offsetX;
|
||||
}
|
||||
|
||||
FFI_PLUGIN_EXPORT void spine_texture_region_set_offset_x(spine_texture_region textureRegion, float offsetX) {
|
||||
if (textureRegion == nullptr) return;
|
||||
TextureRegion *_region = (TextureRegion*)textureRegion;
|
||||
_region->offsetX = offsetX;
|
||||
}
|
||||
|
||||
FFI_PLUGIN_EXPORT float spine_texture_region_get_offset_y(spine_texture_region textureRegion) {
|
||||
if (textureRegion == nullptr) return 0;
|
||||
TextureRegion *_region = (TextureRegion*)textureRegion;
|
||||
return _region->offsetY;
|
||||
}
|
||||
|
||||
FFI_PLUGIN_EXPORT void spine_texture_region_set_offset_y(spine_texture_region textureRegion, float offsetY) {
|
||||
if (textureRegion == nullptr) return;
|
||||
TextureRegion *_region = (TextureRegion*)textureRegion;
|
||||
_region->offsetY = offsetY;
|
||||
}
|
||||
|
||||
FFI_PLUGIN_EXPORT int spine_texture_region_get_width(spine_texture_region textureRegion) {
|
||||
if (textureRegion == nullptr) return 0;
|
||||
TextureRegion *_region = (TextureRegion*)textureRegion;
|
||||
return _region->width;
|
||||
}
|
||||
|
||||
FFI_PLUGIN_EXPORT void spine_texture_region_set_width(spine_texture_region textureRegion, int width) {
|
||||
if (textureRegion == nullptr) return;
|
||||
TextureRegion *_region = (TextureRegion*)textureRegion;
|
||||
_region->width = width;
|
||||
}
|
||||
|
||||
FFI_PLUGIN_EXPORT int spine_texture_region_get_height(spine_texture_region textureRegion) {
|
||||
if (textureRegion == nullptr) return 0;
|
||||
TextureRegion *_region = (TextureRegion*)textureRegion;
|
||||
return _region->height;
|
||||
}
|
||||
|
||||
FFI_PLUGIN_EXPORT void spine_texture_region_set_height(spine_texture_region textureRegion, int height) {
|
||||
if (textureRegion == nullptr) return;
|
||||
TextureRegion *_region = (TextureRegion*)textureRegion;
|
||||
_region->height = height;
|
||||
}
|
||||
|
||||
FFI_PLUGIN_EXPORT int spine_texture_region_get_original_width(spine_texture_region textureRegion) {
|
||||
if (textureRegion == nullptr) return 0;
|
||||
TextureRegion *_region = (TextureRegion*)textureRegion;
|
||||
return _region->originalWidth;
|
||||
}
|
||||
|
||||
FFI_PLUGIN_EXPORT void spine_texture_region_set_original_width(spine_texture_region textureRegion, int originalWidth) {
|
||||
if (textureRegion == nullptr) return;
|
||||
TextureRegion *_region = (TextureRegion*)textureRegion;
|
||||
_region->originalWidth = originalWidth;
|
||||
}
|
||||
|
||||
FFI_PLUGIN_EXPORT int spine_texture_region_get_original_height(spine_texture_region textureRegion) {
|
||||
if (textureRegion == nullptr) return 0;
|
||||
TextureRegion *_region = (TextureRegion*)textureRegion;
|
||||
return _region->originalHeight;
|
||||
}
|
||||
|
||||
FFI_PLUGIN_EXPORT void spine_texture_region_set_original_height(spine_texture_region textureRegion, int originalHeight) {
|
||||
if (textureRegion == nullptr) return;
|
||||
TextureRegion *_region = (TextureRegion*)textureRegion;
|
||||
_region->originalHeight = originalHeight;
|
||||
}
|
||||
|
||||
|
||||
@ -1,26 +1,49 @@
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
/******************************************************************************
|
||||
* Spine Runtimes License Agreement
|
||||
* Last updated September 24, 2021. Replaces all prior versions.
|
||||
*
|
||||
* Copyright (c) 2013-2021, Esoteric Software LLC
|
||||
*
|
||||
* Integration of the Spine Runtimes into software or otherwise creating
|
||||
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||
* conditions of Section 2 of the Spine Editor License Agreement:
|
||||
* http://esotericsoftware.com/spine-editor-license
|
||||
*
|
||||
* Otherwise, it is permitted to integrate the Spine Runtimes into software
|
||||
* or otherwise create derivative works of the Spine Runtimes (collectively,
|
||||
* "Products"), provided that each user of the Products must obtain their own
|
||||
* Spine Editor license and redistribution of the Products in any form must
|
||||
* include this license and copyright notice.
|
||||
*
|
||||
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
|
||||
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
#if _WIN32
|
||||
#include <windows.h>
|
||||
#else
|
||||
#include <pthread.h>
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#ifndef SPINE_FLUTTER
|
||||
#define SPINE_FLUTTER
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if _WIN32
|
||||
#define FFI_PLUGIN_EXPORT extern "C" __declspec(dllexport)
|
||||
# if _WIN32
|
||||
# define FFI_PLUGIN_EXPORT extern "C" __declspec(dllexport)
|
||||
# else
|
||||
# define FFI_PLUGIN_EXPORT extern "C"
|
||||
# endif
|
||||
#else
|
||||
#define FFI_PLUGIN_EXPORT extern "C"
|
||||
#endif
|
||||
#else
|
||||
#if _WIN32
|
||||
#define FFI_PLUGIN_EXPORT __declspec(dllexport)
|
||||
#else
|
||||
#define FFI_PLUGIN_EXPORT
|
||||
#endif
|
||||
# if _WIN32
|
||||
# define FFI_PLUGIN_EXPORT __declspec(dllexport)
|
||||
# else
|
||||
# define FFI_PLUGIN_EXPORT
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#define SPINE_OPAQUE_TYPE(name) \
|
||||
@ -463,6 +486,8 @@ FFI_PLUGIN_EXPORT void spine_bone_data_set_is_skin_required(spine_bone_data data
|
||||
FFI_PLUGIN_EXPORT spine_color spine_bone_data_get_color(spine_bone_data data);
|
||||
FFI_PLUGIN_EXPORT void spine_bone_data_set_color(spine_bone_data data, float r, float g, float b, float a);
|
||||
|
||||
FFI_PLUGIN_EXPORT void spine_bone_set_is_y_down(int yDown);
|
||||
FFI_PLUGIN_EXPORT int spine_bone_get_is_y_down();
|
||||
FFI_PLUGIN_EXPORT void spine_bone_update(spine_bone bone);
|
||||
FFI_PLUGIN_EXPORT void spine_bone_update_world_transform(spine_bone bone);
|
||||
FFI_PLUGIN_EXPORT void spine_bone_update_world_transform_with(spine_bone bone, float x, float y, float rotation, float scaleX, float scaleY, float shearX, float shearY);
|
||||
@ -561,8 +586,11 @@ FFI_PLUGIN_EXPORT void spine_region_attachment_set_height(spine_region_attachmen
|
||||
FFI_PLUGIN_EXPORT spine_color spine_region_attachment_get_color(spine_region_attachment attachment);
|
||||
FFI_PLUGIN_EXPORT void spine_region_attachment_set_color(spine_region_attachment attachment, float r, float g, float b, float a);
|
||||
FFI_PLUGIN_EXPORT const char *spine_region_attachment_get_path(spine_region_attachment attachment);
|
||||
// OMITTED setPath()
|
||||
FFI_PLUGIN_EXPORT spine_texture_region spine_region_attachment_get_region(spine_region_attachment attachment);
|
||||
// OMITTED setRegion()
|
||||
FFI_PLUGIN_EXPORT spine_sequence spine_region_attachment_get_sequence(spine_region_attachment attachment);
|
||||
// OMITTED setSequence()
|
||||
FFI_PLUGIN_EXPORT int spine_region_attachment_get_num_offset(spine_region_attachment attachment);
|
||||
FFI_PLUGIN_EXPORT float *spine_region_attachment_get_offset(spine_region_attachment attachment);
|
||||
FFI_PLUGIN_EXPORT int spine_region_attachment_get_num_uvs(spine_region_attachment attachment);
|
||||
@ -570,12 +598,14 @@ FFI_PLUGIN_EXPORT float *spine_region_attachment_get_uvs(spine_region_attachment
|
||||
|
||||
FFI_PLUGIN_EXPORT int spine_vertex_attachment_get_world_vertices_length(spine_vertex_attachment attachment);
|
||||
FFI_PLUGIN_EXPORT void spine_vertex_attachment_compute_world_vertices(spine_vertex_attachment attachment, spine_slot slot, float *worldVertices);
|
||||
// OMITTED getId()
|
||||
FFI_PLUGIN_EXPORT int spine_vertex_attachment_get_num_bones(spine_vertex_attachment attachment);
|
||||
FFI_PLUGIN_EXPORT int *spine_region_attachment_get_bones(spine_region_attachment attachment);
|
||||
FFI_PLUGIN_EXPORT int32_t *spine_vertex_attachment_get_bones(spine_vertex_attachment attachment);
|
||||
FFI_PLUGIN_EXPORT int spine_vertex_attachment_get_num_vertices(spine_vertex_attachment attachment);
|
||||
FFI_PLUGIN_EXPORT float *spine_region_attachment_get_vertices(spine_region_attachment attachment);
|
||||
FFI_PLUGIN_EXPORT float *spine_vertex_attachment_get_vertices(spine_vertex_attachment attachment);
|
||||
FFI_PLUGIN_EXPORT spine_attachment spine_vertex_attachment_get_timeline_attachment(spine_vertex_attachment timelineAttachment);
|
||||
FFI_PLUGIN_EXPORT void spine_vertex_attachment_set_timeline_attachment(spine_vertex_attachment attachment, spine_attachment timelineAttachment);
|
||||
// OMITTED copyTo()
|
||||
|
||||
FFI_PLUGIN_EXPORT void spine_mesh_attachment_update_region(spine_mesh_attachment attachment);
|
||||
FFI_PLUGIN_EXPORT int spine_mesh_attachment_get_hull_length(spine_mesh_attachment attachment);
|
||||
@ -585,20 +615,24 @@ FFI_PLUGIN_EXPORT float *spine_mesh_attachment_get_region_uvs(spine_mesh_attachm
|
||||
FFI_PLUGIN_EXPORT int spine_mesh_attachment_get_num_uvs(spine_mesh_attachment attachment);
|
||||
FFI_PLUGIN_EXPORT float *spine_mesh_attachment_get_uvs(spine_mesh_attachment attachment);
|
||||
FFI_PLUGIN_EXPORT int spine_mesh_attachment_get_num_triangles(spine_mesh_attachment attachment);
|
||||
FFI_PLUGIN_EXPORT unsigned short *spine_mesh_attachment_get_triangles(spine_mesh_attachment attachment);
|
||||
FFI_PLUGIN_EXPORT uint16_t *spine_mesh_attachment_get_triangles(spine_mesh_attachment attachment);
|
||||
FFI_PLUGIN_EXPORT spine_color spine_mesh_attachment_get_color(spine_mesh_attachment attachment);
|
||||
FFI_PLUGIN_EXPORT void spine_mesh_attachment_set_color(spine_mesh_attachment attachment, float r, float g, float b, float a);
|
||||
FFI_PLUGIN_EXPORT const char *spine_mesh_attachment_get_path(spine_mesh_attachment attachment);
|
||||
// OMITTED setPath()
|
||||
FFI_PLUGIN_EXPORT spine_texture_region spine_mesh_attachment_get_region(spine_mesh_attachment attachment);
|
||||
// OMITTED setRegion()
|
||||
FFI_PLUGIN_EXPORT spine_sequence spine_mesh_attachment_get_sequence(spine_mesh_attachment attachment);
|
||||
// OMITTED setSequence()
|
||||
FFI_PLUGIN_EXPORT spine_mesh_attachment spine_mesh_attachment_get_parent_mesh(spine_mesh_attachment attachment);
|
||||
FFI_PLUGIN_EXPORT void spine_mesh_attachment_set_parent_mesh(spine_mesh_attachment attachment, spine_mesh_attachment parentMesh);
|
||||
FFI_PLUGIN_EXPORT int spine_mesh_attachment_get_num_edges(spine_mesh_attachment attachment);
|
||||
FFI_PLUGIN_EXPORT unsigned short *spine_mesh_attachment_get_edges(spine_mesh_attachment attachment);
|
||||
FFI_PLUGIN_EXPORT uint16_t *spine_mesh_attachment_get_edges(spine_mesh_attachment attachment);
|
||||
FFI_PLUGIN_EXPORT float spine_mesh_attachment_get_width(spine_mesh_attachment attachment);
|
||||
FFI_PLUGIN_EXPORT void spine_mesh_attachment_set_width(spine_mesh_attachment attachment, float width);
|
||||
FFI_PLUGIN_EXPORT float spine_mesh_attachment_get_height(spine_mesh_attachment attachment);
|
||||
FFI_PLUGIN_EXPORT void spine_mesh_attachment_set_height(spine_mesh_attachment attachment, float height);
|
||||
// OMITTED newLinkedMesh()
|
||||
|
||||
FFI_PLUGIN_EXPORT spine_slot_data spine_clipping_attachment_get_end_slot(spine_clipping_attachment attachment);
|
||||
FFI_PLUGIN_EXPORT void spine_clipping_attachment_set_end_slot(spine_clipping_attachment attachment, spine_slot_data endSlot);
|
||||
@ -620,8 +654,11 @@ FFI_PLUGIN_EXPORT void spine_path_attachment_set_color(spine_path_attachment att
|
||||
FFI_PLUGIN_EXPORT void spine_skin_set_attachment(spine_skin skin, int slotIndex, const char* name, spine_attachment attachment);
|
||||
FFI_PLUGIN_EXPORT spine_attachment spine_skin_get_attachment(spine_skin skin, int slotIndex, const char* name);
|
||||
FFI_PLUGIN_EXPORT void spine_skin_remove_attachment(spine_skin skin, int slotIndex, const char* name);
|
||||
// OMITTED findNamesForSlot()
|
||||
// OMITTED findAttachmentsForSlot()
|
||||
FFI_PLUGIN_EXPORT const char* spine_skin_get_name(spine_skin skin);
|
||||
FFI_PLUGIN_EXPORT void spine_skin_add_skin(spine_skin skin, spine_skin other);
|
||||
FFI_PLUGIN_EXPORT void spine_skin_copy_skin(spine_skin skin, spine_skin other);
|
||||
FFI_PLUGIN_EXPORT spine_skin_entries *spine_skin_get_entries(spine_skin skin);
|
||||
FFI_PLUGIN_EXPORT void spine_skin_entries_dispose(spine_skin_entries *entries);
|
||||
FFI_PLUGIN_EXPORT int spine_skin_get_num_bones(spine_skin skin);
|
||||
@ -632,6 +669,11 @@ FFI_PLUGIN_EXPORT spine_skin spine_skin_create(const char* name);
|
||||
FFI_PLUGIN_EXPORT void spine_skin_dispose(spine_skin skin);
|
||||
|
||||
FFI_PLUGIN_EXPORT spine_constraint_type spine_constraint_data_get_type(spine_constraint_data data);
|
||||
FFI_PLUGIN_EXPORT const char* spine_constraint_data_get_name(spine_constraint_data data);
|
||||
FFI_PLUGIN_EXPORT uint64_t spine_constraint_data_get_order(spine_constraint_data data);
|
||||
FFI_PLUGIN_EXPORT void spine_constraint_data_set_order(spine_constraint_data data, uint64_t order);
|
||||
FFI_PLUGIN_EXPORT int spine_constraint_data_get_is_skin_required(spine_constraint_data data);
|
||||
FFI_PLUGIN_EXPORT void spine_constraint_data_set_is_skin_required(spine_constraint_data data, int isSkinRequired);
|
||||
|
||||
FFI_PLUGIN_EXPORT int spine_ik_constraint_data_get_num_bones(spine_ik_constraint_data data);
|
||||
FFI_PLUGIN_EXPORT spine_bone_data* spine_ik_constraint_data_get_bones(spine_ik_constraint_data data);
|
||||
@ -766,4 +808,45 @@ FFI_PLUGIN_EXPORT void spine_path_constraint_set_mix_x(spine_path_constraint con
|
||||
FFI_PLUGIN_EXPORT float spine_path_constraint_get_mix_y(spine_path_constraint constraint);
|
||||
FFI_PLUGIN_EXPORT void spine_path_constraint_set_mix_y(spine_path_constraint constraint, float mixY);
|
||||
FFI_PLUGIN_EXPORT int spine_path_constraint_get_is_active(spine_path_constraint constraint);
|
||||
FFI_PLUGIN_EXPORT void spine_path_constraint_set_is_active(spine_path_constraint constraint, int isActive);
|
||||
FFI_PLUGIN_EXPORT void spine_path_constraint_set_is_active(spine_path_constraint constraint, int isActive);
|
||||
|
||||
// OMITTED copy()
|
||||
FFI_PLUGIN_EXPORT void spine_sequence_apply(spine_sequence sequence, spine_slot slot, spine_attachment attachment);
|
||||
FFI_PLUGIN_EXPORT const char* spine_sequence_get_path(spine_sequence sequence, const char *basePath, int index);
|
||||
FFI_PLUGIN_EXPORT int spine_sequence_get_id(spine_sequence sequence);
|
||||
FFI_PLUGIN_EXPORT void spine_sequence_set_id(spine_sequence sequence, int id);
|
||||
FFI_PLUGIN_EXPORT int spine_sequence_get_start(spine_sequence sequence);
|
||||
FFI_PLUGIN_EXPORT void spine_sequence_set_start(spine_sequence sequence, int start);
|
||||
FFI_PLUGIN_EXPORT int spine_sequence_get_digits(spine_sequence sequence);
|
||||
FFI_PLUGIN_EXPORT void spine_sequence_set_digits(spine_sequence sequence, int digits);
|
||||
FFI_PLUGIN_EXPORT int spine_sequence_get_setup_index(spine_sequence sequence);
|
||||
FFI_PLUGIN_EXPORT void spine_sequence_set_setup_index(spine_sequence sequence, int setupIndex);
|
||||
FFI_PLUGIN_EXPORT int spine_sequence_get_num_regions(spine_sequence sequence);
|
||||
FFI_PLUGIN_EXPORT spine_texture_region* spine_sequence_get_regions(spine_sequence sequence);
|
||||
|
||||
FFI_PLUGIN_EXPORT void* spine_texture_region_get_texture(spine_texture_region textureRegion);
|
||||
FFI_PLUGIN_EXPORT void spine_texture_region_set_texture(spine_texture_region textureRegion, void *texture);
|
||||
FFI_PLUGIN_EXPORT float spine_texture_region_get_u(spine_texture_region textureRegion);
|
||||
FFI_PLUGIN_EXPORT void spine_texture_region_set_u(spine_texture_region textureRegion, float u);
|
||||
FFI_PLUGIN_EXPORT float spine_texture_region_get_v(spine_texture_region textureRegion);
|
||||
FFI_PLUGIN_EXPORT void spine_texture_region_set_v(spine_texture_region textureRegion, float v);
|
||||
FFI_PLUGIN_EXPORT float spine_texture_region_get_u2(spine_texture_region textureRegion);
|
||||
FFI_PLUGIN_EXPORT void spine_texture_region_set_u2(spine_texture_region textureRegion, float u2);
|
||||
FFI_PLUGIN_EXPORT float spine_texture_region_get_v2(spine_texture_region textureRegion);
|
||||
FFI_PLUGIN_EXPORT void spine_texture_region_set_v2(spine_texture_region textureRegion, float v2);
|
||||
FFI_PLUGIN_EXPORT int spine_texture_region_get_degrees(spine_texture_region textureRegion);
|
||||
FFI_PLUGIN_EXPORT void spine_texture_region_set_degrees(spine_texture_region textureRegion, int degrees);
|
||||
FFI_PLUGIN_EXPORT float spine_texture_region_get_offset_x(spine_texture_region textureRegion);
|
||||
FFI_PLUGIN_EXPORT void spine_texture_region_set_offset_x(spine_texture_region textureRegion, float offsetX);
|
||||
FFI_PLUGIN_EXPORT float spine_texture_region_get_offset_y(spine_texture_region textureRegion);
|
||||
FFI_PLUGIN_EXPORT void spine_texture_region_set_offset_y(spine_texture_region textureRegion, float offsetY);
|
||||
FFI_PLUGIN_EXPORT int spine_texture_region_get_width(spine_texture_region textureRegion);
|
||||
FFI_PLUGIN_EXPORT void spine_texture_region_set_width(spine_texture_region textureRegion, int width);
|
||||
FFI_PLUGIN_EXPORT int spine_texture_region_get_height(spine_texture_region textureRegion);
|
||||
FFI_PLUGIN_EXPORT void spine_texture_region_set_height(spine_texture_region textureRegion, int height);
|
||||
FFI_PLUGIN_EXPORT int spine_texture_region_get_original_width(spine_texture_region textureRegion);
|
||||
FFI_PLUGIN_EXPORT void spine_texture_region_set_original_width(spine_texture_region textureRegion, int originalWidth);
|
||||
FFI_PLUGIN_EXPORT int spine_texture_region_get_original_height(spine_texture_region textureRegion);
|
||||
FFI_PLUGIN_EXPORT void spine_texture_region_set_original_height(spine_texture_region textureRegion, int originalHeight);
|
||||
|
||||
#endif
|
||||
Loading…
x
Reference in New Issue
Block a user