[flutter] Type-safe C wrapper, fix up Dart side accordingly.

This commit is contained in:
Mario Zechner 2022-09-06 12:42:09 +02:00
parent 5c5c3e2ec7
commit ceabf865f6
4 changed files with 373 additions and 173 deletions

View File

@ -211,7 +211,7 @@ class SkeletonData {
/// than to call it multiple times.
PathConstraintData? findPathConstraint(String name) {
final nativeName = name.toNativeUtf8();
final constraint = _bindings.spine_skeleton_data_find_transform_constraint(_data, nativeName.cast());
final constraint = _bindings.spine_skeleton_data_find_path_constraint(_data, nativeName.cast());
malloc.free(nativeName);
if (constraint.address == nullptr.address) return null;
return PathConstraintData._(constraint);
@ -313,7 +313,7 @@ class SkeletonData {
final numConstraints = _bindings.spine_skeleton_data_get_num_transform_constraints(_data);
final nativeConstraints = _bindings.spine_skeleton_data_get_transform_constraints(_data);
for (int i = 0; i < numConstraints; i++) {
constraints.add(TransformConstraint._(nativeConstraints[i]));
constraints.add(TransformConstraint._(nativeConstraints[i].cast()));
}
return constraints;
}
@ -948,7 +948,7 @@ class Slot {
}
void setAttachment(Attachment? attachment) {
_bindings.spine_slot_set_attachment(_slot, attachment != null ? attachment._attachment : nullptr);
_bindings.spine_slot_set_attachment(_slot, attachment != null ? attachment._attachment.cast() : nullptr);
}
@override
@ -983,18 +983,18 @@ enum AttachmentType {
const AttachmentType(this.value);
}
abstract class Attachment {
final spine_attachment _attachment;
abstract class Attachment<T extends Pointer> {
final T _attachment;
Attachment._(this._attachment);
String getName() {
Pointer<Utf8> name = _bindings.spine_attachment_get_name(_attachment).cast();
Pointer<Utf8> name = _bindings.spine_attachment_get_name(_attachment.cast()).cast();
return name.toString();
}
AttachmentType getType() {
final type = _bindings.spine_attachment_get_type(_attachment);
final type = _bindings.spine_attachment_get_type(_attachment.cast());
return AttachmentType.values[type];
}
@ -1002,31 +1002,31 @@ abstract class Attachment {
final type = AttachmentType.values[_bindings.spine_attachment_get_type(attachment)];
switch(type) {
case AttachmentType.Region:
return RegionAttachment._(attachment);
return RegionAttachment._(attachment.cast());
case AttachmentType.Mesh:
return MeshAttachment._(attachment);
return MeshAttachment._(attachment.cast());
case AttachmentType.Clipping:
return ClippingAttachment._(attachment);
return ClippingAttachment._(attachment.cast());
case AttachmentType.BoundingBox:
return BoundingBoxAttachment._(attachment);
return BoundingBoxAttachment._(attachment.cast());
case AttachmentType.Path:
return PathAttachment._(attachment);
return PathAttachment._(attachment.cast());
case AttachmentType.Point:
return PointAttachment._(attachment);
return PointAttachment._(attachment.cast());
}
}
Attachment copy() {
return _toSubclass(_bindings.spine_attachment_copy(_attachment));
return _toSubclass(_bindings.spine_attachment_copy(_attachment.cast()));
}
void dispose() {
_bindings.spine_attachment_dispose(_attachment);
_bindings.spine_attachment_dispose(_attachment.cast());
}
}
class RegionAttachment extends Attachment {
RegionAttachment._(spine_attachment attachment): super._(attachment);
class RegionAttachment extends Attachment<spine_region_attachment> {
RegionAttachment._(spine_region_attachment attachment): super._(attachment);
List<double> computeWorldVertices(Slot slot) {
Pointer<Float> vertices = malloc.allocate(4 * 8).cast();
@ -1131,63 +1131,63 @@ class RegionAttachment extends Attachment {
}
}
class VertexAttachment extends Attachment {
VertexAttachment._(spine_attachment attachment): super._(attachment);
class VertexAttachment<T extends Pointer> extends Attachment<T> {
VertexAttachment._(T attachment): super._(attachment);
List<double> computeWorldVertices(Slot slot) {
final worldVerticesLength = _bindings.spine_vertex_attachment_get_world_vertices_length(_attachment);
final worldVerticesLength = _bindings.spine_vertex_attachment_get_world_vertices_length(_attachment.cast());
Pointer<Float> vertices = malloc.allocate(4 * worldVerticesLength).cast();
_bindings.spine_vertex_attachment_compute_world_vertices(_attachment, slot._slot, vertices);
_bindings.spine_vertex_attachment_compute_world_vertices(_attachment.cast(), slot._slot, vertices);
final result = vertices.asTypedList(worldVerticesLength).toList();
malloc.free(vertices);
return result;
}
Int32List getBones() {
final num = _bindings.spine_vertex_attachment_get_num_bones(_attachment);
final bones = _bindings.spine_region_attachment_get_bones(_attachment);
final num = _bindings.spine_vertex_attachment_get_num_bones(_attachment.cast());
final bones = _bindings.spine_region_attachment_get_bones(_attachment.cast());
return bones.asTypedList(num);
}
Float32List getVertices() {
final num = _bindings.spine_vertex_attachment_get_num_vertices(_attachment);
final vertices = _bindings.spine_region_attachment_get_vertices(_attachment);
final num = _bindings.spine_vertex_attachment_get_num_vertices(_attachment.cast());
final vertices = _bindings.spine_region_attachment_get_vertices(_attachment.cast());
return vertices.asTypedList(num);
}
Attachment? getTimelineAttachment() {
final attachment = _bindings.spine_vertex_attachment_get_timeline_attachment(_attachment);
final attachment = _bindings.spine_vertex_attachment_get_timeline_attachment(_attachment.cast());
if (_attachment.address == nullptr.address) return null;
return Attachment._toSubclass(attachment);
}
void setTimelineAttachment(Attachment? attachment) {
_bindings.spine_vertex_attachment_set_timeline_attachment(_attachment, attachment == null ? nullptr : attachment._attachment);
_bindings.spine_vertex_attachment_set_timeline_attachment(_attachment.cast(), attachment == null ? nullptr : attachment._attachment.cast());
}
}
// FIXME
class MeshAttachment extends VertexAttachment {
MeshAttachment._(spine_attachment attachment): super._(attachment);
class MeshAttachment extends VertexAttachment<spine_mesh_attachment> {
MeshAttachment._(spine_mesh_attachment attachment): super._(attachment.cast());
}
// FIXME
class ClippingAttachment extends VertexAttachment {
ClippingAttachment._(spine_attachment attachment): super._(attachment);
class ClippingAttachment extends VertexAttachment<spine_clipping_attachment> {
ClippingAttachment._(spine_clipping_attachment attachment): super._(attachment.cast());
}
// FIXME
class BoundingBoxAttachment extends VertexAttachment {
BoundingBoxAttachment._(spine_attachment attachment): super._(attachment);
class BoundingBoxAttachment extends VertexAttachment<spine_bounding_box_attachment> {
BoundingBoxAttachment._(spine_bounding_box_attachment attachment): super._(attachment);
}
// FIXME
class PathAttachment extends VertexAttachment {
PathAttachment._(spine_attachment attachment): super._(attachment);
class PathAttachment extends VertexAttachment<spine_path_attachment> {
PathAttachment._(spine_path_attachment attachment): super._(attachment);
}
class PointAttachment extends Attachment {
PointAttachment._(spine_attachment attachment): super._(attachment);
class PointAttachment extends Attachment<spine_point_attachment> {
PointAttachment._(spine_point_attachment attachment): super._(attachment);
Vector2 computeWorldPosition(Bone bone) {
final position = _bindings.spine_point_attachment_compute_world_position(_attachment, bone._bone);
@ -1248,7 +1248,7 @@ class Skin {
void setAttachment(int slotIndex, String name, Attachment? attachment) {
final nativeName = name.toNativeUtf8();
_bindings.spine_skin_set_attachment(_skin, slotIndex, nativeName.cast(), attachment == null ? nullptr : attachment._attachment);
_bindings.spine_skin_set_attachment(_skin, slotIndex, nativeName.cast(), attachment == null ? nullptr : attachment._attachment.cast());
malloc.free(nativeName);
}
@ -1306,13 +1306,13 @@ class Skin {
final type = _bindings.spine_constraint_data_get_type(nativeConstraint);
switch (type) {
case spine_constraint_type.SPINE_CONSTRAINT_IK:
constraints.add(IkConstraintData._(nativeConstraint));
constraints.add(IkConstraintData._(nativeConstraint.cast()));
break;
case spine_constraint_type.SPINE_CONSTRAINT_TRANSFORM:
constraints.add(TransformConstraintData._(nativeConstraint));
constraints.add(TransformConstraintData._(nativeConstraint.cast()));
break;
case spine_constraint_type.SPINE_CONSTRAINT_PATH:
constraints.add(PathConstraintData._(nativeConstraint));
constraints.add(PathConstraintData._(nativeConstraint.cast()));
break;
}
}
@ -1320,13 +1320,13 @@ class Skin {
}
}
class ConstraintData {
final spine_constraint_data _data;
class ConstraintData<T extends Pointer> {
final T _data;
ConstraintData._(this._data);
}
class IkConstraintData extends ConstraintData {
class IkConstraintData extends ConstraintData<spine_ik_constraint_data> {
IkConstraintData._(spine_ik_constraint_data data): super._(data);
List<BoneData> getBones() {
@ -1480,7 +1480,7 @@ class IkConstraint {
}
}
class TransformConstraintData extends ConstraintData {
class TransformConstraintData extends ConstraintData<spine_transform_constraint_data> {
TransformConstraintData._(spine_transform_constraint_data data): super._(data);
List<BoneData> getBones() {
@ -1494,7 +1494,7 @@ class TransformConstraintData extends ConstraintData {
}
BoneData getTarget() {
return BoneData._(_bindings.spine_ik_constraint_data_get_target(_data));
return BoneData._(_bindings.spine_transform_constraint_data_get_target(_data));
}
void setTarget(BoneData target) {
@ -1706,7 +1706,7 @@ class TransformConstraint {
}
}
class PathConstraintData extends ConstraintData {
class PathConstraintData extends ConstraintData<spine_path_constraint_data> {
PathConstraintData._(spine_path_constraint_data data): super._(data);
List<BoneData> getBones() {
@ -2292,7 +2292,7 @@ class TrackEntry {
/// Multiplier for the delta time when the animation state is updated, causing time for this animation to play slower or
/// faster. Defaults to 1.
double getTimeScale() {
return _bindings.spine_animation_state_get_time_scale(_entry);
return _bindings.spine_track_entry_get_time_scale(_entry);
}
void setTimeScale(double timeScale) {

View File

@ -5326,6 +5326,122 @@ class SpineFlutterBindings {
_spine_vertex_attachment_set_timeline_attachmentPtr.asFunction<
void Function(spine_vertex_attachment, spine_attachment)>();
void spine_mesh_attachment_update_region(
spine_mesh_attachment attachment,
) {
return _spine_mesh_attachment_update_region(
attachment,
);
}
late final _spine_mesh_attachment_update_regionPtr =
_lookup<ffi.NativeFunction<ffi.Void Function(spine_mesh_attachment)>>(
'spine_mesh_attachment_update_region');
late final _spine_mesh_attachment_update_region =
_spine_mesh_attachment_update_regionPtr
.asFunction<void Function(spine_mesh_attachment)>();
spine_slot_data spine_clipping_attachment_get_end_slot(
spine_clipping_attachment attachment,
) {
return _spine_clipping_attachment_get_end_slot(
attachment,
);
}
late final _spine_clipping_attachment_get_end_slotPtr = _lookup<
ffi.NativeFunction<
spine_slot_data Function(spine_clipping_attachment)>>(
'spine_clipping_attachment_get_end_slot');
late final _spine_clipping_attachment_get_end_slot =
_spine_clipping_attachment_get_end_slotPtr
.asFunction<spine_slot_data Function(spine_clipping_attachment)>();
spine_color spine_bounding_box_attachment_get_color(
spine_bounding_box_attachment attachment,
) {
return _spine_bounding_box_attachment_get_color(
attachment,
);
}
late final _spine_bounding_box_attachment_get_colorPtr = _lookup<
ffi.NativeFunction<
spine_color Function(spine_bounding_box_attachment)>>(
'spine_bounding_box_attachment_get_color');
late final _spine_bounding_box_attachment_get_color =
_spine_bounding_box_attachment_get_colorPtr
.asFunction<spine_color Function(spine_bounding_box_attachment)>();
void spine_bounding_box_attachment_set_color(
spine_bounding_box_attachment attachment,
double r,
double g,
double b,
double a,
) {
return _spine_bounding_box_attachment_set_color(
attachment,
r,
g,
b,
a,
);
}
late final _spine_bounding_box_attachment_set_colorPtr = _lookup<
ffi.NativeFunction<
ffi.Void Function(
spine_bounding_box_attachment,
ffi.Float,
ffi.Float,
ffi.Float,
ffi.Float)>>('spine_bounding_box_attachment_set_color');
late final _spine_bounding_box_attachment_set_color =
_spine_bounding_box_attachment_set_colorPtr.asFunction<
void Function(
spine_bounding_box_attachment, double, double, double, double)>();
spine_color spine_path_attachment_get_color(
spine_path_attachment attachment,
) {
return _spine_path_attachment_get_color(
attachment,
);
}
late final _spine_path_attachment_get_colorPtr =
_lookup<ffi.NativeFunction<spine_color Function(spine_path_attachment)>>(
'spine_path_attachment_get_color');
late final _spine_path_attachment_get_color =
_spine_path_attachment_get_colorPtr
.asFunction<spine_color Function(spine_path_attachment)>();
void spine_path_attachment_set_color(
spine_path_attachment attachment,
double r,
double g,
double b,
double a,
) {
return _spine_path_attachment_set_color(
attachment,
r,
g,
b,
a,
);
}
late final _spine_path_attachment_set_colorPtr = _lookup<
ffi.NativeFunction<
ffi.Void Function(spine_path_attachment, ffi.Float, ffi.Float,
ffi.Float, ffi.Float)>>('spine_path_attachment_set_color');
late final _spine_path_attachment_set_color =
_spine_path_attachment_set_colorPtr.asFunction<
void Function(
spine_path_attachment, double, double, double, double)>();
void spine_skin_set_attachment(
spine_skin skin,
int slotIndex,
@ -7672,6 +7788,68 @@ class SpineFlutterBindings {
.asFunction<void Function(spine_path_constraint, int)>();
}
class spine_skeleton_wrapper extends ffi.Opaque {}
class spine_skeleton_data_wrapper extends ffi.Opaque {}
class spine_bone_wrapper extends ffi.Opaque {}
class spine_bone_data_wrapper extends ffi.Opaque {}
class spine_slot_wrapper extends ffi.Opaque {}
class spine_slot_data_wrapper extends ffi.Opaque {}
class spine_skin_wrapper extends ffi.Opaque {}
class spine_attachment_wrapper extends ffi.Opaque {}
class spine_region_attachment_wrapper extends ffi.Opaque {}
class spine_vertex_attachment_wrapper extends ffi.Opaque {}
class spine_mesh_attachment_wrapper extends ffi.Opaque {}
class spine_clipping_attachment_wrapper extends ffi.Opaque {}
class spine_bounding_box_attachment_wrapper extends ffi.Opaque {}
class spine_path_attachment_wrapper extends ffi.Opaque {}
class spine_point_attachment_wrapper extends ffi.Opaque {}
class spine_texture_region_wrapper extends ffi.Opaque {}
class spine_sequence_wrapper extends ffi.Opaque {}
class spine_constraint_wrapper extends ffi.Opaque {}
class spine_constraint_data_wrapper extends ffi.Opaque {}
class spine_ik_constraint_wrapper extends ffi.Opaque {}
class spine_ik_constraint_data_wrapper extends ffi.Opaque {}
class spine_transform_constraint_wrapper extends ffi.Opaque {}
class spine_transform_constraint_data_wrapper extends ffi.Opaque {}
class spine_path_constraint_wrapper extends ffi.Opaque {}
class spine_path_constraint_data_wrapper extends ffi.Opaque {}
class spine_animation_state_wrapper extends ffi.Opaque {}
class spine_animation_state_events_wrapper extends ffi.Opaque {}
class spine_event_wrapper extends ffi.Opaque {}
class spine_event_data_wrapper extends ffi.Opaque {}
class spine_track_entry_wrapper extends ffi.Opaque {}
class spine_animation_wrapper extends ffi.Opaque {}
class spine_atlas extends ffi.Struct {
external ffi.Pointer<ffi.Void> atlas;
@ -7689,7 +7867,7 @@ class spine_skeleton_data_result extends ffi.Struct {
external ffi.Pointer<ffi.Int8> error;
}
typedef spine_skeleton_data = ffi.Pointer<ffi.Void>;
typedef spine_skeleton_data = ffi.Pointer<spine_skeleton_data_wrapper>;
abstract class spine_blend_mode {
static const int SPINE_BLEND_MODE_NORMAL = 0;
@ -7827,9 +8005,10 @@ class spine_skeleton_drawable extends ffi.Struct {
external ffi.Pointer<spine_render_command> renderCommand;
}
typedef spine_skeleton = ffi.Pointer<ffi.Void>;
typedef spine_animation_state = ffi.Pointer<ffi.Void>;
typedef spine_animation_state_events = ffi.Pointer<ffi.Void>;
typedef spine_skeleton = ffi.Pointer<spine_skeleton_wrapper>;
typedef spine_animation_state = ffi.Pointer<spine_animation_state_wrapper>;
typedef spine_animation_state_events
= ffi.Pointer<spine_animation_state_events_wrapper>;
class spine_skin_entry extends ffi.Struct {
@ffi.Int32()
@ -7840,7 +8019,7 @@ class spine_skin_entry extends ffi.Struct {
external spine_attachment attachment;
}
typedef spine_attachment = ffi.Pointer<ffi.Void>;
typedef spine_attachment = ffi.Pointer<spine_attachment_wrapper>;
class spine_skin_entries extends ffi.Struct {
@ffi.Int32()
@ -7849,24 +8028,34 @@ class spine_skin_entries extends ffi.Struct {
external ffi.Pointer<spine_skin_entry> entries;
}
typedef spine_bone_data = ffi.Pointer<ffi.Void>;
typedef spine_slot_data = ffi.Pointer<ffi.Void>;
typedef spine_skin = ffi.Pointer<ffi.Void>;
typedef spine_event_data = ffi.Pointer<ffi.Void>;
typedef spine_animation = ffi.Pointer<ffi.Void>;
typedef spine_ik_constraint_data = ffi.Pointer<ffi.Void>;
typedef spine_transform_constraint_data = ffi.Pointer<ffi.Void>;
typedef spine_path_constraint_data = ffi.Pointer<ffi.Void>;
typedef spine_track_entry = ffi.Pointer<ffi.Void>;
typedef spine_event = ffi.Pointer<ffi.Void>;
typedef spine_bone = ffi.Pointer<ffi.Void>;
typedef spine_slot = ffi.Pointer<ffi.Void>;
typedef spine_ik_constraint = ffi.Pointer<ffi.Void>;
typedef spine_transform_constraint = ffi.Pointer<ffi.Void>;
typedef spine_path_constraint = ffi.Pointer<ffi.Void>;
typedef spine_point_attachment = ffi.Pointer<ffi.Void>;
typedef spine_region_attachment = ffi.Pointer<ffi.Void>;
typedef spine_texture_region = ffi.Pointer<ffi.Void>;
typedef spine_sequence = ffi.Pointer<ffi.Void>;
typedef spine_vertex_attachment = ffi.Pointer<ffi.Void>;
typedef spine_constraint_data = ffi.Pointer<ffi.Void>;
typedef spine_bone_data = ffi.Pointer<spine_bone_data_wrapper>;
typedef spine_slot_data = ffi.Pointer<spine_slot_data_wrapper>;
typedef spine_skin = ffi.Pointer<spine_skin_wrapper>;
typedef spine_event_data = ffi.Pointer<spine_event_data_wrapper>;
typedef spine_animation = ffi.Pointer<spine_animation_wrapper>;
typedef spine_ik_constraint_data
= ffi.Pointer<spine_ik_constraint_data_wrapper>;
typedef spine_transform_constraint_data
= ffi.Pointer<spine_transform_constraint_data_wrapper>;
typedef spine_path_constraint_data
= ffi.Pointer<spine_path_constraint_data_wrapper>;
typedef spine_track_entry = ffi.Pointer<spine_track_entry_wrapper>;
typedef spine_event = ffi.Pointer<spine_event_wrapper>;
typedef spine_bone = ffi.Pointer<spine_bone_wrapper>;
typedef spine_slot = ffi.Pointer<spine_slot_wrapper>;
typedef spine_ik_constraint = ffi.Pointer<spine_ik_constraint_wrapper>;
typedef spine_transform_constraint
= ffi.Pointer<spine_transform_constraint_wrapper>;
typedef spine_path_constraint = ffi.Pointer<spine_path_constraint_wrapper>;
typedef spine_point_attachment = ffi.Pointer<spine_point_attachment_wrapper>;
typedef spine_region_attachment = ffi.Pointer<spine_region_attachment_wrapper>;
typedef spine_texture_region = ffi.Pointer<spine_texture_region_wrapper>;
typedef spine_sequence = ffi.Pointer<spine_sequence_wrapper>;
typedef spine_vertex_attachment = ffi.Pointer<spine_vertex_attachment_wrapper>;
typedef spine_mesh_attachment = ffi.Pointer<spine_mesh_attachment_wrapper>;
typedef spine_clipping_attachment
= ffi.Pointer<spine_clipping_attachment_wrapper>;
typedef spine_bounding_box_attachment
= ffi.Pointer<spine_bounding_box_attachment_wrapper>;
typedef spine_path_attachment = ffi.Pointer<spine_path_attachment_wrapper>;
typedef spine_constraint_data = ffi.Pointer<spine_constraint_data_wrapper>;

View File

@ -73,7 +73,7 @@ FFI_PLUGIN_EXPORT spine_skeleton_data_result spine_skeleton_data_load_json(spine
if (!skeletonData) return result;
SkeletonJson json((Atlas*)atlas->atlas);
SkeletonData *data = json.readSkeletonData(skeletonData);
result.skeletonData = data;
result.skeletonData = (spine_skeleton_data)data;
if (!json.getError().isEmpty()) {
result.error = strdup(json.getError().buffer());
}
@ -89,7 +89,7 @@ FFI_PLUGIN_EXPORT spine_skeleton_data_result spine_skeleton_data_load_binary(spi
if (length <= 0) return result;
SkeletonBinary binary((Atlas*)atlas->atlas);
SkeletonData *data = binary.readSkeletonData(skeletonData, length);
result.skeletonData = data;
result.skeletonData = (spine_skeleton_data)data;
if (!binary.getError().isEmpty()) {
result.error = strdup(binary.getError().buffer());
}
@ -99,49 +99,49 @@ FFI_PLUGIN_EXPORT spine_skeleton_data_result spine_skeleton_data_load_binary(spi
FFI_PLUGIN_EXPORT spine_bone_data spine_skeleton_data_find_bone(spine_skeleton_data data, const char *name) {
if (data == nullptr) return nullptr;
SkeletonData *_data = (SkeletonData*)data;
return _data->findBone(name);
return (spine_bone_data)_data->findBone(name);
}
FFI_PLUGIN_EXPORT spine_slot_data spine_skeleton_data_find_slot(spine_skeleton_data data, const char *name) {
if (data == nullptr) return nullptr;
SkeletonData *_data = (SkeletonData*)data;
return _data->findSlot(name);
return (spine_slot_data)_data->findSlot(name);
}
FFI_PLUGIN_EXPORT spine_skin spine_skeleton_data_find_skin(spine_skeleton_data data, const char *name) {
if (data == nullptr) return nullptr;
SkeletonData *_data = (SkeletonData*)data;
return _data->findSkin(name);
return (spine_skin)_data->findSkin(name);
}
FFI_PLUGIN_EXPORT spine_event_data spine_skeleton_data_find_event(spine_skeleton_data data, const char *name) {
if (data == nullptr) return nullptr;
SkeletonData *_data = (SkeletonData*)data;
return _data->findEvent(name);
return (spine_event_data)_data->findEvent(name);
}
FFI_PLUGIN_EXPORT spine_animation spine_skeleton_data_find_animation(spine_skeleton_data data, const char *name) {
if (data == nullptr) return nullptr;
SkeletonData *_data = (SkeletonData*)data;
return _data->findAnimation(name);
return (spine_animation)_data->findAnimation(name);
}
FFI_PLUGIN_EXPORT spine_ik_constraint_data spine_skeleton_data_find_ik_constraint(spine_skeleton_data data, const char *name) {
if (data == nullptr) return nullptr;
SkeletonData *_data = (SkeletonData*)data;
return _data->findIkConstraint(name);
return (spine_ik_constraint_data)_data->findIkConstraint(name);
}
FFI_PLUGIN_EXPORT spine_transform_constraint_data spine_skeleton_data_find_transform_constraint(spine_skeleton_data data, const char *name) {
if (data == nullptr) return nullptr;
SkeletonData *_data = (SkeletonData*)data;
return _data->findTransformConstraint(name);
return (spine_transform_constraint_data)_data->findTransformConstraint(name);
}
FFI_PLUGIN_EXPORT spine_path_constraint_data spine_skeleton_data_find_path_constraint(spine_skeleton_data data, const char *name) {
if (data == nullptr) return nullptr;
SkeletonData *_data = (SkeletonData*)data;
return _data->findPathConstraint(name);
return (spine_path_constraint_data)_data->findPathConstraint(name);
}
FFI_PLUGIN_EXPORT const char* spine_skeleton_data_get_name(spine_skeleton_data data) {
@ -159,7 +159,7 @@ FFI_PLUGIN_EXPORT int spine_skeleton_data_get_num_bones(spine_skeleton_data data
FFI_PLUGIN_EXPORT spine_bone_data* spine_skeleton_data_get_bones(spine_skeleton_data data) {
if (data == nullptr) return nullptr;
SkeletonData *_data = (SkeletonData*)data;
return (void**)_data->getBones().buffer();
return (spine_bone_data*)_data->getBones().buffer();
}
FFI_PLUGIN_EXPORT int spine_skeleton_data_get_num_slots(spine_skeleton_data data) {
@ -171,7 +171,7 @@ FFI_PLUGIN_EXPORT int spine_skeleton_data_get_num_slots(spine_skeleton_data data
FFI_PLUGIN_EXPORT spine_slot_data* spine_skeleton_data_get_slots(spine_skeleton_data data) {
if (data == nullptr) return nullptr;
SkeletonData *_data = (SkeletonData*)data;
return (void**)_data->getSlots().buffer();
return (spine_slot_data*)_data->getSlots().buffer();
}
FFI_PLUGIN_EXPORT int spine_skeleton_data_get_num_skins(spine_skeleton_data data) {
@ -183,13 +183,13 @@ FFI_PLUGIN_EXPORT int spine_skeleton_data_get_num_skins(spine_skeleton_data data
FFI_PLUGIN_EXPORT spine_skin* spine_skeleton_data_get_skins(spine_skeleton_data data) {
if (data == nullptr) return nullptr;
SkeletonData *_data = (SkeletonData*)data;
return (void**)_data->getSkins().buffer();
return (spine_skin*)_data->getSkins().buffer();
}
FFI_PLUGIN_EXPORT spine_skin spine_skeleton_data_get_default_skin(spine_skeleton_data data) {
if (data == nullptr) return nullptr;
SkeletonData *_data = (SkeletonData*)data;
return _data->getDefaultSkin();
return (spine_skin)_data->getDefaultSkin();
}
FFI_PLUGIN_EXPORT void spine_skeleton_data_set_default_skin(spine_skeleton_data data, spine_skin skin) {
@ -207,7 +207,7 @@ FFI_PLUGIN_EXPORT int spine_skeleton_data_get_num_events(spine_skeleton_data dat
FFI_PLUGIN_EXPORT spine_event_data* spine_skeleton_data_get_events(spine_skeleton_data data) {
if (data == nullptr) return nullptr;
SkeletonData *_data = (SkeletonData*)data;
return (void**)_data->getEvents().buffer();
return (spine_event_data*)_data->getEvents().buffer();
}
FFI_PLUGIN_EXPORT int spine_skeleton_data_get_num_animations(spine_skeleton_data data) {
@ -219,7 +219,7 @@ FFI_PLUGIN_EXPORT int spine_skeleton_data_get_num_animations(spine_skeleton_data
FFI_PLUGIN_EXPORT spine_animation* spine_skeleton_data_get_animations(spine_skeleton_data data) {
if (data == nullptr) return nullptr;
SkeletonData *_data = (SkeletonData*)data;
return (void**)_data->getAnimations().buffer();
return (spine_animation*)_data->getAnimations().buffer();
}
FFI_PLUGIN_EXPORT int spine_skeleton_data_get_num_ik_constraints(spine_skeleton_data data) {
@ -231,7 +231,7 @@ FFI_PLUGIN_EXPORT int spine_skeleton_data_get_num_ik_constraints(spine_skeleton_
FFI_PLUGIN_EXPORT spine_ik_constraint_data* spine_skeleton_data_get_ik_constraints(spine_skeleton_data data) {
if (data == nullptr) return nullptr;
SkeletonData *_data = (SkeletonData*)data;
return (void**)_data->getIkConstraints().buffer();
return (spine_ik_constraint_data*)_data->getIkConstraints().buffer();
}
FFI_PLUGIN_EXPORT int spine_skeleton_data_get_num_transform_constraints(spine_skeleton_data data) {
@ -243,7 +243,7 @@ FFI_PLUGIN_EXPORT int spine_skeleton_data_get_num_transform_constraints(spine_sk
FFI_PLUGIN_EXPORT spine_transform_constraint_data* spine_skeleton_data_get_transform_constraints(spine_skeleton_data data) {
if (data == nullptr) return nullptr;
SkeletonData *_data = (SkeletonData*)data;
return (void**)_data->getTransformConstraints().buffer();
return (spine_transform_constraint_data*)_data->getTransformConstraints().buffer();
}
FFI_PLUGIN_EXPORT int spine_skeleton_data_get_num_path_constraints(spine_skeleton_data data) {
@ -255,7 +255,7 @@ FFI_PLUGIN_EXPORT int spine_skeleton_data_get_num_path_constraints(spine_skeleto
FFI_PLUGIN_EXPORT spine_path_constraint_data* spine_skeleton_data_get_path_constraints(spine_skeleton_data data) {
if (data == nullptr) return nullptr;
SkeletonData *_data = (SkeletonData*)data;
return (void**)_data->getPathConstraints().buffer();
return (spine_path_constraint_data*)_data->getPathConstraints().buffer();
}
FFI_PLUGIN_EXPORT float spine_skeleton_data_get_x(spine_skeleton_data data) {
@ -369,12 +369,12 @@ void spine_render_command_dispose(spine_render_command *cmd) {
FFI_PLUGIN_EXPORT spine_skeleton_drawable *spine_skeleton_drawable_create(spine_skeleton_data skeletonData) {
spine_skeleton_drawable *drawable = SpineExtension::calloc<spine_skeleton_drawable>(1, __FILE__, __LINE__);
drawable->skeleton = new (__FILE__, __LINE__) Skeleton((SkeletonData*)skeletonData);
drawable->skeleton = (spine_skeleton)new (__FILE__, __LINE__) Skeleton((SkeletonData*)skeletonData);
AnimationState *state = new (__FILE__, __LINE__) AnimationState(new AnimationStateData((SkeletonData*)skeletonData));
drawable->animationState = state;
drawable->animationState = (spine_animation_state)state;
state->setManualTrackEntryDisposal(true);
EventListener *listener = new EventListener();
drawable->animationStateEvents = listener;
drawable->animationStateEvents = (spine_animation_state_events)listener;
state->setListener(listener);
drawable->clipping = new (__FILE__, __LINE__) SkeletonClipping();
return drawable;
@ -568,25 +568,25 @@ FFI_PLUGIN_EXPORT void spine_animation_state_clear_track(spine_animation_state s
FFI_PLUGIN_EXPORT spine_track_entry spine_animation_state_set_animation(spine_animation_state state, int trackIndex, const char* animationName, int loop) {
if (state == nullptr) return nullptr;
AnimationState *_state = (AnimationState*)state;
return _state->setAnimation(trackIndex, animationName, loop);
return (spine_track_entry)_state->setAnimation(trackIndex, animationName, loop);
}
FFI_PLUGIN_EXPORT spine_track_entry spine_animation_state_add_animation(spine_animation_state state, int trackIndex, const char* animationName, int loop, float delay) {
if (state == nullptr) return nullptr;
AnimationState *_state = (AnimationState*)state;
return _state->addAnimation(trackIndex, animationName, loop, delay);
return (spine_track_entry)_state->addAnimation(trackIndex, animationName, loop, delay);
}
FFI_PLUGIN_EXPORT spine_track_entry spine_animation_state_set_empty_animation(spine_animation_state state, int trackIndex, float mixDuration) {
if (state == nullptr) return nullptr;
AnimationState *_state = (AnimationState*)state;
return _state->setEmptyAnimation(trackIndex, mixDuration);
return (spine_track_entry)_state->setEmptyAnimation(trackIndex, mixDuration);
}
FFI_PLUGIN_EXPORT spine_track_entry spine_animation_state_add_empty_animation(spine_animation_state state, int trackIndex, float mixDuration, float delay) {
if (state == nullptr) return nullptr;
AnimationState *_state = (AnimationState*)state;
return _state->addEmptyAnimation(trackIndex, mixDuration, delay);
return (spine_track_entry)_state->addEmptyAnimation(trackIndex, mixDuration, delay);
}
FFI_PLUGIN_EXPORT void spine_animation_state_set_empty_animations(spine_animation_state state, float mixDuration) {
@ -598,7 +598,7 @@ FFI_PLUGIN_EXPORT void spine_animation_state_set_empty_animations(spine_animatio
FFI_PLUGIN_EXPORT spine_track_entry spine_animation_state_get_current(spine_animation_state state, int trackIndex) {
if (state == nullptr) return nullptr;
AnimationState *_state = (AnimationState*)state;
return _state->getCurrent(trackIndex);
return (spine_track_entry)_state->getCurrent(trackIndex);
}
FFI_PLUGIN_EXPORT float spine_animation_state_get_time_scale(spine_animation_state state) {
@ -638,7 +638,7 @@ FFI_PLUGIN_EXPORT spine_event spine_animation_state_events_get_event(spine_anima
if (events == nullptr) return nullptr;
EventListener *_events = (EventListener*)events;
if (index >= _events->events.size()) return nullptr;
return (spine_track_entry)_events->events[index].event;
return (spine_event)_events->events[index].event;
}
FFI_PLUGIN_EXPORT void spine_animation_state_events_reset(spine_animation_state_events events) {
@ -658,13 +658,13 @@ FFI_PLUGIN_EXPORT int spine_track_entry_get_track_index(spine_track_entry entry)
FFI_PLUGIN_EXPORT spine_animation spine_track_entry_get_animation(spine_track_entry entry) {
if (entry == nullptr) return nullptr;
TrackEntry *_entry = (TrackEntry*)entry;
return _entry->getAnimation();
return (spine_animation)_entry->getAnimation();
}
FFI_PLUGIN_EXPORT spine_track_entry spine_track_entry_get_previous(spine_track_entry entry) {
if (entry == nullptr) return nullptr;
TrackEntry *_entry = (TrackEntry*)entry;
return _entry->getPrevious();
return (spine_track_entry)_entry->getPrevious();
}
FFI_PLUGIN_EXPORT int spine_track_entry_get_loop(spine_track_entry entry) {
@ -856,7 +856,7 @@ FFI_PLUGIN_EXPORT void spine_track_entry_set_draw_order_threshold(spine_track_en
FFI_PLUGIN_EXPORT spine_track_entry spine_track_entry_get_next(spine_track_entry entry) {
if (entry == nullptr) return nullptr;
TrackEntry *_entry = (TrackEntry*)entry;
return _entry->getNext();
return (spine_track_entry)_entry->getNext();
}
FFI_PLUGIN_EXPORT int spine_track_entry_is_complete(spine_track_entry entry) {
@ -904,13 +904,13 @@ FFI_PLUGIN_EXPORT void spine_track_entry_set_mix_blend(spine_track_entry entry,
FFI_PLUGIN_EXPORT spine_track_entry spine_track_entry_get_mixing_from(spine_track_entry entry) {
if (entry == nullptr) return nullptr;
TrackEntry *_entry = (TrackEntry*)entry;
return _entry->getMixingFrom();
return (spine_track_entry)_entry->getMixingFrom();
}
FFI_PLUGIN_EXPORT spine_track_entry spine_track_entry_get_mixing_to(spine_track_entry entry) {
if (entry == nullptr) return nullptr;
TrackEntry *_entry = (TrackEntry*)entry;
return _entry->getMixingTo();
return (spine_track_entry)_entry->getMixingTo();
}
FFI_PLUGIN_EXPORT void spine_track_entry_reset_rotation_directions(spine_track_entry entry) {
@ -968,13 +968,13 @@ FFI_PLUGIN_EXPORT void spine_skeleton_set_slots_to_setup_pose(spine_skeleton ske
FFI_PLUGIN_EXPORT spine_bone spine_skeleton_find_bone(spine_skeleton skeleton, const char* boneName) {
if (skeleton == nullptr) return nullptr;
Skeleton *_skeleton = (Skeleton*)skeleton;
return _skeleton->findBone(boneName);
return (spine_bone)_skeleton->findBone(boneName);
}
FFI_PLUGIN_EXPORT spine_slot spine_skeleton_find_slot(spine_skeleton skeleton, const char* slotName) {
if (skeleton == nullptr) return nullptr;
Skeleton *_skeleton = (Skeleton*)skeleton;
return _skeleton->findSlot(slotName);
return (spine_slot)_skeleton->findSlot(slotName);
}
FFI_PLUGIN_EXPORT void spine_skeleton_set_skin_by_name(spine_skeleton skeleton, const char* skinName) {
@ -993,13 +993,13 @@ FFI_PLUGIN_EXPORT void spine_skeleton_set_skin(spine_skeleton skeleton, spine_sk
FFI_PLUGIN_EXPORT spine_attachment spine_skeleton_get_attachment_by_name(spine_skeleton skeleton, const char* slotName, const char* attachmentName) {
if (skeleton == nullptr) return nullptr;
Skeleton *_skeleton = (Skeleton*)skeleton;
return _skeleton->getAttachment(slotName, attachmentName);
return (spine_attachment)_skeleton->getAttachment(slotName, attachmentName);
}
FFI_PLUGIN_EXPORT spine_attachment spine_skeleton_get_attachment(spine_skeleton skeleton, int slotIndex, const char* attachmentName) {
if (skeleton == nullptr) return nullptr;
Skeleton *_skeleton = (Skeleton*)skeleton;
return _skeleton->getAttachment(slotIndex, attachmentName);
return (spine_attachment)_skeleton->getAttachment(slotIndex, attachmentName);
}
FFI_PLUGIN_EXPORT void spine_skeleton_set_attachment(spine_skeleton skeleton, const char* slotName, const char* attachmentName) {
@ -1011,19 +1011,19 @@ FFI_PLUGIN_EXPORT void spine_skeleton_set_attachment(spine_skeleton skeleton, co
FFI_PLUGIN_EXPORT spine_ik_constraint spine_skeleton_find_ik_constraint(spine_skeleton skeleton, const char* constraintName) {
if (skeleton == nullptr) return nullptr;
Skeleton *_skeleton = (Skeleton*)skeleton;
return _skeleton->findIkConstraint(constraintName);
return (spine_ik_constraint)_skeleton->findIkConstraint(constraintName);
}
FFI_PLUGIN_EXPORT spine_transform_constraint spine_skeleton_find_transform_constraint(spine_skeleton skeleton, const char* constraintName) {
if (skeleton == nullptr) return nullptr;
Skeleton *_skeleton = (Skeleton*)skeleton;
return _skeleton->findTransformConstraint(constraintName);
return (spine_transform_constraint)_skeleton->findTransformConstraint(constraintName);
}
FFI_PLUGIN_EXPORT spine_path_constraint spine_skeleton_find_path_constraint(spine_skeleton skeleton, const char* constraintName) {
if (skeleton == nullptr) return nullptr;
Skeleton *_skeleton = (Skeleton*)skeleton;
return _skeleton->findPathConstraint(constraintName);
return (spine_path_constraint)_skeleton->findPathConstraint(constraintName);
}
FFI_PLUGIN_EXPORT spine_bounds spine_skeleton_get_bounds(spine_skeleton skeleton) {
@ -1038,13 +1038,13 @@ FFI_PLUGIN_EXPORT spine_bounds spine_skeleton_get_bounds(spine_skeleton skeleton
FFI_PLUGIN_EXPORT spine_bone spine_skeleton_get_root_bone(spine_skeleton skeleton) {
if (skeleton == nullptr) return nullptr;
Skeleton *_skeleton = (Skeleton*)skeleton;
return _skeleton->getRootBone();
return (spine_bone)_skeleton->getRootBone();
}
FFI_PLUGIN_EXPORT spine_skeleton_data spine_skeleton_get_data(spine_skeleton skeleton) {
if (skeleton == nullptr) return nullptr;
Skeleton *_skeleton = (Skeleton*)skeleton;
return _skeleton->getData();
return (spine_skeleton_data)_skeleton->getData();
}
FFI_PLUGIN_EXPORT int spine_skeleton_get_num_bones(spine_skeleton skeleton) {
@ -1056,7 +1056,7 @@ FFI_PLUGIN_EXPORT int spine_skeleton_get_num_bones(spine_skeleton skeleton) {
FFI_PLUGIN_EXPORT spine_bone* spine_skeleton_get_bones(spine_skeleton skeleton) {
if (skeleton == nullptr) return nullptr;
Skeleton *_skeleton = (Skeleton*)skeleton;
return (void**)_skeleton->getBones().buffer();
return (spine_bone*)_skeleton->getBones().buffer();
}
FFI_PLUGIN_EXPORT int spine_skeleton_get_num_slots(spine_skeleton skeleton) {
@ -1068,7 +1068,7 @@ FFI_PLUGIN_EXPORT int spine_skeleton_get_num_slots(spine_skeleton skeleton) {
FFI_PLUGIN_EXPORT spine_slot* spine_skeleton_get_slots(spine_skeleton skeleton) {
if (skeleton == nullptr) return nullptr;
Skeleton *_skeleton = (Skeleton*)skeleton;
return (void**)_skeleton->getSlots().buffer();
return (spine_slot*)_skeleton->getSlots().buffer();
}
FFI_PLUGIN_EXPORT int spine_skeleton_get_num_draw_order(spine_skeleton skeleton) {
@ -1080,7 +1080,7 @@ FFI_PLUGIN_EXPORT int spine_skeleton_get_num_draw_order(spine_skeleton skeleton)
FFI_PLUGIN_EXPORT spine_slot* spine_skeleton_get_draw_order(spine_skeleton skeleton) {
if (skeleton == nullptr) return nullptr;
Skeleton *_skeleton = (Skeleton*)skeleton;
return (void**)_skeleton->getDrawOrder().buffer();
return (spine_slot*)_skeleton->getDrawOrder().buffer();
}
FFI_PLUGIN_EXPORT int spine_skeleton_get_num_ik_constraints(spine_skeleton skeleton) {
@ -1092,7 +1092,7 @@ FFI_PLUGIN_EXPORT int spine_skeleton_get_num_ik_constraints(spine_skeleton skele
FFI_PLUGIN_EXPORT spine_ik_constraint* spine_skeleton_get_ik_constraints(spine_skeleton skeleton) {
if (skeleton == nullptr) return nullptr;
Skeleton *_skeleton = (Skeleton*)skeleton;
return (void**)_skeleton->getIkConstraints().buffer();
return (spine_ik_constraint*)_skeleton->getIkConstraints().buffer();
}
FFI_PLUGIN_EXPORT int spine_skeleton_get_num_transform_constraints(spine_skeleton skeleton) {
@ -1104,7 +1104,7 @@ FFI_PLUGIN_EXPORT int spine_skeleton_get_num_transform_constraints(spine_skeleto
FFI_PLUGIN_EXPORT spine_transform_constraint* spine_skeleton_get_transform_constraints(spine_skeleton skeleton) {
if (skeleton == nullptr) return nullptr;
Skeleton *_skeleton = (Skeleton*)skeleton;
return (void**)_skeleton->getTransformConstraints().buffer();
return (spine_transform_constraint*)_skeleton->getTransformConstraints().buffer();
}
FFI_PLUGIN_EXPORT int spine_skeleton_get_num_path_constraints(spine_skeleton skeleton) {
@ -1116,13 +1116,13 @@ FFI_PLUGIN_EXPORT int spine_skeleton_get_num_path_constraints(spine_skeleton ske
FFI_PLUGIN_EXPORT spine_path_constraint* spine_skeleton_get_path_constraints(spine_skeleton skeleton) {
if (skeleton == nullptr) return nullptr;
Skeleton *_skeleton = (Skeleton*)skeleton;
return (void**)_skeleton->getPathConstraints().buffer();
return (spine_path_constraint*)_skeleton->getPathConstraints().buffer();
}
FFI_PLUGIN_EXPORT spine_skin spine_skeleton_get_skin(spine_skeleton skeleton) {
if (skeleton == nullptr) return nullptr;
Skeleton *_skeleton = (Skeleton*)skeleton;
return _skeleton->getSkin();
return (spine_skin)_skeleton->getSkin();
}
FFI_PLUGIN_EXPORT spine_color spine_skeleton_get_color(spine_skeleton skeleton) {
@ -1298,7 +1298,7 @@ FFI_PLUGIN_EXPORT const char* spine_slot_data_get_name(spine_slot_data slot) {
FFI_PLUGIN_EXPORT spine_bone_data spine_slot_data_get_bone_data(spine_slot_data slot) {
if (slot == nullptr) return nullptr;
SlotData *_slot = (SlotData*)slot;
return &_slot->getBoneData();
return (spine_bone_data)&_slot->getBoneData();
}
FFI_PLUGIN_EXPORT spine_color spine_slot_data_get_color(spine_slot_data slot) {
@ -1369,19 +1369,19 @@ FFI_PLUGIN_EXPORT void spine_slot_set_to_setup_pose(spine_slot slot) {
FFI_PLUGIN_EXPORT spine_slot_data spine_slot_get_data(spine_slot slot) {
if (slot == nullptr) return nullptr;
Slot *_slot = (Slot*)slot;
return &_slot->getData();
return (spine_slot_data)&_slot->getData();
}
FFI_PLUGIN_EXPORT spine_bone spine_slot_get_bone(spine_slot slot) {
if (slot == nullptr) return nullptr;
Slot *_slot = (Slot*)slot;
return &_slot->getBone();
return (spine_bone)&_slot->getBone();
}
FFI_PLUGIN_EXPORT spine_skeleton spine_slot_get_skeleton(spine_slot slot) {
if (slot == nullptr) return nullptr;
Slot *_slot = (Slot*)slot;
return &_slot->getSkeleton();
return (spine_skeleton)&_slot->getSkeleton();
}
FFI_PLUGIN_EXPORT spine_color spine_slot_get_color(spine_slot slot) {
@ -1421,7 +1421,7 @@ FFI_PLUGIN_EXPORT int spine_slot_has_dark_color(spine_slot slot) {
FFI_PLUGIN_EXPORT spine_attachment spine_slot_get_attachment(spine_slot slot) {
if (slot == nullptr) return nullptr;
Slot *_slot = (Slot*)slot;
return _slot->getAttachment();
return (spine_attachment)_slot->getAttachment();
}
FFI_PLUGIN_EXPORT void spine_slot_set_attachment(spine_slot slot, spine_attachment attachment) {
@ -1446,7 +1446,7 @@ FFI_PLUGIN_EXPORT const char* spine_bone_data_get_name(spine_bone_data data) {
FFI_PLUGIN_EXPORT spine_bone_data spine_bone_data_get_parent(spine_bone_data data) {
if (data == nullptr) return nullptr;
BoneData *_data = (BoneData*)data;
return _data->getParent();
return (spine_bone_data)_data->getParent();
}
FFI_PLUGIN_EXPORT float spine_bone_data_get_length(spine_bone_data data) {
@ -1657,19 +1657,19 @@ FFI_PLUGIN_EXPORT float spine_bone_get_world_to_local_rotation_y(spine_bone bone
FFI_PLUGIN_EXPORT spine_bone_data spine_bone_get_data(spine_bone bone) {
if (bone == nullptr) return nullptr;
Bone *_bone = (Bone*)bone;
return &_bone->getData();
return (spine_bone_data)&_bone->getData();
}
FFI_PLUGIN_EXPORT spine_skeleton spine_bone_get_skeleton(spine_bone bone) {
if (bone == nullptr) return nullptr;
Bone *_bone = (Bone*)bone;
return &_bone->getSkeleton();
return (spine_skeleton)&_bone->getSkeleton();
}
FFI_PLUGIN_EXPORT spine_bone spine_bone_get_parent(spine_bone bone) {
if (bone == nullptr) return nullptr;
Bone *_bone = (Bone*)bone;
return _bone->getParent();
return (spine_bone)_bone->getParent();
}
FFI_PLUGIN_EXPORT int spine_bone_get_num_children(spine_bone bone) {
@ -2259,7 +2259,7 @@ FFI_PLUGIN_EXPORT float *spine_region_attachment_get_vertices(spine_region_attac
FFI_PLUGIN_EXPORT spine_attachment spine_vertex_attachment_get_timeline_attachment(spine_vertex_attachment attachment) {
if (attachment == nullptr) return nullptr;
VertexAttachment *_attachment = (VertexAttachment*)attachment;
return _attachment->getTimelineAttachment();
return (spine_attachment)_attachment->getTimelineAttachment();
}
FFI_PLUGIN_EXPORT void spine_vertex_attachment_set_timeline_attachment(spine_vertex_attachment attachment, spine_attachment timelineAttachment) {
@ -2278,7 +2278,7 @@ FFI_PLUGIN_EXPORT void spine_skin_set_attachment(spine_skin skin, int slotIndex,
FFI_PLUGIN_EXPORT spine_attachment spine_skin_get_attachment(spine_skin skin, int slotIndex, const char* name) {
if (skin == nullptr) return nullptr;
Skin *_skin = (Skin*)skin;
return _skin->getAttachment(slotIndex, name);
return (spine_attachment)_skin->getAttachment(slotIndex, name);
}
FFI_PLUGIN_EXPORT void spine_skin_remove_attachment(spine_skin skin, int slotIndex, const char* name) {
@ -2314,7 +2314,7 @@ FFI_PLUGIN_EXPORT spine_skin_entries *spine_skin_get_entries(spine_skin skin) {
int i = 0;
while (mapEntries.hasNext()) {
Skin::AttachmentMap::Entry entry = mapEntries.next();
entries->entries[i++] = { (int)entry._slotIndex, entry._name.buffer(), entry._attachment };
entries->entries[i++] = { (int)entry._slotIndex, entry._name.buffer(), (spine_attachment)entry._attachment };
}
}
return entries;
@ -2352,7 +2352,7 @@ FFI_PLUGIN_EXPORT spine_constraint_data* spine_skin_get_constraints(spine_skin s
FFI_PLUGIN_EXPORT spine_skin spine_skin_create(const char* name) {
if (name == nullptr) return nullptr;
return new (__FILE__, __LINE__) Skin(name);
return (spine_skin)new (__FILE__, __LINE__) Skin(name);
}
FFI_PLUGIN_EXPORT void spine_skin_dispose(spine_skin skin) {
@ -2391,7 +2391,7 @@ FFI_PLUGIN_EXPORT spine_bone_data* spine_ik_constraint_data_get_bones(spine_ik_c
FFI_PLUGIN_EXPORT spine_bone_data spine_ik_constraint_data_get_target(spine_ik_constraint_data data) {
if (data == nullptr) return nullptr;
IkConstraintData *_data = (IkConstraintData*)data;
return _data->getTarget();
return (spine_bone_data)_data->getTarget();
}
FFI_PLUGIN_EXPORT void spine_ik_constraint_data_set_target(spine_ik_constraint_data data, spine_bone_data target) {
@ -2597,7 +2597,7 @@ FFI_PLUGIN_EXPORT spine_bone_data* spine_transform_constraint_data_get_bones(spi
FFI_PLUGIN_EXPORT spine_bone_data spine_transform_constraint_data_get_target(spine_transform_constraint_data data) {
if (data == nullptr) return nullptr;
TransformConstraintData *_data = (TransformConstraintData*)data;
return _data->getTarget();
return (spine_bone_data)_data->getTarget();
}
FFI_PLUGIN_EXPORT void spine_transform_constraint_data_set_target(spine_transform_constraint_data data, spine_bone_data target) {
@ -2808,7 +2808,7 @@ FFI_PLUGIN_EXPORT spine_bone* spine_transform_constraint_get_bones(spine_transfo
FFI_PLUGIN_EXPORT spine_bone spine_transform_constraint_get_target(spine_transform_constraint constraint) {
if (constraint == nullptr) return nullptr;
TransformConstraint *_constraint = (TransformConstraint*)constraint;
return _constraint->getTarget();
return (spine_bone)_constraint->getTarget();
}
FFI_PLUGIN_EXPORT void spine_transform_constraint_set_target(spine_transform_constraint constraint, spine_bone target) {

View File

@ -23,40 +23,41 @@
#endif
#endif
typedef void* spine_skeleton;
typedef void* spine_skeleton_data;
typedef void* spine_bone;
typedef void* spine_bone_data;
typedef void* spine_slot;
typedef void* spine_slot_data;
typedef void* spine_skin;
typedef void* spine_attachment;
typedef void* spine_region_attachment;
typedef void* spine_vertex_attachment;
typedef void* spine_mesh_attachment;
typedef void* spine_clipping_attachment;
typedef void* spine_path_attachment;
typedef void* spine_point_attachment;
typedef void* spine_texture_region;
typedef void* spine_sequence;
typedef void* spine_mesh_attachment;
typedef void* spine_clipping_attachment;
typedef void* spine_bounding_box_attachment;
typedef void* spine_path_attachment;
typedef void* spine_constraint;
typedef void* spine_constraint_data;
typedef void* spine_ik_constraint;
typedef void* spine_ik_constraint_data;
typedef void* spine_transform_constraint;
typedef void* spine_transform_constraint_data;
typedef void* spine_path_constraint;
typedef void* spine_path_constraint_data;
typedef void* spine_animation_state;
typedef void* spine_animation_state_events;
typedef void* spine_event;
typedef void* spine_event_data;
typedef void* spine_track_entry;
typedef void* spine_animation;
#define SPINE_OPAQUE_TYPE(name) \
typedef struct name##_wrapper {} name##_wrapper; \
typedef name##_wrapper *name;
SPINE_OPAQUE_TYPE(spine_skeleton)
SPINE_OPAQUE_TYPE(spine_skeleton_data)
SPINE_OPAQUE_TYPE(spine_bone)
SPINE_OPAQUE_TYPE(spine_bone_data)
SPINE_OPAQUE_TYPE(spine_slot)
SPINE_OPAQUE_TYPE(spine_slot_data)
SPINE_OPAQUE_TYPE(spine_skin)
SPINE_OPAQUE_TYPE(spine_attachment)
SPINE_OPAQUE_TYPE(spine_region_attachment)
SPINE_OPAQUE_TYPE(spine_vertex_attachment)
SPINE_OPAQUE_TYPE(spine_mesh_attachment)
SPINE_OPAQUE_TYPE(spine_clipping_attachment)
SPINE_OPAQUE_TYPE(spine_bounding_box_attachment)
SPINE_OPAQUE_TYPE(spine_path_attachment)
SPINE_OPAQUE_TYPE(spine_point_attachment)
SPINE_OPAQUE_TYPE(spine_texture_region)
SPINE_OPAQUE_TYPE(spine_sequence)
SPINE_OPAQUE_TYPE(spine_constraint)
SPINE_OPAQUE_TYPE(spine_constraint_data)
SPINE_OPAQUE_TYPE(spine_ik_constraint)
SPINE_OPAQUE_TYPE(spine_ik_constraint_data)
SPINE_OPAQUE_TYPE(spine_transform_constraint)
SPINE_OPAQUE_TYPE(spine_transform_constraint_data)
SPINE_OPAQUE_TYPE(spine_path_constraint)
SPINE_OPAQUE_TYPE(spine_path_constraint_data)
SPINE_OPAQUE_TYPE(spine_animation_state)
SPINE_OPAQUE_TYPE(spine_animation_state_events)
SPINE_OPAQUE_TYPE(spine_event)
SPINE_OPAQUE_TYPE(spine_event_data)
SPINE_OPAQUE_TYPE(spine_track_entry)
SPINE_OPAQUE_TYPE(spine_animation)
typedef struct spine_atlas {
void *atlas;
@ -528,6 +529,16 @@ FFI_PLUGIN_EXPORT float *spine_region_attachment_get_vertices(spine_region_attac
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);
FFI_PLUGIN_EXPORT void spine_mesh_attachment_update_region(spine_mesh_attachment attachment);
FFI_PLUGIN_EXPORT spine_slot_data spine_clipping_attachment_get_end_slot(spine_clipping_attachment attachment);
FFI_PLUGIN_EXPORT spine_color spine_bounding_box_attachment_get_color(spine_bounding_box_attachment attachment);
FFI_PLUGIN_EXPORT void spine_bounding_box_attachment_set_color(spine_bounding_box_attachment attachment, float r, float g, float b, float a);
FFI_PLUGIN_EXPORT spine_color spine_path_attachment_get_color(spine_path_attachment attachment);
FFI_PLUGIN_EXPORT void spine_path_attachment_set_color(spine_path_attachment attachment, float r, float g, float b, float a);
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);