diff --git a/spine-flutter/lib/spine_flutter_bindings_generated.dart b/spine-flutter/lib/spine_flutter_bindings_generated.dart index a59015d02..353530b73 100644 --- a/spine-flutter/lib/spine_flutter_bindings_generated.dart +++ b/spine-flutter/lib/spine_flutter_bindings_generated.dart @@ -3238,6 +3238,965 @@ class SpineFlutterBindings { 'spine_bone_data_get_color'); late final _spine_bone_data_get_color = _spine_bone_data_get_colorPtr .asFunction(); + + void spine_bone_update( + spine_bone bone, + ) { + return _spine_bone_update( + bone, + ); + } + + late final _spine_bone_updatePtr = + _lookup>( + 'spine_bone_update'); + late final _spine_bone_update = + _spine_bone_updatePtr.asFunction(); + + void spine_bone_update_world_transform( + spine_bone bone, + ) { + return _spine_bone_update_world_transform( + bone, + ); + } + + late final _spine_bone_update_world_transformPtr = + _lookup>( + 'spine_bone_update_world_transform'); + late final _spine_bone_update_world_transform = + _spine_bone_update_world_transformPtr + .asFunction(); + + void spine_bone_update_world_transform_with( + spine_bone bone, + double x, + double y, + double rotation, + double scaleX, + double scaleY, + double shearX, + double shearY, + ) { + return _spine_bone_update_world_transform_with( + bone, + x, + y, + rotation, + scaleX, + scaleY, + shearX, + shearY, + ); + } + + late final _spine_bone_update_world_transform_withPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + spine_bone, + ffi.Float, + ffi.Float, + ffi.Float, + ffi.Float, + ffi.Float, + ffi.Float, + ffi.Float)>>('spine_bone_update_world_transform_with'); + late final _spine_bone_update_world_transform_with = + _spine_bone_update_world_transform_withPtr.asFunction< + void Function(spine_bone, double, double, double, double, double, + double, double)>(); + + void spine_bone_set_to_setup_pose( + spine_bone bone, + ) { + return _spine_bone_set_to_setup_pose( + bone, + ); + } + + late final _spine_bone_set_to_setup_posePtr = + _lookup>( + 'spine_bone_set_to_setup_pose'); + late final _spine_bone_set_to_setup_pose = + _spine_bone_set_to_setup_posePtr.asFunction(); + + spine_vector spine_bone_world_to_local( + spine_bone bone, + double worldX, + double worldY, + ) { + return _spine_bone_world_to_local( + bone, + worldX, + worldY, + ); + } + + late final _spine_bone_world_to_localPtr = _lookup< + ffi.NativeFunction< + spine_vector Function( + spine_bone, ffi.Float, ffi.Float)>>('spine_bone_world_to_local'); + late final _spine_bone_world_to_local = _spine_bone_world_to_localPtr + .asFunction(); + + spine_vector spine_bone_local_to_world( + spine_bone bone, + double localX, + double localY, + ) { + return _spine_bone_local_to_world( + bone, + localX, + localY, + ); + } + + late final _spine_bone_local_to_worldPtr = _lookup< + ffi.NativeFunction< + spine_vector Function( + spine_bone, ffi.Float, ffi.Float)>>('spine_bone_local_to_world'); + late final _spine_bone_local_to_world = _spine_bone_local_to_worldPtr + .asFunction(); + + double spine_bone_world_to_local_rotation( + spine_bone bone, + double worldRotation, + ) { + return _spine_bone_world_to_local_rotation( + bone, + worldRotation, + ); + } + + late final _spine_bone_world_to_local_rotationPtr = + _lookup>( + 'spine_bone_world_to_local_rotation'); + late final _spine_bone_world_to_local_rotation = + _spine_bone_world_to_local_rotationPtr + .asFunction(); + + double spine_bone_local_to_worldrotation( + spine_bone bone, + double localRotation, + ) { + return _spine_bone_local_to_worldrotation( + bone, + localRotation, + ); + } + + late final _spine_bone_local_to_worldrotationPtr = + _lookup>( + 'spine_bone_local_to_worldrotation'); + late final _spine_bone_local_to_worldrotation = + _spine_bone_local_to_worldrotationPtr + .asFunction(); + + void spine_bone_rotateWorld( + spine_bone bone, + double degrees, + ) { + return _spine_bone_rotateWorld( + bone, + degrees, + ); + } + + late final _spine_bone_rotateWorldPtr = + _lookup>( + 'spine_bone_rotateWorld'); + late final _spine_bone_rotateWorld = _spine_bone_rotateWorldPtr + .asFunction(); + + double spine_bone_get_world_to_local_rotation_x( + spine_bone bone, + ) { + return _spine_bone_get_world_to_local_rotation_x( + bone, + ); + } + + late final _spine_bone_get_world_to_local_rotation_xPtr = + _lookup>( + 'spine_bone_get_world_to_local_rotation_x'); + late final _spine_bone_get_world_to_local_rotation_x = + _spine_bone_get_world_to_local_rotation_xPtr + .asFunction(); + + double spine_bone_get_world_to_local_rotation_y( + spine_bone bone, + ) { + return _spine_bone_get_world_to_local_rotation_y( + bone, + ); + } + + late final _spine_bone_get_world_to_local_rotation_yPtr = + _lookup>( + 'spine_bone_get_world_to_local_rotation_y'); + late final _spine_bone_get_world_to_local_rotation_y = + _spine_bone_get_world_to_local_rotation_yPtr + .asFunction(); + + spine_bone_data spine_bone_get_data( + spine_bone bone, + ) { + return _spine_bone_get_data( + bone, + ); + } + + late final _spine_bone_get_dataPtr = + _lookup>( + 'spine_bone_get_data'); + late final _spine_bone_get_data = _spine_bone_get_dataPtr + .asFunction(); + + spine_skeleton spine_bone_get_skeleton( + spine_bone bone, + ) { + return _spine_bone_get_skeleton( + bone, + ); + } + + late final _spine_bone_get_skeletonPtr = + _lookup>( + 'spine_bone_get_skeleton'); + late final _spine_bone_get_skeleton = _spine_bone_get_skeletonPtr + .asFunction(); + + spine_bone spine_bone_get_parent( + spine_bone bone, + ) { + return _spine_bone_get_parent( + bone, + ); + } + + late final _spine_bone_get_parentPtr = + _lookup>( + 'spine_bone_get_parent'); + late final _spine_bone_get_parent = + _spine_bone_get_parentPtr.asFunction(); + + int spine_bone_get_num_children( + spine_bone bone, + ) { + return _spine_bone_get_num_children( + bone, + ); + } + + late final _spine_bone_get_num_childrenPtr = + _lookup>( + 'spine_bone_get_num_children'); + late final _spine_bone_get_num_children = + _spine_bone_get_num_childrenPtr.asFunction(); + + ffi.Pointer spine_bone_get_children( + spine_bone bone, + ) { + return _spine_bone_get_children( + bone, + ); + } + + late final _spine_bone_get_childrenPtr = + _lookup Function(spine_bone)>>( + 'spine_bone_get_children'); + late final _spine_bone_get_children = _spine_bone_get_childrenPtr + .asFunction Function(spine_bone)>(); + + double spine_bone_get_x( + spine_bone bone, + ) { + return _spine_bone_get_x( + bone, + ); + } + + late final _spine_bone_get_xPtr = + _lookup>( + 'spine_bone_get_x'); + late final _spine_bone_get_x = + _spine_bone_get_xPtr.asFunction(); + + void spine_bone_set_x( + spine_bone bone, + double x, + ) { + return _spine_bone_set_x( + bone, + x, + ); + } + + late final _spine_bone_set_xPtr = + _lookup>( + 'spine_bone_set_x'); + late final _spine_bone_set_x = + _spine_bone_set_xPtr.asFunction(); + + double spine_bone_get_y( + spine_bone bone, + ) { + return _spine_bone_get_y( + bone, + ); + } + + late final _spine_bone_get_yPtr = + _lookup>( + 'spine_bone_get_y'); + late final _spine_bone_get_y = + _spine_bone_get_yPtr.asFunction(); + + void spine_bone_set_y( + spine_bone bone, + double y, + ) { + return _spine_bone_set_y( + bone, + y, + ); + } + + late final _spine_bone_set_yPtr = + _lookup>( + 'spine_bone_set_y'); + late final _spine_bone_set_y = + _spine_bone_set_yPtr.asFunction(); + + double spine_bone_get_rotation( + spine_bone bone, + ) { + return _spine_bone_get_rotation( + bone, + ); + } + + late final _spine_bone_get_rotationPtr = + _lookup>( + 'spine_bone_get_rotation'); + late final _spine_bone_get_rotation = + _spine_bone_get_rotationPtr.asFunction(); + + void spine_bone_set_rotation( + spine_bone bone, + double rotation, + ) { + return _spine_bone_set_rotation( + bone, + rotation, + ); + } + + late final _spine_bone_set_rotationPtr = + _lookup>( + 'spine_bone_set_rotation'); + late final _spine_bone_set_rotation = _spine_bone_set_rotationPtr + .asFunction(); + + double spine_bone_get_scale_x( + spine_bone bone, + ) { + return _spine_bone_get_scale_x( + bone, + ); + } + + late final _spine_bone_get_scale_xPtr = + _lookup>( + 'spine_bone_get_scale_x'); + late final _spine_bone_get_scale_x = + _spine_bone_get_scale_xPtr.asFunction(); + + void spine_bone_set_scale_x( + spine_bone bone, + double scaleX, + ) { + return _spine_bone_set_scale_x( + bone, + scaleX, + ); + } + + late final _spine_bone_set_scale_xPtr = + _lookup>( + 'spine_bone_set_scale_x'); + late final _spine_bone_set_scale_x = _spine_bone_set_scale_xPtr + .asFunction(); + + double spine_bone_get_scale_y( + spine_bone bone, + ) { + return _spine_bone_get_scale_y( + bone, + ); + } + + late final _spine_bone_get_scale_yPtr = + _lookup>( + 'spine_bone_get_scale_y'); + late final _spine_bone_get_scale_y = + _spine_bone_get_scale_yPtr.asFunction(); + + void spine_bone_set_scale_y( + spine_bone bone, + double scaleY, + ) { + return _spine_bone_set_scale_y( + bone, + scaleY, + ); + } + + late final _spine_bone_set_scale_yPtr = + _lookup>( + 'spine_bone_set_scale_y'); + late final _spine_bone_set_scale_y = _spine_bone_set_scale_yPtr + .asFunction(); + + double spine_bone_get_shear_x( + spine_bone bone, + ) { + return _spine_bone_get_shear_x( + bone, + ); + } + + late final _spine_bone_get_shear_xPtr = + _lookup>( + 'spine_bone_get_shear_x'); + late final _spine_bone_get_shear_x = + _spine_bone_get_shear_xPtr.asFunction(); + + void spine_bone_set_shear_x( + spine_bone bone, + double shearX, + ) { + return _spine_bone_set_shear_x( + bone, + shearX, + ); + } + + late final _spine_bone_set_shear_xPtr = + _lookup>( + 'spine_bone_set_shear_x'); + late final _spine_bone_set_shear_x = _spine_bone_set_shear_xPtr + .asFunction(); + + double spine_bone_get_shear_y( + spine_bone bone, + ) { + return _spine_bone_get_shear_y( + bone, + ); + } + + late final _spine_bone_get_shear_yPtr = + _lookup>( + 'spine_bone_get_shear_y'); + late final _spine_bone_get_shear_y = + _spine_bone_get_shear_yPtr.asFunction(); + + void spine_bone_set_shear_y( + spine_bone bone, + double shearY, + ) { + return _spine_bone_set_shear_y( + bone, + shearY, + ); + } + + late final _spine_bone_set_shear_yPtr = + _lookup>( + 'spine_bone_set_shear_y'); + late final _spine_bone_set_shear_y = _spine_bone_set_shear_yPtr + .asFunction(); + + double spine_bone_get_applied_rotation( + spine_bone bone, + ) { + return _spine_bone_get_applied_rotation( + bone, + ); + } + + late final _spine_bone_get_applied_rotationPtr = + _lookup>( + 'spine_bone_get_applied_rotation'); + late final _spine_bone_get_applied_rotation = + _spine_bone_get_applied_rotationPtr + .asFunction(); + + void spine_bone_set_applied_rotation( + spine_bone bone, + double rotation, + ) { + return _spine_bone_set_applied_rotation( + bone, + rotation, + ); + } + + late final _spine_bone_set_applied_rotationPtr = + _lookup>( + 'spine_bone_set_applied_rotation'); + late final _spine_bone_set_applied_rotation = + _spine_bone_set_applied_rotationPtr + .asFunction(); + + double spine_bone_get_a_x( + spine_bone bone, + ) { + return _spine_bone_get_a_x( + bone, + ); + } + + late final _spine_bone_get_a_xPtr = + _lookup>( + 'spine_bone_get_a_x'); + late final _spine_bone_get_a_x = + _spine_bone_get_a_xPtr.asFunction(); + + void spine_bone_set_a_x( + spine_bone bone, + double x, + ) { + return _spine_bone_set_a_x( + bone, + x, + ); + } + + late final _spine_bone_set_a_xPtr = + _lookup>( + 'spine_bone_set_a_x'); + late final _spine_bone_set_a_x = + _spine_bone_set_a_xPtr.asFunction(); + + double spine_bone_get_a_y( + spine_bone bone, + ) { + return _spine_bone_get_a_y( + bone, + ); + } + + late final _spine_bone_get_a_yPtr = + _lookup>( + 'spine_bone_get_a_y'); + late final _spine_bone_get_a_y = + _spine_bone_get_a_yPtr.asFunction(); + + void spine_bone_set_a_y( + spine_bone bone, + double y, + ) { + return _spine_bone_set_a_y( + bone, + y, + ); + } + + late final _spine_bone_set_a_yPtr = + _lookup>( + 'spine_bone_set_a_y'); + late final _spine_bone_set_a_y = + _spine_bone_set_a_yPtr.asFunction(); + + double spine_bone_get_a_scale_x( + spine_bone bone, + ) { + return _spine_bone_get_a_scale_x( + bone, + ); + } + + late final _spine_bone_get_a_scale_xPtr = + _lookup>( + 'spine_bone_get_a_scale_x'); + late final _spine_bone_get_a_scale_x = + _spine_bone_get_a_scale_xPtr.asFunction(); + + void spine_bone_set_a_scale_x( + spine_bone bone, + double scaleX, + ) { + return _spine_bone_set_a_scale_x( + bone, + scaleX, + ); + } + + late final _spine_bone_set_a_scale_xPtr = + _lookup>( + 'spine_bone_set_a_scale_x'); + late final _spine_bone_set_a_scale_x = _spine_bone_set_a_scale_xPtr + .asFunction(); + + double spine_bone_get_a_scale_y( + spine_bone bone, + ) { + return _spine_bone_get_a_scale_y( + bone, + ); + } + + late final _spine_bone_get_a_scale_yPtr = + _lookup>( + 'spine_bone_get_a_scale_y'); + late final _spine_bone_get_a_scale_y = + _spine_bone_get_a_scale_yPtr.asFunction(); + + void spine_bone_set_a_scale_y( + spine_bone bone, + double scaleY, + ) { + return _spine_bone_set_a_scale_y( + bone, + scaleY, + ); + } + + late final _spine_bone_set_a_scale_yPtr = + _lookup>( + 'spine_bone_set_a_scale_y'); + late final _spine_bone_set_a_scale_y = _spine_bone_set_a_scale_yPtr + .asFunction(); + + double spine_bone_get_a_shear_x( + spine_bone bone, + ) { + return _spine_bone_get_a_shear_x( + bone, + ); + } + + late final _spine_bone_get_a_shear_xPtr = + _lookup>( + 'spine_bone_get_a_shear_x'); + late final _spine_bone_get_a_shear_x = + _spine_bone_get_a_shear_xPtr.asFunction(); + + void spine_bone_set_a_shear_x( + spine_bone bone, + double shearX, + ) { + return _spine_bone_set_a_shear_x( + bone, + shearX, + ); + } + + late final _spine_bone_set_a_shear_xPtr = + _lookup>( + 'spine_bone_set_a_shear_x'); + late final _spine_bone_set_a_shear_x = _spine_bone_set_a_shear_xPtr + .asFunction(); + + double spine_bone_get_a_shear_y( + spine_bone bone, + ) { + return _spine_bone_get_a_shear_y( + bone, + ); + } + + late final _spine_bone_get_a_shear_yPtr = + _lookup>( + 'spine_bone_get_a_shear_y'); + late final _spine_bone_get_a_shear_y = + _spine_bone_get_a_shear_yPtr.asFunction(); + + void spine_bone_set_a_shear_y( + spine_bone bone, + double shearY, + ) { + return _spine_bone_set_a_shear_y( + bone, + shearY, + ); + } + + late final _spine_bone_set_a_shear_yPtr = + _lookup>( + 'spine_bone_set_a_shear_y'); + late final _spine_bone_set_a_shear_y = _spine_bone_set_a_shear_yPtr + .asFunction(); + + double spine_bone_get_a( + spine_bone bone, + ) { + return _spine_bone_get_a( + bone, + ); + } + + late final _spine_bone_get_aPtr = + _lookup>( + 'spine_bone_get_a'); + late final _spine_bone_get_a = + _spine_bone_get_aPtr.asFunction(); + + void spine_bone_set_a( + spine_bone bone, + double a, + ) { + return _spine_bone_set_a( + bone, + a, + ); + } + + late final _spine_bone_set_aPtr = + _lookup>( + 'spine_bone_set_a'); + late final _spine_bone_set_a = + _spine_bone_set_aPtr.asFunction(); + + double spine_bone_get_b( + spine_bone bone, + ) { + return _spine_bone_get_b( + bone, + ); + } + + late final _spine_bone_get_bPtr = + _lookup>( + 'spine_bone_get_b'); + late final _spine_bone_get_b = + _spine_bone_get_bPtr.asFunction(); + + void spine_bone_set_b( + spine_bone bone, + double b, + ) { + return _spine_bone_set_b( + bone, + b, + ); + } + + late final _spine_bone_set_bPtr = + _lookup>( + 'spine_bone_set_b'); + late final _spine_bone_set_b = + _spine_bone_set_bPtr.asFunction(); + + double spine_bone_get_c( + spine_bone bone, + ) { + return _spine_bone_get_c( + bone, + ); + } + + late final _spine_bone_get_cPtr = + _lookup>( + 'spine_bone_get_c'); + late final _spine_bone_get_c = + _spine_bone_get_cPtr.asFunction(); + + void spine_bone_set_c( + spine_bone bone, + double c, + ) { + return _spine_bone_set_c( + bone, + c, + ); + } + + late final _spine_bone_set_cPtr = + _lookup>( + 'spine_bone_set_c'); + late final _spine_bone_set_c = + _spine_bone_set_cPtr.asFunction(); + + double spine_bone_get_d( + spine_bone bone, + ) { + return _spine_bone_get_d( + bone, + ); + } + + late final _spine_bone_get_dPtr = + _lookup>( + 'spine_bone_get_d'); + late final _spine_bone_get_d = + _spine_bone_get_dPtr.asFunction(); + + void spine_bone_set_d( + spine_bone bone, + double d, + ) { + return _spine_bone_set_d( + bone, + d, + ); + } + + late final _spine_bone_set_dPtr = + _lookup>( + 'spine_bone_set_d'); + late final _spine_bone_set_d = + _spine_bone_set_dPtr.asFunction(); + + double spine_bone_get_world_x( + spine_bone bone, + ) { + return _spine_bone_get_world_x( + bone, + ); + } + + late final _spine_bone_get_world_xPtr = + _lookup>( + 'spine_bone_get_world_x'); + late final _spine_bone_get_world_x = + _spine_bone_get_world_xPtr.asFunction(); + + void spine_bone_set_world_x( + spine_bone bone, + double worldX, + ) { + return _spine_bone_set_world_x( + bone, + worldX, + ); + } + + late final _spine_bone_set_world_xPtr = + _lookup>( + 'spine_bone_set_world_x'); + late final _spine_bone_set_world_x = _spine_bone_set_world_xPtr + .asFunction(); + + double spine_bone_get_world_y( + spine_bone bone, + ) { + return _spine_bone_get_world_y( + bone, + ); + } + + late final _spine_bone_get_world_yPtr = + _lookup>( + 'spine_bone_get_world_y'); + late final _spine_bone_get_world_y = + _spine_bone_get_world_yPtr.asFunction(); + + void spine_bone_set_world_y( + spine_bone bone, + double worldY, + ) { + return _spine_bone_set_world_y( + bone, + worldY, + ); + } + + late final _spine_bone_set_world_yPtr = + _lookup>( + 'spine_bone_set_world_y'); + late final _spine_bone_set_world_y = _spine_bone_set_world_yPtr + .asFunction(); + + double spine_bone_get_world_rotation_x( + spine_bone bone, + ) { + return _spine_bone_get_world_rotation_x( + bone, + ); + } + + late final _spine_bone_get_world_rotation_xPtr = + _lookup>( + 'spine_bone_get_world_rotation_x'); + late final _spine_bone_get_world_rotation_x = + _spine_bone_get_world_rotation_xPtr + .asFunction(); + + double spine_bone_get_world_rotation_y( + spine_bone bone, + ) { + return _spine_bone_get_world_rotation_y( + bone, + ); + } + + late final _spine_bone_get_world_rotation_yPtr = + _lookup>( + 'spine_bone_get_world_rotation_y'); + late final _spine_bone_get_world_rotation_y = + _spine_bone_get_world_rotation_yPtr + .asFunction(); + + double spine_bone_get_world_scale_x( + spine_bone bone, + ) { + return _spine_bone_get_world_scale_x( + bone, + ); + } + + late final _spine_bone_get_world_scale_xPtr = + _lookup>( + 'spine_bone_get_world_scale_x'); + late final _spine_bone_get_world_scale_x = _spine_bone_get_world_scale_xPtr + .asFunction(); + + double spine_bone_get_world_scale_y( + spine_bone bone, + ) { + return _spine_bone_get_world_scale_y( + bone, + ); + } + + late final _spine_bone_get_world_scale_yPtr = + _lookup>( + 'spine_bone_get_world_scale_y'); + late final _spine_bone_get_world_scale_y = _spine_bone_get_world_scale_yPtr + .asFunction(); + + int spine_bone_get_is_active( + spine_bone bone, + ) { + return _spine_bone_get_is_active( + bone, + ); + } + + late final _spine_bone_get_is_activePtr = + _lookup>( + 'spine_bone_get_is_active'); + late final _spine_bone_get_is_active = + _spine_bone_get_is_activePtr.asFunction(); + + void spine_bone_set_is_active( + spine_bone bone, + int isActive, + ) { + return _spine_bone_set_is_active( + bone, + isActive, + ); + } + + late final _spine_bone_set_is_activePtr = + _lookup>( + 'spine_bone_set_is_active'); + late final _spine_bone_set_is_active = + _spine_bone_set_is_activePtr.asFunction(); } class spine_atlas extends ffi.Struct { @@ -3342,6 +4301,14 @@ class spine_color extends ffi.Struct { external double a; } +class spine_vector extends ffi.Struct { + @ffi.Float() + external double x; + + @ffi.Float() + external double y; +} + class spine_skeleton_drawable extends ffi.Struct { external spine_skeleton skeleton; diff --git a/spine-flutter/src/spine_flutter.cpp b/spine-flutter/src/spine_flutter.cpp index ca25c7761..253a7cc87 100644 --- a/spine-flutter/src/spine_flutter.cpp +++ b/spine-flutter/src/spine_flutter.cpp @@ -1469,3 +1469,380 @@ FFI_PLUGIN_EXPORT spine_color spine_bone_data_get_color(spine_bone_data data) { color = { _data->getColor().r, _data->getColor().g, _data->getColor().b, _data->getColor().a }; return color; } + +// Bone +FFI_PLUGIN_EXPORT void spine_bone_update(spine_bone bone) { + if (bone == nullptr) return; + Bone *_bone = (Bone*)bone; + _bone->update(); +} + +FFI_PLUGIN_EXPORT void spine_bone_update_world_transform(spine_bone bone) { + if (bone == nullptr) return; + Bone *_bone = (Bone*)bone; + _bone->updateWorldTransform(); +} + +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) { + if (bone == nullptr) return; + Bone *_bone = (Bone*)bone; + _bone->updateWorldTransform(x, y, rotation, scaleX, scaleY, shearX, shearY); +} + +FFI_PLUGIN_EXPORT void spine_bone_set_to_setup_pose(spine_bone bone) { + if (bone == nullptr) return; + Bone *_bone = (Bone*)bone; + _bone->setToSetupPose(); +} + +FFI_PLUGIN_EXPORT spine_vector spine_bone_world_to_local(spine_bone bone, float worldX, float worldY) { + spine_vector coords = { 0, 0 }; + if (bone == nullptr) return coords; + Bone *_bone = (Bone*)bone; + _bone->worldToLocal(worldX, worldY, coords.x, coords.y); + return coords; +} + +FFI_PLUGIN_EXPORT spine_vector spine_bone_local_to_world(spine_bone bone, float localX, float localY) { + spine_vector coords = { 0, 0 }; + if (bone == nullptr) return coords; + Bone *_bone = (Bone*)bone; + _bone->localToWorld(localX, localY, coords.x, coords.y); + return coords; +} + +FFI_PLUGIN_EXPORT float spine_bone_world_to_local_rotation(spine_bone bone, float worldRotation) { + if (bone == nullptr) return 0; + Bone *_bone = (Bone*)bone; + return _bone->worldToLocalRotation(worldRotation); +} + +FFI_PLUGIN_EXPORT float spine_bone_local_to_worldrotation(spine_bone bone, float localRotation) { + if (bone == nullptr) return 0; + Bone *_bone = (Bone*)bone; + return _bone->localToWorldRotation(localRotation); +} + +FFI_PLUGIN_EXPORT void spine_bone_rotateWorld(spine_bone bone, float degrees) { + if (bone == nullptr) return; + Bone *_bone = (Bone*)bone; + _bone->rotateWorld(degrees); +} + +FFI_PLUGIN_EXPORT float spine_bone_get_world_to_local_rotation_x(spine_bone bone) { + if (bone == nullptr) return 0; + Bone *_bone = (Bone*)bone; + return _bone->getWorldToLocalRotationX(); +} + +FFI_PLUGIN_EXPORT float spine_bone_get_world_to_local_rotation_y(spine_bone bone) { + if (bone == nullptr) return 0; + Bone *_bone = (Bone*)bone; + return _bone->getWorldToLocalRotationY(); +} + +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(); +} + +FFI_PLUGIN_EXPORT spine_skeleton spine_bone_get_skeleton(spine_bone bone) { + if (bone == nullptr) return nullptr; + Bone *_bone = (Bone*)bone; + return &_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(); +} + +FFI_PLUGIN_EXPORT int spine_bone_get_num_children(spine_bone bone) { + if (bone == nullptr) return 0; + Bone *_bone = (Bone*)bone; + return (int)_bone->getChildren().size(); +} + +FFI_PLUGIN_EXPORT spine_bone* spine_bone_get_children(spine_bone bone) { + if (bone == nullptr) return nullptr; + Bone *_bone = (Bone*)bone; + return (spine_bone*)_bone->getChildren().buffer(); +} + +FFI_PLUGIN_EXPORT float spine_bone_get_x(spine_bone bone) { + if (bone == nullptr) return 0; + Bone *_bone = (Bone*)bone; + return _bone->getX(); +} + +FFI_PLUGIN_EXPORT void spine_bone_set_x(spine_bone bone, float x) { + if (bone == nullptr) return; + Bone *_bone = (Bone*)bone; + _bone->setX(x); +} + +FFI_PLUGIN_EXPORT float spine_bone_get_y(spine_bone bone) { + if (bone == nullptr) return 0; + Bone *_bone = (Bone*)bone; + return _bone->getY(); +} + +FFI_PLUGIN_EXPORT void spine_bone_set_y(spine_bone bone, float y) { + if (bone == nullptr) return; + Bone *_bone = (Bone*)bone; + _bone->setY(y); +} + +FFI_PLUGIN_EXPORT float spine_bone_get_rotation(spine_bone bone) { + if (bone == nullptr) return 0; + Bone *_bone = (Bone*)bone; + return _bone->getRotation(); +} + +FFI_PLUGIN_EXPORT void spine_bone_set_rotation(spine_bone bone, float rotation) { + if (bone == nullptr) return; + Bone *_bone = (Bone*)bone; + _bone->setRotation(rotation); +} + +FFI_PLUGIN_EXPORT float spine_bone_get_scale_x(spine_bone bone) { + if (bone == nullptr) return 0; + Bone *_bone = (Bone*)bone; + return _bone->getScaleX(); +} + +FFI_PLUGIN_EXPORT void spine_bone_set_scale_x(spine_bone bone, float scaleX) { + if (bone == nullptr) return; + Bone *_bone = (Bone*)bone; + _bone->setScaleX(scaleX); +} + +FFI_PLUGIN_EXPORT float spine_bone_get_scale_y(spine_bone bone) { + if (bone == nullptr) return 0; + Bone *_bone = (Bone*)bone; + return _bone->getScaleY(); +} + +FFI_PLUGIN_EXPORT void spine_bone_set_scale_y(spine_bone bone, float scaleY) { + if (bone == nullptr) return; + Bone *_bone = (Bone*)bone; + _bone->setScaleY(scaleY); +} + +FFI_PLUGIN_EXPORT float spine_bone_get_shear_x(spine_bone bone) { + if (bone == nullptr) return 0; + Bone *_bone = (Bone*)bone; + return _bone->getShearX(); +} + +FFI_PLUGIN_EXPORT void spine_bone_set_shear_x(spine_bone bone, float shearX) { + if (bone == nullptr) return; + Bone *_bone = (Bone*)bone; + _bone->setShearX(shearX); +} + +FFI_PLUGIN_EXPORT float spine_bone_get_shear_y(spine_bone bone) { + if (bone == nullptr) return 0; + Bone *_bone = (Bone*)bone; + return _bone->getShearY(); +} + +FFI_PLUGIN_EXPORT void spine_bone_set_shear_y(spine_bone bone, float shearY) { + if (bone == nullptr) return; + Bone *_bone = (Bone*)bone; + _bone->setShearY(shearY); +} + +FFI_PLUGIN_EXPORT float spine_bone_get_applied_rotation(spine_bone bone) { + if (bone == nullptr) return 0; + Bone *_bone = (Bone*)bone; + return _bone->getAppliedRotation(); +} + +FFI_PLUGIN_EXPORT void spine_bone_set_applied_rotation(spine_bone bone, float rotation) { + if (bone == nullptr) return; + Bone *_bone = (Bone*)bone; + _bone->setAppliedRotation(rotation); +} + +FFI_PLUGIN_EXPORT float spine_bone_get_a_x(spine_bone bone) { + if (bone == nullptr) return 0; + Bone *_bone = (Bone*)bone; + return _bone->getAX(); +} + +FFI_PLUGIN_EXPORT void spine_bone_set_a_x(spine_bone bone, float x) { + if (bone == nullptr) return; + Bone *_bone = (Bone*)bone; + _bone->setAX(x); +} + +FFI_PLUGIN_EXPORT float spine_bone_get_a_y(spine_bone bone) { + if (bone == nullptr) return 0; + Bone *_bone = (Bone*)bone; + return _bone->getAY(); +} + +FFI_PLUGIN_EXPORT void spine_bone_set_a_y(spine_bone bone, float y) { + if (bone == nullptr) return; + Bone *_bone = (Bone*)bone; + _bone->setAY(y); +} + +FFI_PLUGIN_EXPORT float spine_bone_get_a_scale_x(spine_bone bone) { + if (bone == nullptr) return 0; + Bone *_bone = (Bone*)bone; + return _bone->getAScaleX(); +} + +FFI_PLUGIN_EXPORT void spine_bone_set_a_scale_x(spine_bone bone, float scaleX) { + if (bone == nullptr) return; + Bone *_bone = (Bone*)bone; + _bone->setAScaleX(scaleX); +} + +FFI_PLUGIN_EXPORT float spine_bone_get_a_scale_y(spine_bone bone) { + if (bone == nullptr) return 0; + Bone *_bone = (Bone*)bone; + return _bone->getAScaleY(); +} + +FFI_PLUGIN_EXPORT void spine_bone_set_a_scale_y(spine_bone bone, float scaleY) { + if (bone == nullptr) return; + Bone *_bone = (Bone*)bone; + _bone->setAScaleY(scaleY); +} + +FFI_PLUGIN_EXPORT float spine_bone_get_a_shear_x(spine_bone bone) { + if (bone == nullptr) return 0; + Bone *_bone = (Bone*)bone; + return _bone->getAShearX(); +} + +FFI_PLUGIN_EXPORT void spine_bone_set_a_shear_x(spine_bone bone, float shearX) { + if (bone == nullptr) return; + Bone *_bone = (Bone*)bone; + _bone->setAShearX(shearX); +} + +FFI_PLUGIN_EXPORT float spine_bone_get_a_shear_y(spine_bone bone) { + if (bone == nullptr) return 0; + Bone *_bone = (Bone*)bone; + return _bone->getAShearY(); +} + +FFI_PLUGIN_EXPORT void spine_bone_set_shear_a_y(spine_bone bone, float shearY) { + if (bone == nullptr) return; + Bone *_bone = (Bone*)bone; + _bone->setAShearY(shearY); +} + +FFI_PLUGIN_EXPORT float spine_bone_get_a(spine_bone bone) { + if (bone == nullptr) return 0; + Bone *_bone = (Bone*)bone; + return _bone->getA(); +} + +FFI_PLUGIN_EXPORT void spine_bone_set_a(spine_bone bone, float a) { + if (bone == nullptr) return; + Bone *_bone = (Bone*)bone; + _bone->setA(a); +} + +FFI_PLUGIN_EXPORT float spine_bone_get_b(spine_bone bone) { + if (bone == nullptr) return 0; + Bone *_bone = (Bone*)bone; + return _bone->getB(); +} + +FFI_PLUGIN_EXPORT void spine_bone_set_b(spine_bone bone, float b) { + if (bone == nullptr) return; + Bone *_bone = (Bone*)bone; + _bone->setB(b); +} + +FFI_PLUGIN_EXPORT float spine_bone_get_c(spine_bone bone) { + if (bone == nullptr) return 0; + Bone *_bone = (Bone*)bone; + return _bone->getC(); +} + +FFI_PLUGIN_EXPORT void spine_bone_set_c(spine_bone bone, float c) { + if (bone == nullptr) return; + Bone *_bone = (Bone*)bone; + _bone->setC(c); +} + +FFI_PLUGIN_EXPORT float spine_bone_get_d(spine_bone bone) { + if (bone == nullptr) return 0; + Bone *_bone = (Bone*)bone; + return _bone->getD(); +} + +FFI_PLUGIN_EXPORT void spine_bone_set_d(spine_bone bone, float d) { + if (bone == nullptr) return; + Bone *_bone = (Bone*)bone; + _bone->setD(d); +} + +FFI_PLUGIN_EXPORT float spine_bone_get_world_x(spine_bone bone) { + if (bone == nullptr) return 0; + Bone *_bone = (Bone*)bone; + return _bone->getWorldX(); +} + +FFI_PLUGIN_EXPORT void spine_bone_set_world_x(spine_bone bone, float worldX) { + if (bone == nullptr) return; + Bone *_bone = (Bone*)bone; + _bone->setWorldX(worldX); +} + +FFI_PLUGIN_EXPORT float spine_bone_get_world_y(spine_bone bone) { + if (bone == nullptr) return 0; + Bone *_bone = (Bone*)bone; + return _bone->getWorldY(); +} + +FFI_PLUGIN_EXPORT void spine_bone_set_world_y(spine_bone bone, float worldY) { + if (bone == nullptr) return; + Bone *_bone = (Bone*)bone; + _bone->setWorldY(worldY); +} + +FFI_PLUGIN_EXPORT float spine_bone_get_world_rotation_x(spine_bone bone) { + if (bone == nullptr) return 0; + Bone *_bone = (Bone*)bone; + return _bone->getWorldRotationX(); +} + +FFI_PLUGIN_EXPORT float spine_bone_get_world_rotation_y(spine_bone bone) { + if (bone == nullptr) return 0; + Bone *_bone = (Bone*)bone; + return _bone->getWorldToLocalRotationY(); +} + +FFI_PLUGIN_EXPORT float spine_bone_get_world_scale_x(spine_bone bone) { + if (bone == nullptr) return 0; + Bone *_bone = (Bone*)bone; + return _bone->getWorldScaleX(); +} + +FFI_PLUGIN_EXPORT float spine_bone_get_world_scale_y(spine_bone bone) { + if (bone == nullptr) return 0; + Bone *_bone = (Bone*)bone; + return _bone->getWorldScaleY(); +} + +FFI_PLUGIN_EXPORT int spine_bone_get_is_active(spine_bone bone) { + if (bone == nullptr) return 0; + Bone *_bone = (Bone*)bone; + return _bone->isActive() ? -1 : 0; +} + +FFI_PLUGIN_EXPORT void spine_bone_set_is_active(spine_bone bone, int isActive) { + if (bone == nullptr) return; + Bone *_bone = (Bone*)bone; + _bone->setActive(isActive); +} diff --git a/spine-flutter/src/spine_flutter.h b/spine-flutter/src/spine_flutter.h index 58696b41a..b1765ad17 100644 --- a/spine-flutter/src/spine_flutter.h +++ b/spine-flutter/src/spine_flutter.h @@ -107,6 +107,10 @@ typedef struct spine_color { float r, g, b, a; } spine_color; +typedef struct spine_vector { + float x, y; +} spine_vector; + typedef struct spine_skeleton_drawable { spine_skeleton skeleton; spine_animation_state animationState; @@ -330,4 +334,67 @@ FFI_PLUGIN_EXPORT float spine_bone_data_get_shear_x(spine_bone_data data); FFI_PLUGIN_EXPORT float spine_bone_data_get_shear_y(spine_bone_data data); FFI_PLUGIN_EXPORT spine_transform_mode spine_bone_data_get_transform_mode(spine_bone_data data); FFI_PLUGIN_EXPORT int spine_bone_data_is_skin_required(spine_bone_data data); -FFI_PLUGIN_EXPORT spine_color spine_bone_data_get_color(spine_bone_data data); \ No newline at end of file +FFI_PLUGIN_EXPORT spine_color spine_bone_data_get_color(spine_bone_data data); + +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); +FFI_PLUGIN_EXPORT void spine_bone_set_to_setup_pose(spine_bone bone); +FFI_PLUGIN_EXPORT spine_vector spine_bone_world_to_local(spine_bone bone, float worldX, float worldY); +FFI_PLUGIN_EXPORT spine_vector spine_bone_local_to_world(spine_bone bone, float localX, float localY); +FFI_PLUGIN_EXPORT float spine_bone_world_to_local_rotation(spine_bone bone, float worldRotation); +FFI_PLUGIN_EXPORT float spine_bone_local_to_worldrotation(spine_bone bone, float localRotation); +FFI_PLUGIN_EXPORT void spine_bone_rotateWorld(spine_bone bone, float degrees); +FFI_PLUGIN_EXPORT float spine_bone_get_world_to_local_rotation_x(spine_bone bone); +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); +FFI_PLUGIN_EXPORT spine_skeleton spine_bone_get_skeleton(spine_bone bone); +FFI_PLUGIN_EXPORT spine_bone spine_bone_get_parent(spine_bone bone); +FFI_PLUGIN_EXPORT int spine_bone_get_num_children(spine_bone bone); +FFI_PLUGIN_EXPORT spine_bone* spine_bone_get_children(spine_bone bone); +FFI_PLUGIN_EXPORT float spine_bone_get_x(spine_bone bone); +FFI_PLUGIN_EXPORT void spine_bone_set_x(spine_bone bone, float x); +FFI_PLUGIN_EXPORT float spine_bone_get_y(spine_bone bone); +FFI_PLUGIN_EXPORT void spine_bone_set_y(spine_bone bone, float y); +FFI_PLUGIN_EXPORT float spine_bone_get_rotation(spine_bone bone); +FFI_PLUGIN_EXPORT void spine_bone_set_rotation(spine_bone bone, float rotation); +FFI_PLUGIN_EXPORT float spine_bone_get_scale_x(spine_bone bone); +FFI_PLUGIN_EXPORT void spine_bone_set_scale_x(spine_bone bone, float scaleX); +FFI_PLUGIN_EXPORT float spine_bone_get_scale_y(spine_bone bone); +FFI_PLUGIN_EXPORT void spine_bone_set_scale_y(spine_bone bone, float scaleY); +FFI_PLUGIN_EXPORT float spine_bone_get_shear_x(spine_bone bone); +FFI_PLUGIN_EXPORT void spine_bone_set_shear_x(spine_bone bone, float shearX); +FFI_PLUGIN_EXPORT float spine_bone_get_shear_y(spine_bone bone); +FFI_PLUGIN_EXPORT void spine_bone_set_shear_y(spine_bone bone, float shearY); +FFI_PLUGIN_EXPORT float spine_bone_get_applied_rotation(spine_bone bone); +FFI_PLUGIN_EXPORT void spine_bone_set_applied_rotation(spine_bone bone, float rotation); +FFI_PLUGIN_EXPORT float spine_bone_get_a_x(spine_bone bone); +FFI_PLUGIN_EXPORT void spine_bone_set_a_x(spine_bone bone, float x); +FFI_PLUGIN_EXPORT float spine_bone_get_a_y(spine_bone bone); +FFI_PLUGIN_EXPORT void spine_bone_set_a_y(spine_bone bone, float y); +FFI_PLUGIN_EXPORT float spine_bone_get_a_scale_x(spine_bone bone); +FFI_PLUGIN_EXPORT void spine_bone_set_a_scale_x(spine_bone bone, float scaleX); +FFI_PLUGIN_EXPORT float spine_bone_get_a_scale_y(spine_bone bone); +FFI_PLUGIN_EXPORT void spine_bone_set_a_scale_y(spine_bone bone, float scaleY); +FFI_PLUGIN_EXPORT float spine_bone_get_a_shear_x(spine_bone bone); +FFI_PLUGIN_EXPORT void spine_bone_set_a_shear_x(spine_bone bone, float shearX); +FFI_PLUGIN_EXPORT float spine_bone_get_a_shear_y(spine_bone bone); +FFI_PLUGIN_EXPORT void spine_bone_set_a_shear_y(spine_bone bone, float shearY); +FFI_PLUGIN_EXPORT float spine_bone_get_a(spine_bone bone); +FFI_PLUGIN_EXPORT void spine_bone_set_a(spine_bone bone, float a); +FFI_PLUGIN_EXPORT float spine_bone_get_b(spine_bone bone); +FFI_PLUGIN_EXPORT void spine_bone_set_b(spine_bone bone, float b); +FFI_PLUGIN_EXPORT float spine_bone_get_c(spine_bone bone); +FFI_PLUGIN_EXPORT void spine_bone_set_c(spine_bone bone, float c); +FFI_PLUGIN_EXPORT float spine_bone_get_d(spine_bone bone); +FFI_PLUGIN_EXPORT void spine_bone_set_d(spine_bone bone, float d); +FFI_PLUGIN_EXPORT float spine_bone_get_world_x(spine_bone bone); +FFI_PLUGIN_EXPORT void spine_bone_set_world_x(spine_bone bone, float worldX); +FFI_PLUGIN_EXPORT float spine_bone_get_world_y(spine_bone bone); +FFI_PLUGIN_EXPORT void spine_bone_set_world_y(spine_bone bone, float worldY); +FFI_PLUGIN_EXPORT float spine_bone_get_world_rotation_x(spine_bone bone); +FFI_PLUGIN_EXPORT float spine_bone_get_world_rotation_y(spine_bone bone); +FFI_PLUGIN_EXPORT float spine_bone_get_world_scale_x(spine_bone bone); +FFI_PLUGIN_EXPORT float spine_bone_get_world_scale_y(spine_bone bone); +FFI_PLUGIN_EXPORT int spine_bone_get_is_active(spine_bone bone); +FFI_PLUGIN_EXPORT void spine_bone_set_is_active(spine_bone bone, int isActive); \ No newline at end of file