mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
[ios] Regenerate bindings and fix example disposal timing
This commit is contained in:
parent
d70f9444a2
commit
9b969202e8
@ -69,6 +69,11 @@ struct AnimationStateEvents: View {
|
||||
controller: controller
|
||||
)
|
||||
}
|
||||
.onDisappear {
|
||||
// SwiftUI may retain the @StateObject controller after the view disappears.
|
||||
// Explicit disposal is only needed here so leak reporting runs after native teardown.
|
||||
controller.dispose()
|
||||
}
|
||||
.navigationTitle("Animation State Listener")
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
}
|
||||
|
||||
@ -51,6 +51,11 @@ struct DebugRendering: View {
|
||||
.frame(width: boneLocation.width, height: boneLocation.height)
|
||||
}
|
||||
}
|
||||
.onDisappear {
|
||||
// SwiftUI may retain the @StateObject model after the view disappears.
|
||||
// Explicit disposal is only needed here so leak reporting runs after native teardown.
|
||||
model.dispose()
|
||||
}
|
||||
.navigationTitle("Debug Rendering")
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
}
|
||||
@ -62,6 +67,14 @@ struct DebugRendering: View {
|
||||
|
||||
final class DebugRenderingModel: ObservableObject {
|
||||
|
||||
// Not strictly necessary for normal usage. SwiftUI will eventually release the
|
||||
// model and controller. We dispose explicitly here so leak reporting runs after
|
||||
// native teardown when navigating back from the example.
|
||||
func dispose() {
|
||||
controller.dispose()
|
||||
}
|
||||
|
||||
|
||||
@Published
|
||||
var controller: SpineController!
|
||||
|
||||
|
||||
@ -76,6 +76,11 @@ struct DisableRendering: View {
|
||||
.frame(minHeight: 400)
|
||||
}
|
||||
}
|
||||
.onDisappear {
|
||||
// SwiftUI may retain the @StateObject controller after the view disappears.
|
||||
// Explicit disposal is only needed here so leak reporting runs after native teardown.
|
||||
controller.dispose()
|
||||
}
|
||||
.navigationTitle("Disable Rendering")
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
}
|
||||
|
||||
@ -64,6 +64,20 @@ struct DressUp: View {
|
||||
Spacer()
|
||||
}
|
||||
}
|
||||
.onDisappear {
|
||||
// SwiftUI may retain the @StateObject model after the view disappears.
|
||||
// Explicit disposal is only needed here so leak reporting runs after native teardown.
|
||||
model.dispose()
|
||||
|
||||
// This example also passes the drawable directly to SpineView via .drawable(...).
|
||||
// SwiftUI can keep the disappearing view alive for a bit longer, so delay leak
|
||||
// reporting until that view and its source have been released.
|
||||
DispatchQueue.main.async {
|
||||
DispatchQueue.main.async {
|
||||
reportLeaks()
|
||||
}
|
||||
}
|
||||
}
|
||||
.navigationTitle("Dress Up")
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
}
|
||||
@ -75,6 +89,21 @@ struct DressUp: View {
|
||||
|
||||
final class DressUpModel: ObservableObject {
|
||||
|
||||
// Not strictly necessary for normal usage. SwiftUI will eventually release the
|
||||
// model and controller. We dispose explicitly here so leak reporting runs after
|
||||
// native teardown when navigating back from the example.
|
||||
func dispose() {
|
||||
disposed = true
|
||||
loadTask?.cancel()
|
||||
loadTask = nil
|
||||
controller.dispose()
|
||||
drawable?.dispose()
|
||||
drawable = nil
|
||||
customSkin?.dispose()
|
||||
customSkin = nil
|
||||
}
|
||||
|
||||
|
||||
let thumbnailSize = CGSize(width: 200, height: 200)
|
||||
let boundsProvider: BoundsProvider = SkinAndAnimationBounds(skins: ["full-skins/girl"])
|
||||
|
||||
@ -91,6 +120,8 @@ final class DressUpModel: ObservableObject {
|
||||
var selectedSkins = [String: Bool]()
|
||||
|
||||
private var customSkin: Skin?
|
||||
private var loadTask: Task<Void, Never>?
|
||||
private var disposed = false
|
||||
|
||||
init() {
|
||||
controller = SpineController(
|
||||
@ -99,14 +130,28 @@ final class DressUpModel: ObservableObject {
|
||||
},
|
||||
disposeDrawableOnDeInit: false
|
||||
)
|
||||
Task.detached(priority: .high) {
|
||||
loadTask = Task.detached(priority: .high) { [weak self] in
|
||||
guard let self else { return }
|
||||
do {
|
||||
let drawable = try await SkeletonDrawableWrapper.fromBundle(
|
||||
atlasFileName: "mix-and-match-pma.atlas",
|
||||
skeletonFileName: "mix-and-match-pro.skel"
|
||||
)
|
||||
if Task.isCancelled {
|
||||
drawable.dispose()
|
||||
return
|
||||
}
|
||||
try await MainActor.run {
|
||||
if self.disposed || Task.isCancelled {
|
||||
drawable.dispose()
|
||||
return
|
||||
}
|
||||
let skins = drawable.skeletonData.skins
|
||||
for i in 0..<skins.count {
|
||||
if self.disposed || Task.isCancelled {
|
||||
drawable.dispose()
|
||||
return
|
||||
}
|
||||
guard let skin = skins[i] else { continue }
|
||||
if skin.name == "default" { continue }
|
||||
let skeleton = drawable.skeleton
|
||||
@ -125,11 +170,16 @@ final class DressUpModel: ObservableObject {
|
||||
}
|
||||
self.toggleSkin(skinName: "full-skins/girl", drawable: drawable)
|
||||
self.drawable = drawable
|
||||
self.loadTask = nil
|
||||
}
|
||||
} catch {
|
||||
print(error)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
deinit {
|
||||
loadTask?.cancel()
|
||||
drawable?.dispose()
|
||||
customSkin?.dispose()
|
||||
}
|
||||
|
||||
@ -49,6 +49,11 @@ struct IKFollowing: View {
|
||||
)
|
||||
}
|
||||
)
|
||||
.onDisappear {
|
||||
// SwiftUI may retain the @StateObject model after the view disappears.
|
||||
// Explicit disposal is only needed here so leak reporting runs after native teardown.
|
||||
model.dispose()
|
||||
}
|
||||
.navigationTitle("IK Following")
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
}
|
||||
@ -65,6 +70,14 @@ struct IKFollowing: View {
|
||||
|
||||
final class IKFollowingModel: ObservableObject {
|
||||
|
||||
// Not strictly necessary for normal usage. SwiftUI will eventually release the
|
||||
// model and controller. We dispose explicitly here so leak reporting runs after
|
||||
// native teardown when navigating back from the example.
|
||||
func dispose() {
|
||||
controller.dispose()
|
||||
}
|
||||
|
||||
|
||||
@Published
|
||||
var controller: SpineController!
|
||||
|
||||
|
||||
@ -36,10 +36,12 @@ struct LeakReporter: ViewModifier {
|
||||
func body(content: Content) -> some View {
|
||||
content
|
||||
.onDisappear {
|
||||
DispatchQueue.main.async {
|
||||
reportLeaks()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension View {
|
||||
func reportLeaksOnDisappear() -> some View {
|
||||
@ -69,7 +71,6 @@ struct MainView: View {
|
||||
}
|
||||
NavigationLink("Dress Up") {
|
||||
DressUp()
|
||||
.reportLeaksOnDisappear()
|
||||
}
|
||||
NavigationLink("IK Following") {
|
||||
IKFollowing()
|
||||
|
||||
@ -49,6 +49,11 @@ struct Physics: View {
|
||||
}
|
||||
)
|
||||
}
|
||||
.onDisappear {
|
||||
// SwiftUI may retain the @StateObject model after the view disappears.
|
||||
// Explicit disposal is only needed here so leak reporting runs after native teardown.
|
||||
model.dispose()
|
||||
}
|
||||
.navigationTitle("Physics (drag anywhere)")
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
}
|
||||
@ -60,6 +65,14 @@ struct Physics: View {
|
||||
|
||||
final class PhysicsModel: ObservableObject {
|
||||
|
||||
// Not strictly necessary for normal usage. SwiftUI will eventually release the
|
||||
// model and controller. We dispose explicitly here so leak reporting runs after
|
||||
// native teardown when navigating back from the example.
|
||||
func dispose() {
|
||||
controller.dispose()
|
||||
}
|
||||
|
||||
|
||||
@Published
|
||||
var controller: SpineController!
|
||||
|
||||
|
||||
@ -49,6 +49,11 @@ struct PlayPauseAnimation: View {
|
||||
controller: controller,
|
||||
boundsProvider: SkinAndAnimationBounds(animation: "flying")
|
||||
)
|
||||
.onDisappear {
|
||||
// SwiftUI may retain the @StateObject controller after the view disappears.
|
||||
// Explicit disposal is only needed here so leak reporting runs after native teardown.
|
||||
controller.dispose()
|
||||
}
|
||||
.navigationTitle("Play/Pause")
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
.toolbar {
|
||||
|
||||
@ -50,6 +50,11 @@ struct SimpleAnimation: View {
|
||||
mode: .fit,
|
||||
alignment: .center
|
||||
)
|
||||
.onDisappear {
|
||||
// SwiftUI may retain the @StateObject controller after the view disappears.
|
||||
// Explicit disposal is only needed here so leak reporting runs after native teardown.
|
||||
controller.dispose()
|
||||
}
|
||||
.navigationTitle("Simple Animation")
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
}
|
||||
|
||||
@ -33,6 +33,7 @@
|
||||
@interface SimpleAnimationViewController ()
|
||||
|
||||
@property (nonatomic, strong) SpineController *spineController;
|
||||
@property (nonatomic, strong) SpineUIView *spineView;
|
||||
|
||||
@end
|
||||
|
||||
@ -56,7 +57,7 @@
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
|
||||
SpineUIView *spineView = [[SpineUIView alloc] initWithAtlasFileName:@"spineboy-pma.atlas"
|
||||
self.spineView = [[SpineUIView alloc] initWithAtlasFileName:@"spineboy-pma.atlas"
|
||||
skeletonFileName:@"spineboy-pro.skel"
|
||||
bundle:[NSBundle mainBundle]
|
||||
controller:self.spineController
|
||||
@ -64,10 +65,20 @@
|
||||
alignment:SpineAlignmentCenter
|
||||
boundsProvider:[[SpineSetupPoseBounds alloc] init]
|
||||
backgroundColor:[UIColor clearColor]];
|
||||
spineView.frame = self.view.bounds;
|
||||
spineView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
|
||||
self.spineView.frame = self.view.bounds;
|
||||
self.spineView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
|
||||
|
||||
[self.view addSubview:spineView];
|
||||
[self.view addSubview:self.spineView];
|
||||
}
|
||||
|
||||
- (void)viewDidDisappear:(BOOL)animated {
|
||||
[super viewDidDisappear:animated];
|
||||
|
||||
// UIKit will eventually release the view controller and controller. We dispose
|
||||
// explicitly here so leak reporting runs after native teardown when navigating back.
|
||||
[self.spineController dispose];
|
||||
[self.spineView removeFromSuperview];
|
||||
self.spineView = nil;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@ -56,8 +56,7 @@ public class Animation: NSObject {
|
||||
return ArrayTimeline(fromPointer: result!)
|
||||
}
|
||||
set {
|
||||
spine_animation_set_timelines(
|
||||
_ptr.assumingMemoryBound(to: spine_animation_wrapper.self), newValue._ptr.assumingMemoryBound(to: spine_array_timeline_wrapper.self))
|
||||
spine_animation_set_timelines(_ptr.assumingMemoryBound(to: spine_animation_wrapper.self), newValue._ptr.assumingMemoryBound(to: spine_array_timeline_wrapper.self))
|
||||
}
|
||||
}
|
||||
|
||||
@ -88,8 +87,7 @@ public class Animation: NSObject {
|
||||
|
||||
/// Returns true if this animation contains a timeline with any of the specified property IDs.
|
||||
public func hasTimeline(_ ids: ArrayPropertyId) -> Bool {
|
||||
let result = spine_animation_has_timeline(
|
||||
_ptr.assumingMemoryBound(to: spine_animation_wrapper.self), ids._ptr.assumingMemoryBound(to: spine_array_property_id_wrapper.self))
|
||||
let result = spine_animation_has_timeline(_ptr.assumingMemoryBound(to: spine_animation_wrapper.self), ids._ptr.assumingMemoryBound(to: spine_array_property_id_wrapper.self))
|
||||
return result
|
||||
}
|
||||
|
||||
@ -105,14 +103,8 @@ public class Animation: NSObject {
|
||||
/// - Parameter alpha: 0 applies the current or setup values (depending on blend). 1 applies the timeline values. Between 0 and 1 applies values between the current or setup values and the timeline values. By adjusting alpha over time, an animation can be mixed in or out. alpha can also be useful to apply animations on top of each other (layering).
|
||||
/// - Parameter blend: Controls how mixing is applied when alpha < 1.
|
||||
/// - Parameter direction: Indicates whether the timelines are mixing in or out. Used by timelines which perform instant transitions, such as DrawOrderTimeline or AttachmentTimeline.
|
||||
public func apply(
|
||||
_ skeleton: Skeleton, _ lastTime: Float, _ time: Float, _ loop: Bool, _ events: ArrayEvent?, _ alpha: Float, _ blend: MixBlend,
|
||||
_ direction: MixDirection, _ appliedPose: Bool
|
||||
) {
|
||||
spine_animation_apply(
|
||||
_ptr.assumingMemoryBound(to: spine_animation_wrapper.self), skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self), lastTime,
|
||||
time, loop, events?._ptr.assumingMemoryBound(to: spine_array_event_wrapper.self), alpha,
|
||||
spine_mix_blend(rawValue: UInt32(blend.rawValue)), spine_mix_direction(rawValue: UInt32(direction.rawValue)), appliedPose)
|
||||
public func apply(_ skeleton: Skeleton, _ lastTime: Float, _ time: Float, _ loop: Bool, _ events: ArrayEvent?, _ alpha: Float, _ blend: MixBlend, _ direction: MixDirection, _ appliedPose: Bool) {
|
||||
spine_animation_apply(_ptr.assumingMemoryBound(to: spine_animation_wrapper.self), skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self), lastTime, time, loop, events?._ptr.assumingMemoryBound(to: spine_array_event_wrapper.self), alpha, spine_mix_blend(rawValue: UInt32(blend.rawValue)), spine_mix_direction(rawValue: UInt32(direction.rawValue)), appliedPose)
|
||||
}
|
||||
|
||||
/// - Parameter target: After the first and before the last entry.
|
||||
|
||||
@ -381,8 +381,7 @@ public class ArrayAnimation: NSObject {
|
||||
|
||||
/// Adds a value to the end of this array
|
||||
public func add(_ value: Animation?) {
|
||||
spine_array_animation_add(
|
||||
_ptr.assumingMemoryBound(to: spine_array_animation_wrapper.self), value?._ptr.assumingMemoryBound(to: spine_animation_wrapper.self))
|
||||
spine_array_animation_add(_ptr.assumingMemoryBound(to: spine_array_animation_wrapper.self), value?._ptr.assumingMemoryBound(to: spine_animation_wrapper.self))
|
||||
}
|
||||
|
||||
/// Removes all elements from this array
|
||||
@ -460,8 +459,7 @@ public class ArrayAtlasPage: NSObject {
|
||||
|
||||
/// Adds a value to the end of this array
|
||||
public func add(_ value: AtlasPage?) {
|
||||
spine_array_atlas_page_add(
|
||||
_ptr.assumingMemoryBound(to: spine_array_atlas_page_wrapper.self), value?._ptr.assumingMemoryBound(to: spine_atlas_page_wrapper.self))
|
||||
spine_array_atlas_page_add(_ptr.assumingMemoryBound(to: spine_array_atlas_page_wrapper.self), value?._ptr.assumingMemoryBound(to: spine_atlas_page_wrapper.self))
|
||||
}
|
||||
|
||||
/// Removes all elements from this array
|
||||
@ -539,8 +537,7 @@ public class ArrayAtlasRegion: NSObject {
|
||||
|
||||
/// Adds a value to the end of this array
|
||||
public func add(_ value: AtlasRegion?) {
|
||||
spine_array_atlas_region_add(
|
||||
_ptr.assumingMemoryBound(to: spine_array_atlas_region_wrapper.self), value?._ptr.assumingMemoryBound(to: spine_atlas_region_wrapper.self))
|
||||
spine_array_atlas_region_add(_ptr.assumingMemoryBound(to: spine_array_atlas_region_wrapper.self), value?._ptr.assumingMemoryBound(to: spine_atlas_region_wrapper.self))
|
||||
}
|
||||
|
||||
/// Removes all elements from this array
|
||||
@ -642,8 +639,7 @@ public class ArrayAttachment: NSObject {
|
||||
|
||||
/// Adds a value to the end of this array
|
||||
public func add(_ value: Attachment?) {
|
||||
spine_array_attachment_add(
|
||||
_ptr.assumingMemoryBound(to: spine_array_attachment_wrapper.self), value?._ptr.assumingMemoryBound(to: spine_attachment_wrapper.self))
|
||||
spine_array_attachment_add(_ptr.assumingMemoryBound(to: spine_array_attachment_wrapper.self), value?._ptr.assumingMemoryBound(to: spine_attachment_wrapper.self))
|
||||
}
|
||||
|
||||
/// Removes all elements from this array
|
||||
@ -721,8 +717,7 @@ public class ArrayBone: NSObject {
|
||||
|
||||
/// Adds a value to the end of this array
|
||||
public func add(_ value: Bone?) {
|
||||
spine_array_bone_add(
|
||||
_ptr.assumingMemoryBound(to: spine_array_bone_wrapper.self), value?._ptr.assumingMemoryBound(to: spine_bone_wrapper.self))
|
||||
spine_array_bone_add(_ptr.assumingMemoryBound(to: spine_array_bone_wrapper.self), value?._ptr.assumingMemoryBound(to: spine_bone_wrapper.self))
|
||||
}
|
||||
|
||||
/// Removes all elements from this array
|
||||
@ -800,8 +795,7 @@ public class ArrayBoneData: NSObject {
|
||||
|
||||
/// Adds a value to the end of this array
|
||||
public func add(_ value: BoneData?) {
|
||||
spine_array_bone_data_add(
|
||||
_ptr.assumingMemoryBound(to: spine_array_bone_data_wrapper.self), value?._ptr.assumingMemoryBound(to: spine_bone_data_wrapper.self))
|
||||
spine_array_bone_data_add(_ptr.assumingMemoryBound(to: spine_array_bone_data_wrapper.self), value?._ptr.assumingMemoryBound(to: spine_bone_data_wrapper.self))
|
||||
}
|
||||
|
||||
/// Removes all elements from this array
|
||||
@ -879,8 +873,7 @@ public class ArrayBonePose: NSObject {
|
||||
|
||||
/// Adds a value to the end of this array
|
||||
public func add(_ value: BonePose?) {
|
||||
spine_array_bone_pose_add(
|
||||
_ptr.assumingMemoryBound(to: spine_array_bone_pose_wrapper.self), value?._ptr.assumingMemoryBound(to: spine_bone_pose_wrapper.self))
|
||||
spine_array_bone_pose_add(_ptr.assumingMemoryBound(to: spine_array_bone_pose_wrapper.self), value?._ptr.assumingMemoryBound(to: spine_bone_pose_wrapper.self))
|
||||
}
|
||||
|
||||
/// Removes all elements from this array
|
||||
@ -958,9 +951,7 @@ public class ArrayBoundingBoxAttachment: NSObject {
|
||||
|
||||
/// Adds a value to the end of this array
|
||||
public func add(_ value: BoundingBoxAttachment?) {
|
||||
spine_array_bounding_box_attachment_add(
|
||||
_ptr.assumingMemoryBound(to: spine_array_bounding_box_attachment_wrapper.self),
|
||||
value?._ptr.assumingMemoryBound(to: spine_bounding_box_attachment_wrapper.self))
|
||||
spine_array_bounding_box_attachment_add(_ptr.assumingMemoryBound(to: spine_array_bounding_box_attachment_wrapper.self), value?._ptr.assumingMemoryBound(to: spine_bounding_box_attachment_wrapper.self))
|
||||
}
|
||||
|
||||
/// Removes all elements from this array
|
||||
@ -981,8 +972,7 @@ public class ArrayBoundingBoxAttachment: NSObject {
|
||||
public var length: Int {
|
||||
get { count }
|
||||
set {
|
||||
spine_array_bounding_box_attachment_set_size(
|
||||
_ptr.assumingMemoryBound(to: spine_array_bounding_box_attachment_wrapper.self), newValue, nil)
|
||||
spine_array_bounding_box_attachment_set_size(_ptr.assumingMemoryBound(to: spine_array_bounding_box_attachment_wrapper.self), newValue, nil)
|
||||
}
|
||||
}
|
||||
|
||||
@ -1060,8 +1050,7 @@ public class ArrayConstraint: NSObject {
|
||||
|
||||
/// Adds a value to the end of this array
|
||||
public func add(_ value: Constraint?) {
|
||||
spine_array_constraint_add(
|
||||
_ptr.assumingMemoryBound(to: spine_array_constraint_wrapper.self), value?._ptr.assumingMemoryBound(to: spine_constraint_wrapper.self))
|
||||
spine_array_constraint_add(_ptr.assumingMemoryBound(to: spine_array_constraint_wrapper.self), value?._ptr.assumingMemoryBound(to: spine_constraint_wrapper.self))
|
||||
}
|
||||
|
||||
/// Removes all elements from this array
|
||||
@ -1160,9 +1149,7 @@ public class ArrayConstraintData: NSObject {
|
||||
|
||||
/// Adds a value to the end of this array
|
||||
public func add(_ value: ConstraintData?) {
|
||||
spine_array_constraint_data_add(
|
||||
_ptr.assumingMemoryBound(to: spine_array_constraint_data_wrapper.self),
|
||||
value?._ptr.assumingMemoryBound(to: spine_constraint_data_wrapper.self))
|
||||
spine_array_constraint_data_add(_ptr.assumingMemoryBound(to: spine_array_constraint_data_wrapper.self), value?._ptr.assumingMemoryBound(to: spine_constraint_data_wrapper.self))
|
||||
}
|
||||
|
||||
/// Removes all elements from this array
|
||||
@ -1240,8 +1227,7 @@ public class ArrayEvent: NSObject {
|
||||
|
||||
/// Adds a value to the end of this array
|
||||
public func add(_ value: Event?) {
|
||||
spine_array_event_add(
|
||||
_ptr.assumingMemoryBound(to: spine_array_event_wrapper.self), value?._ptr.assumingMemoryBound(to: spine_event_wrapper.self))
|
||||
spine_array_event_add(_ptr.assumingMemoryBound(to: spine_array_event_wrapper.self), value?._ptr.assumingMemoryBound(to: spine_event_wrapper.self))
|
||||
}
|
||||
|
||||
/// Removes all elements from this array
|
||||
@ -1319,8 +1305,7 @@ public class ArrayEventData: NSObject {
|
||||
|
||||
/// Adds a value to the end of this array
|
||||
public func add(_ value: EventData?) {
|
||||
spine_array_event_data_add(
|
||||
_ptr.assumingMemoryBound(to: spine_array_event_data_wrapper.self), value?._ptr.assumingMemoryBound(to: spine_event_data_wrapper.self))
|
||||
spine_array_event_data_add(_ptr.assumingMemoryBound(to: spine_array_event_data_wrapper.self), value?._ptr.assumingMemoryBound(to: spine_event_data_wrapper.self))
|
||||
}
|
||||
|
||||
/// Removes all elements from this array
|
||||
@ -1422,9 +1407,7 @@ public class ArrayFromProperty: NSObject {
|
||||
|
||||
/// Adds a value to the end of this array
|
||||
public func add(_ value: FromProperty?) {
|
||||
spine_array_from_property_add(
|
||||
_ptr.assumingMemoryBound(to: spine_array_from_property_wrapper.self),
|
||||
value?._ptr.assumingMemoryBound(to: spine_from_property_wrapper.self))
|
||||
spine_array_from_property_add(_ptr.assumingMemoryBound(to: spine_array_from_property_wrapper.self), value?._ptr.assumingMemoryBound(to: spine_from_property_wrapper.self))
|
||||
}
|
||||
|
||||
/// Removes all elements from this array
|
||||
@ -1502,9 +1485,7 @@ public class ArrayPhysicsConstraint: NSObject {
|
||||
|
||||
/// Adds a value to the end of this array
|
||||
public func add(_ value: PhysicsConstraint?) {
|
||||
spine_array_physics_constraint_add(
|
||||
_ptr.assumingMemoryBound(to: spine_array_physics_constraint_wrapper.self),
|
||||
value?._ptr.assumingMemoryBound(to: spine_physics_constraint_wrapper.self))
|
||||
spine_array_physics_constraint_add(_ptr.assumingMemoryBound(to: spine_array_physics_constraint_wrapper.self), value?._ptr.assumingMemoryBound(to: spine_physics_constraint_wrapper.self))
|
||||
}
|
||||
|
||||
/// Removes all elements from this array
|
||||
@ -1582,8 +1563,7 @@ public class ArrayPolygon: NSObject {
|
||||
|
||||
/// Adds a value to the end of this array
|
||||
public func add(_ value: Polygon?) {
|
||||
spine_array_polygon_add(
|
||||
_ptr.assumingMemoryBound(to: spine_array_polygon_wrapper.self), value?._ptr.assumingMemoryBound(to: spine_polygon_wrapper.self))
|
||||
spine_array_polygon_add(_ptr.assumingMemoryBound(to: spine_array_polygon_wrapper.self), value?._ptr.assumingMemoryBound(to: spine_polygon_wrapper.self))
|
||||
}
|
||||
|
||||
/// Removes all elements from this array
|
||||
@ -1661,8 +1641,7 @@ public class ArraySkin: NSObject {
|
||||
|
||||
/// Adds a value to the end of this array
|
||||
public func add(_ value: Skin?) {
|
||||
spine_array_skin_add(
|
||||
_ptr.assumingMemoryBound(to: spine_array_skin_wrapper.self), value?._ptr.assumingMemoryBound(to: spine_skin_wrapper.self))
|
||||
spine_array_skin_add(_ptr.assumingMemoryBound(to: spine_array_skin_wrapper.self), value?._ptr.assumingMemoryBound(to: spine_skin_wrapper.self))
|
||||
}
|
||||
|
||||
/// Removes all elements from this array
|
||||
@ -1740,8 +1719,7 @@ public class ArraySlot: NSObject {
|
||||
|
||||
/// Adds a value to the end of this array
|
||||
public func add(_ value: Slot?) {
|
||||
spine_array_slot_add(
|
||||
_ptr.assumingMemoryBound(to: spine_array_slot_wrapper.self), value?._ptr.assumingMemoryBound(to: spine_slot_wrapper.self))
|
||||
spine_array_slot_add(_ptr.assumingMemoryBound(to: spine_array_slot_wrapper.self), value?._ptr.assumingMemoryBound(to: spine_slot_wrapper.self))
|
||||
}
|
||||
|
||||
/// Removes all elements from this array
|
||||
@ -1819,8 +1797,7 @@ public class ArraySlotData: NSObject {
|
||||
|
||||
/// Adds a value to the end of this array
|
||||
public func add(_ value: SlotData?) {
|
||||
spine_array_slot_data_add(
|
||||
_ptr.assumingMemoryBound(to: spine_array_slot_data_wrapper.self), value?._ptr.assumingMemoryBound(to: spine_slot_data_wrapper.self))
|
||||
spine_array_slot_data_add(_ptr.assumingMemoryBound(to: spine_array_slot_data_wrapper.self), value?._ptr.assumingMemoryBound(to: spine_slot_data_wrapper.self))
|
||||
}
|
||||
|
||||
/// Removes all elements from this array
|
||||
@ -1898,9 +1875,7 @@ public class ArrayTextureRegion: NSObject {
|
||||
|
||||
/// Adds a value to the end of this array
|
||||
public func add(_ value: TextureRegion?) {
|
||||
spine_array_texture_region_add(
|
||||
_ptr.assumingMemoryBound(to: spine_array_texture_region_wrapper.self),
|
||||
value?._ptr.assumingMemoryBound(to: spine_texture_region_wrapper.self))
|
||||
spine_array_texture_region_add(_ptr.assumingMemoryBound(to: spine_array_texture_region_wrapper.self), value?._ptr.assumingMemoryBound(to: spine_texture_region_wrapper.self))
|
||||
}
|
||||
|
||||
/// Removes all elements from this array
|
||||
@ -2092,8 +2067,7 @@ public class ArrayTimeline: NSObject {
|
||||
|
||||
/// Adds a value to the end of this array
|
||||
public func add(_ value: Timeline?) {
|
||||
spine_array_timeline_add(
|
||||
_ptr.assumingMemoryBound(to: spine_array_timeline_wrapper.self), value?._ptr.assumingMemoryBound(to: spine_timeline_wrapper.self))
|
||||
spine_array_timeline_add(_ptr.assumingMemoryBound(to: spine_array_timeline_wrapper.self), value?._ptr.assumingMemoryBound(to: spine_timeline_wrapper.self))
|
||||
}
|
||||
|
||||
/// Removes all elements from this array
|
||||
@ -2195,8 +2169,7 @@ public class ArrayToProperty: NSObject {
|
||||
|
||||
/// Adds a value to the end of this array
|
||||
public func add(_ value: ToProperty?) {
|
||||
spine_array_to_property_add(
|
||||
_ptr.assumingMemoryBound(to: spine_array_to_property_wrapper.self), value?._ptr.assumingMemoryBound(to: spine_to_property_wrapper.self))
|
||||
spine_array_to_property_add(_ptr.assumingMemoryBound(to: spine_array_to_property_wrapper.self), value?._ptr.assumingMemoryBound(to: spine_to_property_wrapper.self))
|
||||
}
|
||||
|
||||
/// Removes all elements from this array
|
||||
@ -2274,8 +2247,7 @@ public class ArrayTrackEntry: NSObject {
|
||||
|
||||
/// Adds a value to the end of this array
|
||||
public func add(_ value: TrackEntry?) {
|
||||
spine_array_track_entry_add(
|
||||
_ptr.assumingMemoryBound(to: spine_array_track_entry_wrapper.self), value?._ptr.assumingMemoryBound(to: spine_track_entry_wrapper.self))
|
||||
spine_array_track_entry_add(_ptr.assumingMemoryBound(to: spine_array_track_entry_wrapper.self), value?._ptr.assumingMemoryBound(to: spine_track_entry_wrapper.self))
|
||||
}
|
||||
|
||||
/// Removes all elements from this array
|
||||
@ -2380,8 +2352,7 @@ public class ArrayUpdate: NSObject {
|
||||
|
||||
/// Adds a value to the end of this array
|
||||
public func add(_ value: Update?) {
|
||||
spine_array_update_add(
|
||||
_ptr.assumingMemoryBound(to: spine_array_update_wrapper.self), value?._ptr.assumingMemoryBound(to: spine_update_wrapper.self))
|
||||
spine_array_update_add(_ptr.assumingMemoryBound(to: spine_array_update_wrapper.self), value?._ptr.assumingMemoryBound(to: spine_update_wrapper.self))
|
||||
}
|
||||
|
||||
/// Removes all elements from this array
|
||||
|
||||
@ -48,15 +48,13 @@ public class Bone: PosedActive, Posed, Update {
|
||||
|
||||
/// - Parameter parent: May be NULL.
|
||||
public convenience init(_ data: BoneData, _ parent: Bone?) {
|
||||
let ptr = spine_bone_create(
|
||||
data._ptr.assumingMemoryBound(to: spine_bone_data_wrapper.self), parent?._ptr.assumingMemoryBound(to: spine_bone_wrapper.self))
|
||||
let ptr = spine_bone_create(data._ptr.assumingMemoryBound(to: spine_bone_data_wrapper.self), parent?._ptr.assumingMemoryBound(to: spine_bone_wrapper.self))
|
||||
self.init(fromPointer: ptr!)
|
||||
}
|
||||
|
||||
/// Copy constructor. Does not copy the children bones.
|
||||
public static func from(_ bone: Bone, _ parent: Bone?) -> Bone {
|
||||
let ptr = spine_bone_create2(
|
||||
bone._ptr.assumingMemoryBound(to: spine_bone_wrapper.self), parent?._ptr.assumingMemoryBound(to: spine_bone_wrapper.self))
|
||||
let ptr = spine_bone_create2(bone._ptr.assumingMemoryBound(to: spine_bone_wrapper.self), parent?._ptr.assumingMemoryBound(to: spine_bone_wrapper.self))
|
||||
return Bone(fromPointer: ptr!)
|
||||
}
|
||||
|
||||
@ -108,9 +106,7 @@ public class Bone: PosedActive, Posed, Update {
|
||||
}
|
||||
|
||||
public func update(_ skeleton: Skeleton, _ physics: Physics) {
|
||||
spine_bone_update(
|
||||
_ptr.assumingMemoryBound(to: spine_bone_wrapper.self), skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self),
|
||||
spine_physics(rawValue: UInt32(physics.rawValue)))
|
||||
spine_bone_update(_ptr.assumingMemoryBound(to: spine_bone_wrapper.self), skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self), spine_physics(rawValue: UInt32(physics.rawValue)))
|
||||
}
|
||||
|
||||
public func resetConstrained() {
|
||||
|
||||
@ -124,8 +124,7 @@ public class Color: NSObject {
|
||||
}
|
||||
|
||||
public func set3(_ other: Color) -> Color {
|
||||
let result = spine_color_set_3(
|
||||
_ptr.assumingMemoryBound(to: spine_color_wrapper.self), other._ptr.assumingMemoryBound(to: spine_color_wrapper.self))
|
||||
let result = spine_color_set_3(_ptr.assumingMemoryBound(to: spine_color_wrapper.self), other._ptr.assumingMemoryBound(to: spine_color_wrapper.self))
|
||||
return Color(fromPointer: result!)
|
||||
}
|
||||
|
||||
@ -140,8 +139,7 @@ public class Color: NSObject {
|
||||
}
|
||||
|
||||
public func add3(_ other: Color) -> Color {
|
||||
let result = spine_color_add_3(
|
||||
_ptr.assumingMemoryBound(to: spine_color_wrapper.self), other._ptr.assumingMemoryBound(to: spine_color_wrapper.self))
|
||||
let result = spine_color_add_3(_ptr.assumingMemoryBound(to: spine_color_wrapper.self), other._ptr.assumingMemoryBound(to: spine_color_wrapper.self))
|
||||
return Color(fromPointer: result!)
|
||||
}
|
||||
|
||||
|
||||
@ -54,8 +54,7 @@ public class Polygon: NSObject {
|
||||
return ArrayFloat(fromPointer: result!)
|
||||
}
|
||||
set {
|
||||
spine_polygon_set__vertices(
|
||||
_ptr.assumingMemoryBound(to: spine_polygon_wrapper.self), newValue._ptr.assumingMemoryBound(to: spine_array_float_wrapper.self))
|
||||
spine_polygon_set__vertices(_ptr.assumingMemoryBound(to: spine_polygon_wrapper.self), newValue._ptr.assumingMemoryBound(to: spine_array_float_wrapper.self))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -49,14 +49,12 @@ public class Rtti: NSObject {
|
||||
}
|
||||
|
||||
public func isExactly(_ rtti: Rtti) -> Bool {
|
||||
let result = spine_rtti_is_exactly(
|
||||
_ptr.assumingMemoryBound(to: spine_rtti_wrapper.self), rtti._ptr.assumingMemoryBound(to: spine_rtti_wrapper.self))
|
||||
let result = spine_rtti_is_exactly(_ptr.assumingMemoryBound(to: spine_rtti_wrapper.self), rtti._ptr.assumingMemoryBound(to: spine_rtti_wrapper.self))
|
||||
return result
|
||||
}
|
||||
|
||||
public func instanceOf(_ rtti: Rtti) -> Bool {
|
||||
let result = spine_rtti_instance_of(
|
||||
_ptr.assumingMemoryBound(to: spine_rtti_wrapper.self), rtti._ptr.assumingMemoryBound(to: spine_rtti_wrapper.self))
|
||||
let result = spine_rtti_instance_of(_ptr.assumingMemoryBound(to: spine_rtti_wrapper.self), rtti._ptr.assumingMemoryBound(to: spine_rtti_wrapper.self))
|
||||
return result
|
||||
}
|
||||
|
||||
|
||||
@ -32,7 +32,8 @@
|
||||
import Foundation
|
||||
import SpineC
|
||||
|
||||
/// Sequence wrapper
|
||||
/// Holds texture regions, UVs, and vertex offsets for rendering a region or mesh attachment.
|
||||
/// Regions must be populated and update() called before use.
|
||||
@objc(SpineSequence)
|
||||
@objcMembers
|
||||
public class Sequence: NSObject {
|
||||
@ -43,20 +44,20 @@ public class Sequence: NSObject {
|
||||
super.init()
|
||||
}
|
||||
|
||||
public convenience init(_ count: Int32) {
|
||||
let ptr = spine_sequence_create(count)
|
||||
public convenience init(_ count: Int32, _ pathSuffix: Bool) {
|
||||
let ptr = spine_sequence_create(count, pathSuffix)
|
||||
self.init(fromPointer: ptr!)
|
||||
}
|
||||
|
||||
/// Returns a unique ID for this attachment.
|
||||
public var id: Int32 {
|
||||
get {
|
||||
let result = spine_sequence_get_id(_ptr.assumingMemoryBound(to: spine_sequence_wrapper.self))
|
||||
return result
|
||||
}
|
||||
set {
|
||||
spine_sequence_set_id(_ptr.assumingMemoryBound(to: spine_sequence_wrapper.self), newValue)
|
||||
/// Copy constructor.
|
||||
public static func from(_ other: Sequence) -> Sequence {
|
||||
let ptr = spine_sequence_create2(other._ptr.assumingMemoryBound(to: spine_sequence_wrapper.self))
|
||||
return Sequence(fromPointer: ptr!)
|
||||
}
|
||||
|
||||
public var regions: ArrayTextureRegion {
|
||||
let result = spine_sequence_get_regions(_ptr.assumingMemoryBound(to: spine_sequence_wrapper.self))
|
||||
return ArrayTextureRegion(fromPointer: result!)
|
||||
}
|
||||
|
||||
public var start: Int32 {
|
||||
@ -90,20 +91,37 @@ public class Sequence: NSObject {
|
||||
}
|
||||
}
|
||||
|
||||
public var regions: ArrayTextureRegion {
|
||||
let result = spine_sequence_get_regions(_ptr.assumingMemoryBound(to: spine_sequence_wrapper.self))
|
||||
return ArrayTextureRegion(fromPointer: result!)
|
||||
public var pathSuffix: Bool {
|
||||
let result = spine_sequence_get_path_suffix(_ptr.assumingMemoryBound(to: spine_sequence_wrapper.self))
|
||||
return result
|
||||
}
|
||||
|
||||
public func copyAttachment() -> Sequence {
|
||||
let result = spine_sequence_copy(_ptr.assumingMemoryBound(to: spine_sequence_wrapper.self))
|
||||
return Sequence(fromPointer: result!)
|
||||
/// Returns a unique ID for this attachment.
|
||||
public var id: Int32 {
|
||||
let result = spine_sequence_get_id(_ptr.assumingMemoryBound(to: spine_sequence_wrapper.self))
|
||||
return result
|
||||
}
|
||||
|
||||
public func apply(_ slot: SlotPose?, _ attachment: Attachment?) {
|
||||
spine_sequence_apply(
|
||||
_ptr.assumingMemoryBound(to: spine_sequence_wrapper.self), slot?._ptr.assumingMemoryBound(to: spine_slot_pose_wrapper.self),
|
||||
attachment?._ptr.assumingMemoryBound(to: spine_attachment_wrapper.self))
|
||||
public func resolveIndex(_ pose: SlotPose) -> Int32 {
|
||||
let result = spine_sequence_resolve_index(_ptr.assumingMemoryBound(to: spine_sequence_wrapper.self), pose._ptr.assumingMemoryBound(to: spine_slot_pose_wrapper.self))
|
||||
return result
|
||||
}
|
||||
|
||||
public func getRegion(_ index: Int32) -> TextureRegion? {
|
||||
let result = spine_sequence_get_region(_ptr.assumingMemoryBound(to: spine_sequence_wrapper.self), index)
|
||||
return result.map { TextureRegion(fromPointer: $0) }
|
||||
}
|
||||
|
||||
public func getUVs(_ index: Int32) -> ArrayFloat {
|
||||
let result = spine_sequence_get_u_vs(_ptr.assumingMemoryBound(to: spine_sequence_wrapper.self), index)
|
||||
return ArrayFloat(fromPointer: result!)
|
||||
}
|
||||
|
||||
/// Returns vertex offsets from the center of a RegionAttachment. Invalid to call for a
|
||||
/// MeshAttachment.
|
||||
public func getOffsets(_ index: Int32) -> ArrayFloat {
|
||||
let result = spine_sequence_get_offsets(_ptr.assumingMemoryBound(to: spine_sequence_wrapper.self), index)
|
||||
return ArrayFloat(fromPointer: result!)
|
||||
}
|
||||
|
||||
public func getPath(_ basePath: String, _ index: Int32) -> String {
|
||||
@ -111,6 +129,16 @@ public class Sequence: NSObject {
|
||||
return String(cString: result!)
|
||||
}
|
||||
|
||||
/// Computes UVs and offsets for the specified attachment. Must be called if the regions or
|
||||
/// attachment properties are changed.
|
||||
public func update(_ attachment: RegionAttachment) {
|
||||
spine_sequence_update_1(_ptr.assumingMemoryBound(to: spine_sequence_wrapper.self), attachment._ptr.assumingMemoryBound(to: spine_region_attachment_wrapper.self))
|
||||
}
|
||||
|
||||
public func update2(_ attachment: MeshAttachment) {
|
||||
spine_sequence_update_2(_ptr.assumingMemoryBound(to: spine_sequence_wrapper.self), attachment._ptr.assumingMemoryBound(to: spine_mesh_attachment_wrapper.self))
|
||||
}
|
||||
|
||||
public func dispose() {
|
||||
spine_sequence_dispose(_ptr.assumingMemoryBound(to: spine_sequence_wrapper.self))
|
||||
}
|
||||
|
||||
@ -191,8 +191,7 @@ public class Skeleton: NSObject {
|
||||
public var setColor: Color {
|
||||
get { fatalError("Setter-only property") }
|
||||
set(newValue) {
|
||||
spine_skeleton_set_color_1(
|
||||
_ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self), newValue._ptr.assumingMemoryBound(to: spine_color_wrapper.self))
|
||||
spine_skeleton_set_color_1(_ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self), newValue._ptr.assumingMemoryBound(to: spine_color_wrapper.self))
|
||||
}
|
||||
}
|
||||
|
||||
@ -207,13 +206,11 @@ public class Skeleton: NSObject {
|
||||
}
|
||||
|
||||
public func constrained(_ object: Posed) {
|
||||
spine_skeleton_constrained(
|
||||
_ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self), object._ptr.assumingMemoryBound(to: spine_posed_wrapper.self))
|
||||
spine_skeleton_constrained(_ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self), object._ptr.assumingMemoryBound(to: spine_posed_wrapper.self))
|
||||
}
|
||||
|
||||
public func sortBone(_ bone: Bone?) {
|
||||
spine_skeleton_sort_bone(
|
||||
_ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self), bone?._ptr.assumingMemoryBound(to: spine_bone_wrapper.self))
|
||||
spine_skeleton_sort_bone(_ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self), bone?._ptr.assumingMemoryBound(to: spine_bone_wrapper.self))
|
||||
}
|
||||
|
||||
public static func sortReset(_ bones: ArrayBone) {
|
||||
@ -225,8 +222,7 @@ public class Skeleton: NSObject {
|
||||
/// See [World transforms](http://esotericsoftware.com/spine-runtime-skeletons#World-transforms)
|
||||
/// in the Spine Runtimes Guide.
|
||||
public func updateWorldTransform(_ physics: Physics) {
|
||||
spine_skeleton_update_world_transform(
|
||||
_ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self), spine_physics(rawValue: UInt32(physics.rawValue)))
|
||||
spine_skeleton_update_world_transform(_ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self), spine_physics(rawValue: UInt32(physics.rawValue)))
|
||||
}
|
||||
|
||||
/// Sets the bones, constraints, and slots to their setup pose values.
|
||||
@ -297,8 +293,7 @@ public class Skeleton: NSObject {
|
||||
///
|
||||
/// - Parameter newSkin: May be NULL.
|
||||
public func setSkin2(_ newSkin: Skin?) {
|
||||
spine_skeleton_set_skin_2(
|
||||
_ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self), newSkin?._ptr.assumingMemoryBound(to: spine_skin_wrapper.self))
|
||||
spine_skeleton_set_skin_2(_ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self), newSkin?._ptr.assumingMemoryBound(to: spine_skin_wrapper.self))
|
||||
}
|
||||
|
||||
/// - Returns: May be NULL.
|
||||
|
||||
@ -73,9 +73,7 @@ public class Skin: NSObject {
|
||||
/// Adds an attachment to the skin for the specified slot index and name. If the name already
|
||||
/// exists for the slot, the previous value is replaced.
|
||||
public func setAttachment(_ slotIndex: Int, _ name: String, _ attachment: Attachment?) {
|
||||
spine_skin_set_attachment(
|
||||
_ptr.assumingMemoryBound(to: spine_skin_wrapper.self), slotIndex, name,
|
||||
attachment?._ptr.assumingMemoryBound(to: spine_attachment_wrapper.self))
|
||||
spine_skin_set_attachment(_ptr.assumingMemoryBound(to: spine_skin_wrapper.self), slotIndex, name, attachment?._ptr.assumingMemoryBound(to: spine_attachment_wrapper.self))
|
||||
}
|
||||
|
||||
/// Returns the attachment for the specified slot index and name, or NULL.
|
||||
@ -119,9 +117,7 @@ public class Skin: NSObject {
|
||||
/// - Parameter slotIndex: The target slotIndex. To find the slot index, use SkeletonData::findSlot and SlotData::getIndex.
|
||||
/// - Parameter attachments: Found Attachments will be added to this array.
|
||||
public func findAttachmentsForSlot(_ slotIndex: Int, _ attachments: ArrayAttachment) {
|
||||
spine_skin_find_attachments_for_slot(
|
||||
_ptr.assumingMemoryBound(to: spine_skin_wrapper.self), slotIndex,
|
||||
attachments._ptr.assumingMemoryBound(to: spine_array_attachment_wrapper.self))
|
||||
spine_skin_find_attachments_for_slot(_ptr.assumingMemoryBound(to: spine_skin_wrapper.self), slotIndex, attachments._ptr.assumingMemoryBound(to: spine_array_attachment_wrapper.self))
|
||||
}
|
||||
|
||||
/// Adds all attachments, bones, and constraints from the specified skin to this skin.
|
||||
|
||||
@ -42,8 +42,7 @@ public class Slider: SliderBase {
|
||||
}
|
||||
|
||||
public convenience init(_ data: SliderData, _ skeleton: Skeleton) {
|
||||
let ptr = spine_slider_create(
|
||||
data._ptr.assumingMemoryBound(to: spine_slider_data_wrapper.self), skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self))
|
||||
let ptr = spine_slider_create(data._ptr.assumingMemoryBound(to: spine_slider_data_wrapper.self), skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self))
|
||||
self.init(fromPointer: ptr!)
|
||||
}
|
||||
|
||||
@ -53,14 +52,12 @@ public class Slider: SliderBase {
|
||||
return Bone(fromPointer: result!)
|
||||
}
|
||||
set {
|
||||
spine_slider_set_bone(
|
||||
_ptr.assumingMemoryBound(to: spine_slider_wrapper.self), newValue._ptr.assumingMemoryBound(to: spine_bone_wrapper.self))
|
||||
spine_slider_set_bone(_ptr.assumingMemoryBound(to: spine_slider_wrapper.self), newValue._ptr.assumingMemoryBound(to: spine_bone_wrapper.self))
|
||||
}
|
||||
}
|
||||
|
||||
public func copyAttachment(_ skeleton: Skeleton) -> Slider {
|
||||
let result = spine_slider_copy(
|
||||
_ptr.assumingMemoryBound(to: spine_slider_wrapper.self), skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self))
|
||||
let result = spine_slider_copy(_ptr.assumingMemoryBound(to: spine_slider_wrapper.self), skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self))
|
||||
return Slider(fromPointer: result!)
|
||||
}
|
||||
|
||||
|
||||
@ -46,8 +46,7 @@ public class Slot: NSObject, Posed {
|
||||
}
|
||||
|
||||
public convenience init(_ data: SlotData, _ skeleton: Skeleton) {
|
||||
let ptr = spine_slot_create(
|
||||
data._ptr.assumingMemoryBound(to: spine_slot_data_wrapper.self), skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self))
|
||||
let ptr = spine_slot_create(data._ptr.assumingMemoryBound(to: spine_slot_data_wrapper.self), skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self))
|
||||
self.init(fromPointer: ptr!)
|
||||
}
|
||||
|
||||
|
||||
@ -83,14 +83,8 @@ open class Timeline: NSObject {
|
||||
/// - Parameter blend: Controls how mixing is applied when alpha is than 1.
|
||||
/// - Parameter direction: Indicates whether the timeline is mixing in or out. Used by timelines which perform instant transitions such as DrawOrderTimeline and AttachmentTimeline.
|
||||
/// - Parameter appliedPose: True to modify the applied pose.
|
||||
public func apply(
|
||||
_ skeleton: Skeleton, _ lastTime: Float, _ time: Float, _ events: ArrayEvent?, _ alpha: Float, _ blend: MixBlend, _ direction: MixDirection,
|
||||
_ appliedPose: Bool
|
||||
) {
|
||||
spine_timeline_apply(
|
||||
_ptr.assumingMemoryBound(to: spine_timeline_wrapper.self), skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self), lastTime,
|
||||
time, events?._ptr.assumingMemoryBound(to: spine_array_event_wrapper.self), alpha, spine_mix_blend(rawValue: UInt32(blend.rawValue)),
|
||||
spine_mix_direction(rawValue: UInt32(direction.rawValue)), appliedPose)
|
||||
public func apply(_ skeleton: Skeleton, _ lastTime: Float, _ time: Float, _ events: ArrayEvent?, _ alpha: Float, _ blend: MixBlend, _ direction: MixDirection, _ appliedPose: Bool) {
|
||||
spine_timeline_apply(_ptr.assumingMemoryBound(to: spine_timeline_wrapper.self), skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self), lastTime, time, events?._ptr.assumingMemoryBound(to: spine_array_event_wrapper.self), alpha, spine_mix_blend(rawValue: UInt32(blend.rawValue)), spine_mix_direction(rawValue: UInt32(direction.rawValue)), appliedPose)
|
||||
}
|
||||
|
||||
public static func rttiStatic() -> Rtti {
|
||||
|
||||
@ -112,8 +112,7 @@ public class AnimationState: NSObject {
|
||||
///
|
||||
/// - Returns: True if any animations were applied.
|
||||
public func apply(_ skeleton: Skeleton) -> Bool {
|
||||
let result = spine_animation_state_apply(
|
||||
_ptr.assumingMemoryBound(to: spine_animation_state_wrapper.self), skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self))
|
||||
let result = spine_animation_state_apply(_ptr.assumingMemoryBound(to: spine_animation_state_wrapper.self), skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self))
|
||||
return result
|
||||
}
|
||||
|
||||
@ -154,8 +153,7 @@ public class AnimationState: NSObject {
|
||||
///
|
||||
/// See Empty animations in the Spine Runtimes Guide.
|
||||
public func setEmptyAnimation(_ trackIndex: Int, _ mixDuration: Float) -> TrackEntry {
|
||||
let result = spine_animation_state_set_empty_animation(
|
||||
_ptr.assumingMemoryBound(to: spine_animation_state_wrapper.self), trackIndex, mixDuration)
|
||||
let result = spine_animation_state_set_empty_animation(_ptr.assumingMemoryBound(to: spine_animation_state_wrapper.self), trackIndex, mixDuration)
|
||||
return TrackEntry(fromPointer: result!)
|
||||
}
|
||||
|
||||
@ -169,8 +167,7 @@ public class AnimationState: NSObject {
|
||||
///
|
||||
/// - Returns: A track entry to allow further customization of animation playback. References to the track entry must not be kept after the AnimationStateListener::dispose(TrackEntry) event occurs.
|
||||
public func addEmptyAnimation(_ trackIndex: Int, _ mixDuration: Float, _ delay: Float) -> TrackEntry {
|
||||
let result = spine_animation_state_add_empty_animation(
|
||||
_ptr.assumingMemoryBound(to: spine_animation_state_wrapper.self), trackIndex, mixDuration, delay)
|
||||
let result = spine_animation_state_add_empty_animation(_ptr.assumingMemoryBound(to: spine_animation_state_wrapper.self), trackIndex, mixDuration, delay)
|
||||
return TrackEntry(fromPointer: result!)
|
||||
}
|
||||
|
||||
@ -189,16 +186,14 @@ public class AnimationState: NSObject {
|
||||
}
|
||||
|
||||
public func disposeTrackEntry(_ entry: TrackEntry?) {
|
||||
spine_animation_state_dispose_track_entry(
|
||||
_ptr.assumingMemoryBound(to: spine_animation_state_wrapper.self), entry?._ptr.assumingMemoryBound(to: spine_track_entry_wrapper.self))
|
||||
spine_animation_state_dispose_track_entry(_ptr.assumingMemoryBound(to: spine_animation_state_wrapper.self), entry?._ptr.assumingMemoryBound(to: spine_track_entry_wrapper.self))
|
||||
}
|
||||
|
||||
/// Sets an animation by name.
|
||||
///
|
||||
/// See setAnimation(int, Animation, bool).
|
||||
public func setAnimation(_ trackIndex: Int, _ animationName: String, _ loop: Bool) -> TrackEntry {
|
||||
let result = spine_animation_state_set_animation_1(
|
||||
_ptr.assumingMemoryBound(to: spine_animation_state_wrapper.self), trackIndex, animationName, loop)
|
||||
let result = spine_animation_state_set_animation_1(_ptr.assumingMemoryBound(to: spine_animation_state_wrapper.self), trackIndex, animationName, loop)
|
||||
return TrackEntry(fromPointer: result!)
|
||||
}
|
||||
|
||||
@ -211,9 +206,7 @@ public class AnimationState: NSObject {
|
||||
///
|
||||
/// - Returns: A track entry to allow further customization of animation playback. References to the track entry must not be kept after AnimationState.Dispose.
|
||||
public func setAnimation2(_ trackIndex: Int, _ animation: Animation, _ loop: Bool) -> TrackEntry {
|
||||
let result = spine_animation_state_set_animation_2(
|
||||
_ptr.assumingMemoryBound(to: spine_animation_state_wrapper.self), trackIndex,
|
||||
animation._ptr.assumingMemoryBound(to: spine_animation_wrapper.self), loop)
|
||||
let result = spine_animation_state_set_animation_2(_ptr.assumingMemoryBound(to: spine_animation_state_wrapper.self), trackIndex, animation._ptr.assumingMemoryBound(to: spine_animation_wrapper.self), loop)
|
||||
return TrackEntry(fromPointer: result!)
|
||||
}
|
||||
|
||||
@ -221,8 +214,7 @@ public class AnimationState: NSObject {
|
||||
///
|
||||
/// See addAnimation(int, Animation, bool, float).
|
||||
public func addAnimation(_ trackIndex: Int, _ animationName: String, _ loop: Bool, _ delay: Float) -> TrackEntry {
|
||||
let result = spine_animation_state_add_animation_1(
|
||||
_ptr.assumingMemoryBound(to: spine_animation_state_wrapper.self), trackIndex, animationName, loop, delay)
|
||||
let result = spine_animation_state_add_animation_1(_ptr.assumingMemoryBound(to: spine_animation_state_wrapper.self), trackIndex, animationName, loop, delay)
|
||||
return TrackEntry(fromPointer: result!)
|
||||
}
|
||||
|
||||
@ -233,9 +225,7 @@ public class AnimationState: NSObject {
|
||||
///
|
||||
/// - Returns: A track entry to allow further customization of animation playback. References to the track entry must not be kept after AnimationState.Dispose
|
||||
public func addAnimation2(_ trackIndex: Int, _ animation: Animation, _ loop: Bool, _ delay: Float) -> TrackEntry {
|
||||
let result = spine_animation_state_add_animation_2(
|
||||
_ptr.assumingMemoryBound(to: spine_animation_state_wrapper.self), trackIndex,
|
||||
animation._ptr.assumingMemoryBound(to: spine_animation_wrapper.self), loop, delay)
|
||||
let result = spine_animation_state_add_animation_2(_ptr.assumingMemoryBound(to: spine_animation_state_wrapper.self), trackIndex, animation._ptr.assumingMemoryBound(to: spine_animation_wrapper.self), loop, delay)
|
||||
return TrackEntry(fromPointer: result!)
|
||||
}
|
||||
|
||||
|
||||
@ -69,9 +69,7 @@ public class AnimationStateData: NSObject {
|
||||
/// The mix duration to use when changing from the specified animation to the other, or the
|
||||
/// DefaultMix if no mix duration has been set.
|
||||
public func getMix(_ from: Animation, _ to: Animation) -> Float {
|
||||
let result = spine_animation_state_data_get_mix(
|
||||
_ptr.assumingMemoryBound(to: spine_animation_state_data_wrapper.self), from._ptr.assumingMemoryBound(to: spine_animation_wrapper.self),
|
||||
to._ptr.assumingMemoryBound(to: spine_animation_wrapper.self))
|
||||
let result = spine_animation_state_data_get_mix(_ptr.assumingMemoryBound(to: spine_animation_state_data_wrapper.self), from._ptr.assumingMemoryBound(to: spine_animation_wrapper.self), to._ptr.assumingMemoryBound(to: spine_animation_wrapper.self))
|
||||
return result
|
||||
}
|
||||
|
||||
@ -88,9 +86,7 @@ public class AnimationStateData: NSObject {
|
||||
/// Sets a mix duration when changing from the specified animation to the other. See
|
||||
/// TrackEntry.MixDuration.
|
||||
public func setMix2(_ from: Animation, _ to: Animation, _ duration: Float) {
|
||||
spine_animation_state_data_set_mix_2(
|
||||
_ptr.assumingMemoryBound(to: spine_animation_state_data_wrapper.self), from._ptr.assumingMemoryBound(to: spine_animation_wrapper.self),
|
||||
to._ptr.assumingMemoryBound(to: spine_animation_wrapper.self), duration)
|
||||
spine_animation_state_data_set_mix_2(_ptr.assumingMemoryBound(to: spine_animation_state_data_wrapper.self), from._ptr.assumingMemoryBound(to: spine_animation_wrapper.self), to._ptr.assumingMemoryBound(to: spine_animation_wrapper.self), duration)
|
||||
}
|
||||
|
||||
public func dispose() {
|
||||
|
||||
@ -52,44 +52,32 @@ public class AtlasAttachmentLoader: NSObject, AttachmentLoader {
|
||||
}
|
||||
|
||||
public func newRegionAttachment(_ skin: Skin, _ name: String, _ path: String, _ sequence: Sequence?) -> RegionAttachment? {
|
||||
let result = spine_atlas_attachment_loader_new_region_attachment(
|
||||
_ptr.assumingMemoryBound(to: spine_atlas_attachment_loader_wrapper.self), skin._ptr.assumingMemoryBound(to: spine_skin_wrapper.self),
|
||||
name, path, sequence?._ptr.assumingMemoryBound(to: spine_sequence_wrapper.self))
|
||||
let result = spine_atlas_attachment_loader_new_region_attachment(_ptr.assumingMemoryBound(to: spine_atlas_attachment_loader_wrapper.self), skin._ptr.assumingMemoryBound(to: spine_skin_wrapper.self), name, path, sequence?._ptr.assumingMemoryBound(to: spine_sequence_wrapper.self))
|
||||
return result.map { RegionAttachment(fromPointer: $0) }
|
||||
}
|
||||
|
||||
public func newMeshAttachment(_ skin: Skin, _ name: String, _ path: String, _ sequence: Sequence?) -> MeshAttachment? {
|
||||
let result = spine_atlas_attachment_loader_new_mesh_attachment(
|
||||
_ptr.assumingMemoryBound(to: spine_atlas_attachment_loader_wrapper.self), skin._ptr.assumingMemoryBound(to: spine_skin_wrapper.self),
|
||||
name, path, sequence?._ptr.assumingMemoryBound(to: spine_sequence_wrapper.self))
|
||||
let result = spine_atlas_attachment_loader_new_mesh_attachment(_ptr.assumingMemoryBound(to: spine_atlas_attachment_loader_wrapper.self), skin._ptr.assumingMemoryBound(to: spine_skin_wrapper.self), name, path, sequence?._ptr.assumingMemoryBound(to: spine_sequence_wrapper.self))
|
||||
return result.map { MeshAttachment(fromPointer: $0) }
|
||||
}
|
||||
|
||||
public func newBoundingBoxAttachment(_ skin: Skin, _ name: String) -> BoundingBoxAttachment? {
|
||||
let result = spine_atlas_attachment_loader_new_bounding_box_attachment(
|
||||
_ptr.assumingMemoryBound(to: spine_atlas_attachment_loader_wrapper.self), skin._ptr.assumingMemoryBound(to: spine_skin_wrapper.self), name
|
||||
)
|
||||
let result = spine_atlas_attachment_loader_new_bounding_box_attachment(_ptr.assumingMemoryBound(to: spine_atlas_attachment_loader_wrapper.self), skin._ptr.assumingMemoryBound(to: spine_skin_wrapper.self), name)
|
||||
return result.map { BoundingBoxAttachment(fromPointer: $0) }
|
||||
}
|
||||
|
||||
public func newPathAttachment(_ skin: Skin, _ name: String) -> PathAttachment? {
|
||||
let result = spine_atlas_attachment_loader_new_path_attachment(
|
||||
_ptr.assumingMemoryBound(to: spine_atlas_attachment_loader_wrapper.self), skin._ptr.assumingMemoryBound(to: spine_skin_wrapper.self), name
|
||||
)
|
||||
let result = spine_atlas_attachment_loader_new_path_attachment(_ptr.assumingMemoryBound(to: spine_atlas_attachment_loader_wrapper.self), skin._ptr.assumingMemoryBound(to: spine_skin_wrapper.self), name)
|
||||
return result.map { PathAttachment(fromPointer: $0) }
|
||||
}
|
||||
|
||||
public func newPointAttachment(_ skin: Skin, _ name: String) -> PointAttachment? {
|
||||
let result = spine_atlas_attachment_loader_new_point_attachment(
|
||||
_ptr.assumingMemoryBound(to: spine_atlas_attachment_loader_wrapper.self), skin._ptr.assumingMemoryBound(to: spine_skin_wrapper.self), name
|
||||
)
|
||||
let result = spine_atlas_attachment_loader_new_point_attachment(_ptr.assumingMemoryBound(to: spine_atlas_attachment_loader_wrapper.self), skin._ptr.assumingMemoryBound(to: spine_skin_wrapper.self), name)
|
||||
return result.map { PointAttachment(fromPointer: $0) }
|
||||
}
|
||||
|
||||
public func newClippingAttachment(_ skin: Skin, _ name: String) -> ClippingAttachment? {
|
||||
let result = spine_atlas_attachment_loader_new_clipping_attachment(
|
||||
_ptr.assumingMemoryBound(to: spine_atlas_attachment_loader_wrapper.self), skin._ptr.assumingMemoryBound(to: spine_skin_wrapper.self), name
|
||||
)
|
||||
let result = spine_atlas_attachment_loader_new_clipping_attachment(_ptr.assumingMemoryBound(to: spine_atlas_attachment_loader_wrapper.self), skin._ptr.assumingMemoryBound(to: spine_skin_wrapper.self), name)
|
||||
return result.map { ClippingAttachment(fromPointer: $0) }
|
||||
}
|
||||
|
||||
|
||||
@ -74,8 +74,7 @@ public class AtlasPage: NSObject {
|
||||
return Format(rawValue: Int32(result.rawValue))!
|
||||
}
|
||||
set {
|
||||
spine_atlas_page_set_format(
|
||||
_ptr.assumingMemoryBound(to: spine_atlas_page_wrapper.self), spine_format(rawValue: UInt32(newValue.rawValue)))
|
||||
spine_atlas_page_set_format(_ptr.assumingMemoryBound(to: spine_atlas_page_wrapper.self), spine_format(rawValue: UInt32(newValue.rawValue)))
|
||||
}
|
||||
}
|
||||
|
||||
@ -85,8 +84,7 @@ public class AtlasPage: NSObject {
|
||||
return TextureFilter(rawValue: Int32(result.rawValue))!
|
||||
}
|
||||
set {
|
||||
spine_atlas_page_set_min_filter(
|
||||
_ptr.assumingMemoryBound(to: spine_atlas_page_wrapper.self), spine_texture_filter(rawValue: UInt32(newValue.rawValue)))
|
||||
spine_atlas_page_set_min_filter(_ptr.assumingMemoryBound(to: spine_atlas_page_wrapper.self), spine_texture_filter(rawValue: UInt32(newValue.rawValue)))
|
||||
}
|
||||
}
|
||||
|
||||
@ -96,8 +94,7 @@ public class AtlasPage: NSObject {
|
||||
return TextureFilter(rawValue: Int32(result.rawValue))!
|
||||
}
|
||||
set {
|
||||
spine_atlas_page_set_mag_filter(
|
||||
_ptr.assumingMemoryBound(to: spine_atlas_page_wrapper.self), spine_texture_filter(rawValue: UInt32(newValue.rawValue)))
|
||||
spine_atlas_page_set_mag_filter(_ptr.assumingMemoryBound(to: spine_atlas_page_wrapper.self), spine_texture_filter(rawValue: UInt32(newValue.rawValue)))
|
||||
}
|
||||
}
|
||||
|
||||
@ -107,8 +104,7 @@ public class AtlasPage: NSObject {
|
||||
return TextureWrap(rawValue: Int32(result.rawValue))!
|
||||
}
|
||||
set {
|
||||
spine_atlas_page_set_u_wrap(
|
||||
_ptr.assumingMemoryBound(to: spine_atlas_page_wrapper.self), spine_texture_wrap(rawValue: UInt32(newValue.rawValue)))
|
||||
spine_atlas_page_set_u_wrap(_ptr.assumingMemoryBound(to: spine_atlas_page_wrapper.self), spine_texture_wrap(rawValue: UInt32(newValue.rawValue)))
|
||||
}
|
||||
}
|
||||
|
||||
@ -118,8 +114,7 @@ public class AtlasPage: NSObject {
|
||||
return TextureWrap(rawValue: Int32(result.rawValue))!
|
||||
}
|
||||
set {
|
||||
spine_atlas_page_set_v_wrap(
|
||||
_ptr.assumingMemoryBound(to: spine_atlas_page_wrapper.self), spine_texture_wrap(rawValue: UInt32(newValue.rawValue)))
|
||||
spine_atlas_page_set_v_wrap(_ptr.assumingMemoryBound(to: spine_atlas_page_wrapper.self), spine_texture_wrap(rawValue: UInt32(newValue.rawValue)))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -52,8 +52,7 @@ public class AtlasRegion: TextureRegion {
|
||||
return result.map { AtlasPage(fromPointer: $0) }
|
||||
}
|
||||
set {
|
||||
spine_atlas_region_set_page(
|
||||
_ptr.assumingMemoryBound(to: spine_atlas_region_wrapper.self), newValue?._ptr.assumingMemoryBound(to: spine_atlas_page_wrapper.self))
|
||||
spine_atlas_region_set_page(_ptr.assumingMemoryBound(to: spine_atlas_region_wrapper.self), newValue?._ptr.assumingMemoryBound(to: spine_atlas_page_wrapper.self))
|
||||
}
|
||||
}
|
||||
|
||||
@ -183,8 +182,7 @@ public class AtlasRegion: TextureRegion {
|
||||
return ArrayInt(fromPointer: result!)
|
||||
}
|
||||
set {
|
||||
spine_atlas_region_set_splits(
|
||||
_ptr.assumingMemoryBound(to: spine_atlas_region_wrapper.self), newValue._ptr.assumingMemoryBound(to: spine_array_int_wrapper.self))
|
||||
spine_atlas_region_set_splits(_ptr.assumingMemoryBound(to: spine_atlas_region_wrapper.self), newValue._ptr.assumingMemoryBound(to: spine_array_int_wrapper.self))
|
||||
}
|
||||
}
|
||||
|
||||
@ -194,8 +192,7 @@ public class AtlasRegion: TextureRegion {
|
||||
return ArrayInt(fromPointer: result!)
|
||||
}
|
||||
set {
|
||||
spine_atlas_region_set_pads(
|
||||
_ptr.assumingMemoryBound(to: spine_atlas_region_wrapper.self), newValue._ptr.assumingMemoryBound(to: spine_array_int_wrapper.self))
|
||||
spine_atlas_region_set_pads(_ptr.assumingMemoryBound(to: spine_atlas_region_wrapper.self), newValue._ptr.assumingMemoryBound(to: spine_array_int_wrapper.self))
|
||||
}
|
||||
}
|
||||
|
||||
@ -205,8 +202,7 @@ public class AtlasRegion: TextureRegion {
|
||||
return ArrayFloat(fromPointer: result!)
|
||||
}
|
||||
set {
|
||||
spine_atlas_region_set_values(
|
||||
_ptr.assumingMemoryBound(to: spine_atlas_region_wrapper.self), newValue._ptr.assumingMemoryBound(to: spine_array_float_wrapper.self))
|
||||
spine_atlas_region_set_values(_ptr.assumingMemoryBound(to: spine_atlas_region_wrapper.self), newValue._ptr.assumingMemoryBound(to: spine_array_float_wrapper.self))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -132,8 +132,7 @@ public class BoneLocal: NSObject {
|
||||
return Inherit(rawValue: Int32(result.rawValue))!
|
||||
}
|
||||
set {
|
||||
spine_bone_local_set_inherit(
|
||||
_ptr.assumingMemoryBound(to: spine_bone_local_wrapper.self), spine_inherit(rawValue: UInt32(newValue.rawValue)))
|
||||
spine_bone_local_set_inherit(_ptr.assumingMemoryBound(to: spine_bone_local_wrapper.self), spine_inherit(rawValue: UInt32(newValue.rawValue)))
|
||||
}
|
||||
}
|
||||
|
||||
@ -145,8 +144,7 @@ public class BoneLocal: NSObject {
|
||||
}
|
||||
|
||||
public func set(_ pose: BoneLocal) {
|
||||
spine_bone_local_set(
|
||||
_ptr.assumingMemoryBound(to: spine_bone_local_wrapper.self), pose._ptr.assumingMemoryBound(to: spine_bone_local_wrapper.self))
|
||||
spine_bone_local_set(_ptr.assumingMemoryBound(to: spine_bone_local_wrapper.self), pose._ptr.assumingMemoryBound(to: spine_bone_local_wrapper.self))
|
||||
}
|
||||
|
||||
public func setPosition(_ x: Float, _ y: Float) {
|
||||
|
||||
@ -148,9 +148,7 @@ public class BonePose: BoneLocal, Update {
|
||||
|
||||
/// Called by Skeleton::updateCache() to compute the world transform, if needed.
|
||||
public func update(_ skeleton: Skeleton, _ physics: Physics) {
|
||||
spine_bone_pose_update(
|
||||
_ptr.assumingMemoryBound(to: spine_bone_pose_wrapper.self), skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self),
|
||||
spine_physics(rawValue: UInt32(physics.rawValue)))
|
||||
spine_bone_pose_update(_ptr.assumingMemoryBound(to: spine_bone_pose_wrapper.self), skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self), spine_physics(rawValue: UInt32(physics.rawValue)))
|
||||
}
|
||||
|
||||
/// Computes the world transform using the parent bone's applied pose and this pose. Child bones
|
||||
@ -158,8 +156,7 @@ public class BonePose: BoneLocal, Update {
|
||||
///
|
||||
/// See World transforms in the Spine Runtimes Guide.
|
||||
public func updateWorldTransform(_ skeleton: Skeleton) {
|
||||
spine_bone_pose_update_world_transform(
|
||||
_ptr.assumingMemoryBound(to: spine_bone_pose_wrapper.self), skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self))
|
||||
spine_bone_pose_update_world_transform(_ptr.assumingMemoryBound(to: spine_bone_pose_wrapper.self), skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self))
|
||||
}
|
||||
|
||||
/// Computes the local transform values from the world transform.
|
||||
@ -172,20 +169,17 @@ public class BonePose: BoneLocal, Update {
|
||||
/// rotation. The local transform after calling this method is equivalent to the local transform
|
||||
/// used to compute the world transform, but may not be identical.
|
||||
public func updateLocalTransform(_ skeleton: Skeleton) {
|
||||
spine_bone_pose_update_local_transform(
|
||||
_ptr.assumingMemoryBound(to: spine_bone_pose_wrapper.self), skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self))
|
||||
spine_bone_pose_update_local_transform(_ptr.assumingMemoryBound(to: spine_bone_pose_wrapper.self), skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self))
|
||||
}
|
||||
|
||||
/// If the world transform has been modified and the local transform no longer matches,
|
||||
/// updateLocalTransform() is called.
|
||||
public func validateLocalTransform(_ skeleton: Skeleton) {
|
||||
spine_bone_pose_validate_local_transform(
|
||||
_ptr.assumingMemoryBound(to: spine_bone_pose_wrapper.self), skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self))
|
||||
spine_bone_pose_validate_local_transform(_ptr.assumingMemoryBound(to: spine_bone_pose_wrapper.self), skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self))
|
||||
}
|
||||
|
||||
public func modifyLocal(_ skeleton: Skeleton) {
|
||||
spine_bone_pose_modify_local(
|
||||
_ptr.assumingMemoryBound(to: spine_bone_pose_wrapper.self), skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self))
|
||||
spine_bone_pose_modify_local(_ptr.assumingMemoryBound(to: spine_bone_pose_wrapper.self), skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self))
|
||||
}
|
||||
|
||||
public func modifyWorld(_ update: Int32) {
|
||||
|
||||
@ -52,9 +52,7 @@ public class ClippingAttachment: VertexAttachment {
|
||||
return result.map { SlotData(fromPointer: $0) }
|
||||
}
|
||||
set {
|
||||
spine_clipping_attachment_set_end_slot(
|
||||
_ptr.assumingMemoryBound(to: spine_clipping_attachment_wrapper.self),
|
||||
newValue?._ptr.assumingMemoryBound(to: spine_slot_data_wrapper.self))
|
||||
spine_clipping_attachment_set_end_slot(_ptr.assumingMemoryBound(to: spine_clipping_attachment_wrapper.self), newValue?._ptr.assumingMemoryBound(to: spine_slot_data_wrapper.self))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -60,17 +60,12 @@ open class CurveTimeline: Timeline {
|
||||
return ArrayFloat(fromPointer: result!)
|
||||
}
|
||||
|
||||
public func setBezier(
|
||||
_ bezier: Int, _ frame: Int, _ value: Float, _ time1: Float, _ value1: Float, _ cx1: Float, _ cy1: Float, _ cx2: Float, _ cy2: Float,
|
||||
_ time2: Float, _ value2: Float
|
||||
) {
|
||||
spine_curve_timeline_set_bezier(
|
||||
_ptr.assumingMemoryBound(to: spine_curve_timeline_wrapper.self), bezier, frame, value, time1, value1, cx1, cy1, cx2, cy2, time2, value2)
|
||||
public func setBezier(_ bezier: Int, _ frame: Int, _ value: Float, _ time1: Float, _ value1: Float, _ cx1: Float, _ cy1: Float, _ cx2: Float, _ cy2: Float, _ time2: Float, _ value2: Float) {
|
||||
spine_curve_timeline_set_bezier(_ptr.assumingMemoryBound(to: spine_curve_timeline_wrapper.self), bezier, frame, value, time1, value1, cx1, cy1, cx2, cy2, time2, value2)
|
||||
}
|
||||
|
||||
public func getBezierValue(_ time: Float, _ frame: Int, _ valueOffset: Int, _ i: Int) -> Float {
|
||||
let result = spine_curve_timeline_get_bezier_value(
|
||||
_ptr.assumingMemoryBound(to: spine_curve_timeline_wrapper.self), time, frame, valueOffset, i)
|
||||
let result = spine_curve_timeline_get_bezier_value(_ptr.assumingMemoryBound(to: spine_curve_timeline_wrapper.self), time, frame, valueOffset, i)
|
||||
return result
|
||||
}
|
||||
|
||||
|
||||
@ -56,31 +56,22 @@ open class CurveTimeline1: CurveTimeline {
|
||||
}
|
||||
|
||||
public func getRelativeValue(_ time: Float, _ alpha: Float, _ blend: MixBlend, _ current: Float, _ setup: Float) -> Float {
|
||||
let result = spine_curve_timeline1_get_relative_value(
|
||||
_ptr.assumingMemoryBound(to: spine_curve_timeline1_wrapper.self), time, alpha, spine_mix_blend(rawValue: UInt32(blend.rawValue)), current,
|
||||
setup)
|
||||
let result = spine_curve_timeline1_get_relative_value(_ptr.assumingMemoryBound(to: spine_curve_timeline1_wrapper.self), time, alpha, spine_mix_blend(rawValue: UInt32(blend.rawValue)), current, setup)
|
||||
return result
|
||||
}
|
||||
|
||||
public func getScaleValue(_ time: Float, _ alpha: Float, _ blend: MixBlend, _ direction: MixDirection, _ current: Float, _ setup: Float) -> Float
|
||||
{
|
||||
let result = spine_curve_timeline1_get_scale_value(
|
||||
_ptr.assumingMemoryBound(to: spine_curve_timeline1_wrapper.self), time, alpha, spine_mix_blend(rawValue: UInt32(blend.rawValue)),
|
||||
spine_mix_direction(rawValue: UInt32(direction.rawValue)), current, setup)
|
||||
public func getScaleValue(_ time: Float, _ alpha: Float, _ blend: MixBlend, _ direction: MixDirection, _ current: Float, _ setup: Float) -> Float {
|
||||
let result = spine_curve_timeline1_get_scale_value(_ptr.assumingMemoryBound(to: spine_curve_timeline1_wrapper.self), time, alpha, spine_mix_blend(rawValue: UInt32(blend.rawValue)), spine_mix_direction(rawValue: UInt32(direction.rawValue)), current, setup)
|
||||
return result
|
||||
}
|
||||
|
||||
public func getAbsoluteValue(_ time: Float, _ alpha: Float, _ blend: MixBlend, _ current: Float, _ setup: Float) -> Float {
|
||||
let result = spine_curve_timeline1_get_absolute_value_1(
|
||||
_ptr.assumingMemoryBound(to: spine_curve_timeline1_wrapper.self), time, alpha, spine_mix_blend(rawValue: UInt32(blend.rawValue)), current,
|
||||
setup)
|
||||
let result = spine_curve_timeline1_get_absolute_value_1(_ptr.assumingMemoryBound(to: spine_curve_timeline1_wrapper.self), time, alpha, spine_mix_blend(rawValue: UInt32(blend.rawValue)), current, setup)
|
||||
return result
|
||||
}
|
||||
|
||||
public func getAbsoluteValue2(_ time: Float, _ alpha: Float, _ blend: MixBlend, _ current: Float, _ setup: Float, _ value: Float) -> Float {
|
||||
let result = spine_curve_timeline1_get_absolute_value_2(
|
||||
_ptr.assumingMemoryBound(to: spine_curve_timeline1_wrapper.self), time, alpha, spine_mix_blend(rawValue: UInt32(blend.rawValue)), current,
|
||||
setup, value)
|
||||
let result = spine_curve_timeline1_get_absolute_value_2(_ptr.assumingMemoryBound(to: spine_curve_timeline1_wrapper.self), time, alpha, spine_mix_blend(rawValue: UInt32(blend.rawValue)), current, setup, value)
|
||||
return result
|
||||
}
|
||||
|
||||
|
||||
@ -42,8 +42,7 @@ public class DeformTimeline: SlotCurveTimeline {
|
||||
}
|
||||
|
||||
public convenience init(_ frameCount: Int, _ bezierCount: Int, _ slotIndex: Int32, _ attachment: VertexAttachment) {
|
||||
let ptr = spine_deform_timeline_create(
|
||||
frameCount, bezierCount, slotIndex, attachment._ptr.assumingMemoryBound(to: spine_vertex_attachment_wrapper.self))
|
||||
let ptr = spine_deform_timeline_create(frameCount, bezierCount, slotIndex, attachment._ptr.assumingMemoryBound(to: spine_vertex_attachment_wrapper.self))
|
||||
self.init(fromPointer: ptr!)
|
||||
}
|
||||
|
||||
@ -71,17 +70,13 @@ public class DeformTimeline: SlotCurveTimeline {
|
||||
}
|
||||
}
|
||||
set {
|
||||
spine_deform_timeline_set_attachment(
|
||||
_ptr.assumingMemoryBound(to: spine_deform_timeline_wrapper.self),
|
||||
newValue._ptr.assumingMemoryBound(to: spine_vertex_attachment_wrapper.self))
|
||||
spine_deform_timeline_set_attachment(_ptr.assumingMemoryBound(to: spine_deform_timeline_wrapper.self), newValue._ptr.assumingMemoryBound(to: spine_vertex_attachment_wrapper.self))
|
||||
}
|
||||
}
|
||||
|
||||
/// Sets the time and vertices for the specified frame.
|
||||
public func setFrame(_ frameIndex: Int32, _ time: Float, _ vertices: ArrayFloat) {
|
||||
spine_deform_timeline_set_frame(
|
||||
_ptr.assumingMemoryBound(to: spine_deform_timeline_wrapper.self), frameIndex, time,
|
||||
vertices._ptr.assumingMemoryBound(to: spine_array_float_wrapper.self))
|
||||
spine_deform_timeline_set_frame(_ptr.assumingMemoryBound(to: spine_deform_timeline_wrapper.self), frameIndex, time, vertices._ptr.assumingMemoryBound(to: spine_array_float_wrapper.self))
|
||||
}
|
||||
|
||||
public func getCurvePercent(_ time: Float, _ frame: Int32) -> Float {
|
||||
|
||||
@ -52,9 +52,7 @@ public class DrawOrderTimeline: Timeline {
|
||||
/// - Parameter time: The frame time in seconds.
|
||||
/// - Parameter drawOrder: For each slot in Skeleton::slots, the index of the slot in the new draw order. May be null to use setup pose draw order.
|
||||
public func setFrame(_ frame: Int, _ time: Float, _ drawOrder: ArrayInt?) {
|
||||
spine_draw_order_timeline_set_frame(
|
||||
_ptr.assumingMemoryBound(to: spine_draw_order_timeline_wrapper.self), frame, time,
|
||||
drawOrder?._ptr.assumingMemoryBound(to: spine_array_int_wrapper.self))
|
||||
spine_draw_order_timeline_set_frame(_ptr.assumingMemoryBound(to: spine_draw_order_timeline_wrapper.self), frame, time, drawOrder?._ptr.assumingMemoryBound(to: spine_array_int_wrapper.self))
|
||||
}
|
||||
|
||||
public func dispose() {
|
||||
|
||||
@ -44,9 +44,7 @@ public class EventQueueEntry: NSObject {
|
||||
}
|
||||
|
||||
public convenience init(_ eventType: EventType, _ trackEntry: TrackEntry?, _ event: Event?) {
|
||||
let ptr = spine_event_queue_entry_create(
|
||||
spine_event_type(rawValue: UInt32(eventType.rawValue)), trackEntry?._ptr.assumingMemoryBound(to: spine_track_entry_wrapper.self),
|
||||
event?._ptr.assumingMemoryBound(to: spine_event_wrapper.self))
|
||||
let ptr = spine_event_queue_entry_create(spine_event_type(rawValue: UInt32(eventType.rawValue)), trackEntry?._ptr.assumingMemoryBound(to: spine_track_entry_wrapper.self), event?._ptr.assumingMemoryBound(to: spine_event_wrapper.self))
|
||||
self.init(fromPointer: ptr!)
|
||||
}
|
||||
|
||||
@ -56,8 +54,7 @@ public class EventQueueEntry: NSObject {
|
||||
return EventType(rawValue: Int32(result.rawValue))!
|
||||
}
|
||||
set {
|
||||
spine_event_queue_entry_set__type(
|
||||
_ptr.assumingMemoryBound(to: spine_event_queue_entry_wrapper.self), spine_event_type(rawValue: UInt32(newValue.rawValue)))
|
||||
spine_event_queue_entry_set__type(_ptr.assumingMemoryBound(to: spine_event_queue_entry_wrapper.self), spine_event_type(rawValue: UInt32(newValue.rawValue)))
|
||||
}
|
||||
}
|
||||
|
||||
@ -67,9 +64,7 @@ public class EventQueueEntry: NSObject {
|
||||
return result.map { TrackEntry(fromPointer: $0) }
|
||||
}
|
||||
set {
|
||||
spine_event_queue_entry_set__entry(
|
||||
_ptr.assumingMemoryBound(to: spine_event_queue_entry_wrapper.self),
|
||||
newValue?._ptr.assumingMemoryBound(to: spine_track_entry_wrapper.self))
|
||||
spine_event_queue_entry_set__entry(_ptr.assumingMemoryBound(to: spine_event_queue_entry_wrapper.self), newValue?._ptr.assumingMemoryBound(to: spine_track_entry_wrapper.self))
|
||||
}
|
||||
}
|
||||
|
||||
@ -79,8 +74,7 @@ public class EventQueueEntry: NSObject {
|
||||
return result.map { Event(fromPointer: $0) }
|
||||
}
|
||||
set {
|
||||
spine_event_queue_entry_set__event(
|
||||
_ptr.assumingMemoryBound(to: spine_event_queue_entry_wrapper.self), newValue?._ptr.assumingMemoryBound(to: spine_event_wrapper.self))
|
||||
spine_event_queue_entry_set__event(_ptr.assumingMemoryBound(to: spine_event_queue_entry_wrapper.self), newValue?._ptr.assumingMemoryBound(to: spine_event_wrapper.self))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -56,8 +56,7 @@ public class EventTimeline: Timeline {
|
||||
///
|
||||
/// - Parameter frame: Between 0 and frameCount, inclusive.
|
||||
public func setFrame(_ frame: Int, _ event: Event) {
|
||||
spine_event_timeline_set_frame(
|
||||
_ptr.assumingMemoryBound(to: spine_event_timeline_wrapper.self), frame, event._ptr.assumingMemoryBound(to: spine_event_wrapper.self))
|
||||
spine_event_timeline_set_frame(_ptr.assumingMemoryBound(to: spine_event_timeline_wrapper.self), frame, event._ptr.assumingMemoryBound(to: spine_event_wrapper.self))
|
||||
}
|
||||
|
||||
public func dispose() {
|
||||
|
||||
@ -64,9 +64,7 @@ open class FromProperty: NSObject {
|
||||
return result.map { ArrayToProperty(fromPointer: $0) }
|
||||
}
|
||||
set {
|
||||
spine_from_property_set__to(
|
||||
_ptr.assumingMemoryBound(to: spine_from_property_wrapper.self),
|
||||
newValue?._ptr.assumingMemoryBound(to: spine_array_to_property_wrapper.self))
|
||||
spine_from_property_set__to(_ptr.assumingMemoryBound(to: spine_from_property_wrapper.self), newValue?._ptr.assumingMemoryBound(to: spine_array_to_property_wrapper.self))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -42,9 +42,7 @@ public class IkConstraint: IkConstraintBase {
|
||||
}
|
||||
|
||||
public convenience init(_ data: IkConstraintData, _ skeleton: Skeleton) {
|
||||
let ptr = spine_ik_constraint_create(
|
||||
data._ptr.assumingMemoryBound(to: spine_ik_constraint_data_wrapper.self),
|
||||
skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self))
|
||||
let ptr = spine_ik_constraint_create(data._ptr.assumingMemoryBound(to: spine_ik_constraint_data_wrapper.self), skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self))
|
||||
self.init(fromPointer: ptr!)
|
||||
}
|
||||
|
||||
@ -59,38 +57,27 @@ public class IkConstraint: IkConstraintBase {
|
||||
return Bone(fromPointer: result!)
|
||||
}
|
||||
set {
|
||||
spine_ik_constraint_set_target(
|
||||
_ptr.assumingMemoryBound(to: spine_ik_constraint_wrapper.self), newValue._ptr.assumingMemoryBound(to: spine_bone_wrapper.self))
|
||||
spine_ik_constraint_set_target(_ptr.assumingMemoryBound(to: spine_ik_constraint_wrapper.self), newValue._ptr.assumingMemoryBound(to: spine_bone_wrapper.self))
|
||||
}
|
||||
}
|
||||
|
||||
public func copyAttachment(_ skeleton: Skeleton) -> IkConstraint {
|
||||
let result = spine_ik_constraint_copy(
|
||||
_ptr.assumingMemoryBound(to: spine_ik_constraint_wrapper.self), skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self))
|
||||
let result = spine_ik_constraint_copy(_ptr.assumingMemoryBound(to: spine_ik_constraint_wrapper.self), skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self))
|
||||
return IkConstraint(fromPointer: result!)
|
||||
}
|
||||
|
||||
/// Adjusts the bone rotation so the tip is as close to the target position as possible. The
|
||||
/// target is specified in the world coordinate system.
|
||||
public static func apply(
|
||||
_ skeleton: Skeleton, _ bone: BonePose, _ targetX: Float, _ targetY: Float, _ compress: Bool, _ stretch: Bool, _ uniform: Bool, _ mix: Float
|
||||
) {
|
||||
spine_ik_constraint_apply_1(
|
||||
skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self), bone._ptr.assumingMemoryBound(to: spine_bone_pose_wrapper.self),
|
||||
targetX, targetY, compress, stretch, uniform, mix)
|
||||
public static func apply(_ skeleton: Skeleton, _ bone: BonePose, _ targetX: Float, _ targetY: Float, _ compress: Bool, _ stretch: Bool, _ uniform: Bool, _ mix: Float) {
|
||||
spine_ik_constraint_apply_1(skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self), bone._ptr.assumingMemoryBound(to: spine_bone_pose_wrapper.self), targetX, targetY, compress, stretch, uniform, mix)
|
||||
}
|
||||
|
||||
/// Adjusts the parent and child bone rotations so the tip of the child is as close to the
|
||||
/// target position as possible. The target is specified in the world coordinate system.
|
||||
///
|
||||
/// - Parameter child: A direct descendant of the parent bone.
|
||||
public static func apply2(
|
||||
_ skeleton: Skeleton, _ parent: BonePose, _ child: BonePose, _ targetX: Float, _ targetY: Float, _ bendDirection: Int32, _ stretch: Bool,
|
||||
_ uniform: Bool, _ softness: Float, _ mix: Float
|
||||
) {
|
||||
spine_ik_constraint_apply_2(
|
||||
skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self), parent._ptr.assumingMemoryBound(to: spine_bone_pose_wrapper.self),
|
||||
child._ptr.assumingMemoryBound(to: spine_bone_pose_wrapper.self), targetX, targetY, bendDirection, stretch, uniform, softness, mix)
|
||||
public static func apply2(_ skeleton: Skeleton, _ parent: BonePose, _ child: BonePose, _ targetX: Float, _ targetY: Float, _ bendDirection: Int32, _ stretch: Bool, _ uniform: Bool, _ softness: Float, _ mix: Float) {
|
||||
spine_ik_constraint_apply_2(skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self), parent._ptr.assumingMemoryBound(to: spine_bone_pose_wrapper.self), child._ptr.assumingMemoryBound(to: spine_bone_pose_wrapper.self), targetX, targetY, bendDirection, stretch, uniform, softness, mix)
|
||||
}
|
||||
|
||||
public override func dispose() {
|
||||
|
||||
@ -80,15 +80,12 @@ open class IkConstraintBase: PosedActive, Posed, Constraint {
|
||||
}
|
||||
|
||||
public func sort(_ skeleton: Skeleton) {
|
||||
spine_ik_constraint_base_sort(
|
||||
_ptr.assumingMemoryBound(to: spine_ik_constraint_base_wrapper.self), skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self))
|
||||
spine_ik_constraint_base_sort(_ptr.assumingMemoryBound(to: spine_ik_constraint_base_wrapper.self), skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self))
|
||||
}
|
||||
|
||||
/// Inherited from Update
|
||||
public func update(_ skeleton: Skeleton, _ physics: Physics) {
|
||||
spine_ik_constraint_base_update(
|
||||
_ptr.assumingMemoryBound(to: spine_ik_constraint_base_wrapper.self), skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self),
|
||||
spine_physics(rawValue: UInt32(physics.rawValue)))
|
||||
spine_ik_constraint_base_update(_ptr.assumingMemoryBound(to: spine_ik_constraint_base_wrapper.self), skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self), spine_physics(rawValue: UInt32(physics.rawValue)))
|
||||
}
|
||||
|
||||
public static func rttiStatic() -> Rtti {
|
||||
|
||||
@ -64,9 +64,7 @@ public class IkConstraintData: PosedData, ConstraintData {
|
||||
return BoneData(fromPointer: result!)
|
||||
}
|
||||
set {
|
||||
spine_ik_constraint_data_set_target(
|
||||
_ptr.assumingMemoryBound(to: spine_ik_constraint_data_wrapper.self),
|
||||
newValue._ptr.assumingMemoryBound(to: spine_bone_data_wrapper.self))
|
||||
spine_ik_constraint_data_set_target(_ptr.assumingMemoryBound(to: spine_ik_constraint_data_wrapper.self), newValue._ptr.assumingMemoryBound(to: spine_bone_data_wrapper.self))
|
||||
}
|
||||
}
|
||||
|
||||
@ -88,8 +86,7 @@ public class IkConstraintData: PosedData, ConstraintData {
|
||||
}
|
||||
|
||||
public func createMethod(_ skeleton: Skeleton) -> Constraint {
|
||||
let result = spine_ik_constraint_data_create_method(
|
||||
_ptr.assumingMemoryBound(to: spine_ik_constraint_data_wrapper.self), skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self))
|
||||
let result = spine_ik_constraint_data_create_method(_ptr.assumingMemoryBound(to: spine_ik_constraint_data_wrapper.self), skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self))
|
||||
let rtti = spine_constraint_get_rtti(result!)
|
||||
let rttiClassName = String(cString: spine_rtti_get_class_name(rtti)!)
|
||||
switch rttiClassName {
|
||||
|
||||
@ -113,9 +113,7 @@ public class IkConstraintPose: NSObject {
|
||||
}
|
||||
|
||||
public func set(_ pose: IkConstraintPose) {
|
||||
spine_ik_constraint_pose_set(
|
||||
_ptr.assumingMemoryBound(to: spine_ik_constraint_pose_wrapper.self),
|
||||
pose._ptr.assumingMemoryBound(to: spine_ik_constraint_pose_wrapper.self))
|
||||
spine_ik_constraint_pose_set(_ptr.assumingMemoryBound(to: spine_ik_constraint_pose_wrapper.self), pose._ptr.assumingMemoryBound(to: spine_ik_constraint_pose_wrapper.self))
|
||||
}
|
||||
|
||||
public func dispose() {
|
||||
|
||||
@ -64,8 +64,7 @@ public class IkConstraintTimeline: CurveTimeline, ConstraintTimeline {
|
||||
/// - Parameter time: The frame time in seconds.
|
||||
/// - Parameter bendDirection: 1 or -1.
|
||||
public func setFrame(_ frame: Int32, _ time: Float, _ mix: Float, _ softness: Float, _ bendDirection: Int32, _ compress: Bool, _ stretch: Bool) {
|
||||
spine_ik_constraint_timeline_set_frame(
|
||||
_ptr.assumingMemoryBound(to: spine_ik_constraint_timeline_wrapper.self), frame, time, mix, softness, bendDirection, compress, stretch)
|
||||
spine_ik_constraint_timeline_set_frame(_ptr.assumingMemoryBound(to: spine_ik_constraint_timeline_wrapper.self), frame, time, mix, softness, bendDirection, compress, stretch)
|
||||
}
|
||||
|
||||
public func dispose() {
|
||||
|
||||
@ -61,8 +61,7 @@ public class InheritTimeline: Timeline, BoneTimeline {
|
||||
/// - Parameter frame: Between 0 and frameCount, inclusive.
|
||||
/// - Parameter time: The frame time in seconds.
|
||||
public func setFrame(_ frame: Int32, _ time: Float, _ inherit: Inherit) {
|
||||
spine_inherit_timeline_set_frame(
|
||||
_ptr.assumingMemoryBound(to: spine_inherit_timeline_wrapper.self), frame, time, spine_inherit(rawValue: UInt32(inherit.rawValue)))
|
||||
spine_inherit_timeline_set_frame(_ptr.assumingMemoryBound(to: spine_inherit_timeline_wrapper.self), frame, time, spine_inherit(rawValue: UInt32(inherit.rawValue)))
|
||||
}
|
||||
|
||||
public func dispose() {
|
||||
|
||||
@ -41,11 +41,31 @@ public class MeshAttachment: VertexAttachment {
|
||||
super.init(fromPointer: UnsafeMutableRawPointer(ptr).assumingMemoryBound(to: spine_vertex_attachment_wrapper.self))
|
||||
}
|
||||
|
||||
public convenience init(_ name: String) {
|
||||
let ptr = spine_mesh_attachment_create(name)
|
||||
public convenience init(_ name: String, _ sequence: Sequence?) {
|
||||
let ptr = spine_mesh_attachment_create(name, sequence?._ptr.assumingMemoryBound(to: spine_sequence_wrapper.self))
|
||||
self.init(fromPointer: ptr!)
|
||||
}
|
||||
|
||||
public var regionUVs: ArrayFloat {
|
||||
get {
|
||||
let result = spine_mesh_attachment_get_region_u_vs(_ptr.assumingMemoryBound(to: spine_mesh_attachment_wrapper.self))
|
||||
return ArrayFloat(fromPointer: result!)
|
||||
}
|
||||
set {
|
||||
spine_mesh_attachment_set_region_u_vs(_ptr.assumingMemoryBound(to: spine_mesh_attachment_wrapper.self), newValue._ptr.assumingMemoryBound(to: spine_array_float_wrapper.self))
|
||||
}
|
||||
}
|
||||
|
||||
public var triangles: ArrayUnsignedShort {
|
||||
get {
|
||||
let result = spine_mesh_attachment_get_triangles(_ptr.assumingMemoryBound(to: spine_mesh_attachment_wrapper.self))
|
||||
return ArrayUnsignedShort(fromPointer: result!)
|
||||
}
|
||||
set {
|
||||
spine_mesh_attachment_set_triangles(_ptr.assumingMemoryBound(to: spine_mesh_attachment_wrapper.self), newValue._ptr.assumingMemoryBound(to: spine_array_unsigned_short_wrapper.self))
|
||||
}
|
||||
}
|
||||
|
||||
public var hullLength: Int32 {
|
||||
get {
|
||||
let result = spine_mesh_attachment_get_hull_length(_ptr.assumingMemoryBound(to: spine_mesh_attachment_wrapper.self))
|
||||
@ -56,40 +76,9 @@ public class MeshAttachment: VertexAttachment {
|
||||
}
|
||||
}
|
||||
|
||||
public var regionUVs: ArrayFloat {
|
||||
get {
|
||||
let result = spine_mesh_attachment_get_region_u_vs(_ptr.assumingMemoryBound(to: spine_mesh_attachment_wrapper.self))
|
||||
return ArrayFloat(fromPointer: result!)
|
||||
}
|
||||
set {
|
||||
spine_mesh_attachment_set_region_u_vs(
|
||||
_ptr.assumingMemoryBound(to: spine_mesh_attachment_wrapper.self),
|
||||
newValue._ptr.assumingMemoryBound(to: spine_array_float_wrapper.self))
|
||||
}
|
||||
}
|
||||
|
||||
/// The UV pair for each vertex, normalized within the entire texture. See also
|
||||
/// MeshAttachment::updateRegion
|
||||
public var uVs: ArrayFloat {
|
||||
let result = spine_mesh_attachment_get_u_vs(_ptr.assumingMemoryBound(to: spine_mesh_attachment_wrapper.self))
|
||||
return ArrayFloat(fromPointer: result!)
|
||||
}
|
||||
|
||||
public var triangles: ArrayUnsignedShort {
|
||||
get {
|
||||
let result = spine_mesh_attachment_get_triangles(_ptr.assumingMemoryBound(to: spine_mesh_attachment_wrapper.self))
|
||||
return ArrayUnsignedShort(fromPointer: result!)
|
||||
}
|
||||
set {
|
||||
spine_mesh_attachment_set_triangles(
|
||||
_ptr.assumingMemoryBound(to: spine_mesh_attachment_wrapper.self),
|
||||
newValue._ptr.assumingMemoryBound(to: spine_array_unsigned_short_wrapper.self))
|
||||
}
|
||||
}
|
||||
|
||||
public var color: Color {
|
||||
let result = spine_mesh_attachment_get_color(_ptr.assumingMemoryBound(to: spine_mesh_attachment_wrapper.self))
|
||||
return Color(fromPointer: result!)
|
||||
public var sequence: Sequence {
|
||||
let result = spine_mesh_attachment_get_sequence(_ptr.assumingMemoryBound(to: spine_mesh_attachment_wrapper.self))
|
||||
return Sequence(fromPointer: result!)
|
||||
}
|
||||
|
||||
public var path: String {
|
||||
@ -102,27 +91,9 @@ public class MeshAttachment: VertexAttachment {
|
||||
}
|
||||
}
|
||||
|
||||
public var region: TextureRegion? {
|
||||
get {
|
||||
let result = spine_mesh_attachment_get_region(_ptr.assumingMemoryBound(to: spine_mesh_attachment_wrapper.self))
|
||||
return result.map { TextureRegion(fromPointer: $0) }
|
||||
}
|
||||
set {
|
||||
spine_mesh_attachment_set_region(
|
||||
_ptr.assumingMemoryBound(to: spine_mesh_attachment_wrapper.self),
|
||||
newValue?._ptr.assumingMemoryBound(to: spine_texture_region_wrapper.self))
|
||||
}
|
||||
}
|
||||
|
||||
public var sequence: Sequence? {
|
||||
get {
|
||||
let result = spine_mesh_attachment_get_sequence(_ptr.assumingMemoryBound(to: spine_mesh_attachment_wrapper.self))
|
||||
return result.map { Sequence(fromPointer: $0) }
|
||||
}
|
||||
set {
|
||||
spine_mesh_attachment_set_sequence(
|
||||
_ptr.assumingMemoryBound(to: spine_mesh_attachment_wrapper.self), newValue?._ptr.assumingMemoryBound(to: spine_sequence_wrapper.self))
|
||||
}
|
||||
public var color: Color {
|
||||
let result = spine_mesh_attachment_get_color(_ptr.assumingMemoryBound(to: spine_mesh_attachment_wrapper.self))
|
||||
return Color(fromPointer: result!)
|
||||
}
|
||||
|
||||
public var parentMesh: MeshAttachment? {
|
||||
@ -131,22 +102,17 @@ public class MeshAttachment: VertexAttachment {
|
||||
return result.map { MeshAttachment(fromPointer: $0) }
|
||||
}
|
||||
set {
|
||||
spine_mesh_attachment_set_parent_mesh(
|
||||
_ptr.assumingMemoryBound(to: spine_mesh_attachment_wrapper.self),
|
||||
newValue?._ptr.assumingMemoryBound(to: spine_mesh_attachment_wrapper.self))
|
||||
spine_mesh_attachment_set_parent_mesh(_ptr.assumingMemoryBound(to: spine_mesh_attachment_wrapper.self), newValue?._ptr.assumingMemoryBound(to: spine_mesh_attachment_wrapper.self))
|
||||
}
|
||||
}
|
||||
|
||||
/// Nonessential.
|
||||
public var edges: ArrayUnsignedShort {
|
||||
get {
|
||||
let result = spine_mesh_attachment_get_edges(_ptr.assumingMemoryBound(to: spine_mesh_attachment_wrapper.self))
|
||||
return ArrayUnsignedShort(fromPointer: result!)
|
||||
}
|
||||
set {
|
||||
spine_mesh_attachment_set_edges(
|
||||
_ptr.assumingMemoryBound(to: spine_mesh_attachment_wrapper.self),
|
||||
newValue._ptr.assumingMemoryBound(to: spine_array_unsigned_short_wrapper.self))
|
||||
spine_mesh_attachment_set_edges(_ptr.assumingMemoryBound(to: spine_mesh_attachment_wrapper.self), newValue._ptr.assumingMemoryBound(to: spine_array_unsigned_short_wrapper.self))
|
||||
}
|
||||
}
|
||||
|
||||
@ -170,8 +136,8 @@ public class MeshAttachment: VertexAttachment {
|
||||
}
|
||||
}
|
||||
|
||||
public func updateRegion() {
|
||||
spine_mesh_attachment_update_region(_ptr.assumingMemoryBound(to: spine_mesh_attachment_wrapper.self))
|
||||
public func updateSequence() {
|
||||
spine_mesh_attachment_update_sequence(_ptr.assumingMemoryBound(to: spine_mesh_attachment_wrapper.self))
|
||||
}
|
||||
|
||||
public func newLinkedMesh() -> MeshAttachment {
|
||||
@ -179,6 +145,13 @@ public class MeshAttachment: VertexAttachment {
|
||||
return MeshAttachment(fromPointer: result!)
|
||||
}
|
||||
|
||||
/// Computes UVs for a mesh attachment.
|
||||
///
|
||||
/// - Parameter uvs: Output array for the computed UVs, same length as regionUVs.
|
||||
public static func computeUVs(_ region: TextureRegion?, _ regionUVs: ArrayFloat, _ uvs: ArrayFloat) {
|
||||
spine_mesh_attachment_compute_u_vs(region?._ptr.assumingMemoryBound(to: spine_texture_region_wrapper.self), regionUVs._ptr.assumingMemoryBound(to: spine_array_float_wrapper.self), uvs._ptr.assumingMemoryBound(to: spine_array_float_wrapper.self))
|
||||
}
|
||||
|
||||
public func dispose() {
|
||||
spine_mesh_attachment_dispose(_ptr.assumingMemoryBound(to: spine_mesh_attachment_wrapper.self))
|
||||
}
|
||||
|
||||
@ -53,9 +53,7 @@ public class PathAttachment: VertexAttachment {
|
||||
return ArrayFloat(fromPointer: result!)
|
||||
}
|
||||
set {
|
||||
spine_path_attachment_set_lengths(
|
||||
_ptr.assumingMemoryBound(to: spine_path_attachment_wrapper.self),
|
||||
newValue._ptr.assumingMemoryBound(to: spine_array_float_wrapper.self))
|
||||
spine_path_attachment_set_lengths(_ptr.assumingMemoryBound(to: spine_path_attachment_wrapper.self), newValue._ptr.assumingMemoryBound(to: spine_array_float_wrapper.self))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -42,9 +42,7 @@ public class PathConstraint: PathConstraintBase {
|
||||
}
|
||||
|
||||
public convenience init(_ data: PathConstraintData, _ skeleton: Skeleton) {
|
||||
let ptr = spine_path_constraint_create(
|
||||
data._ptr.assumingMemoryBound(to: spine_path_constraint_data_wrapper.self),
|
||||
skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self))
|
||||
let ptr = spine_path_constraint_create(data._ptr.assumingMemoryBound(to: spine_path_constraint_data_wrapper.self), skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self))
|
||||
self.init(fromPointer: ptr!)
|
||||
}
|
||||
|
||||
@ -61,14 +59,12 @@ public class PathConstraint: PathConstraintBase {
|
||||
return Slot(fromPointer: result!)
|
||||
}
|
||||
set {
|
||||
spine_path_constraint_set_slot(
|
||||
_ptr.assumingMemoryBound(to: spine_path_constraint_wrapper.self), newValue._ptr.assumingMemoryBound(to: spine_slot_wrapper.self))
|
||||
spine_path_constraint_set_slot(_ptr.assumingMemoryBound(to: spine_path_constraint_wrapper.self), newValue._ptr.assumingMemoryBound(to: spine_slot_wrapper.self))
|
||||
}
|
||||
}
|
||||
|
||||
public func copyAttachment(_ skeleton: Skeleton) -> PathConstraint {
|
||||
let result = spine_path_constraint_copy(
|
||||
_ptr.assumingMemoryBound(to: spine_path_constraint_wrapper.self), skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self))
|
||||
let result = spine_path_constraint_copy(_ptr.assumingMemoryBound(to: spine_path_constraint_wrapper.self), skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self))
|
||||
return PathConstraint(fromPointer: result!)
|
||||
}
|
||||
|
||||
|
||||
@ -84,15 +84,12 @@ open class PathConstraintBase: PosedActive, Posed, Constraint {
|
||||
}
|
||||
|
||||
public func sort(_ skeleton: Skeleton) {
|
||||
spine_path_constraint_base_sort(
|
||||
_ptr.assumingMemoryBound(to: spine_path_constraint_base_wrapper.self), skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self))
|
||||
spine_path_constraint_base_sort(_ptr.assumingMemoryBound(to: spine_path_constraint_base_wrapper.self), skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self))
|
||||
}
|
||||
|
||||
/// Inherited from Update
|
||||
public func update(_ skeleton: Skeleton, _ physics: Physics) {
|
||||
spine_path_constraint_base_update(
|
||||
_ptr.assumingMemoryBound(to: spine_path_constraint_base_wrapper.self), skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self),
|
||||
spine_physics(rawValue: UInt32(physics.rawValue)))
|
||||
spine_path_constraint_base_update(_ptr.assumingMemoryBound(to: spine_path_constraint_base_wrapper.self), skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self), spine_physics(rawValue: UInt32(physics.rawValue)))
|
||||
}
|
||||
|
||||
public static func rttiStatic() -> Rtti {
|
||||
|
||||
@ -67,9 +67,7 @@ public class PathConstraintData: PosedData, ConstraintData {
|
||||
return SlotData(fromPointer: result!)
|
||||
}
|
||||
set {
|
||||
spine_path_constraint_data_set_slot(
|
||||
_ptr.assumingMemoryBound(to: spine_path_constraint_data_wrapper.self),
|
||||
newValue._ptr.assumingMemoryBound(to: spine_slot_data_wrapper.self))
|
||||
spine_path_constraint_data_set_slot(_ptr.assumingMemoryBound(to: spine_path_constraint_data_wrapper.self), newValue._ptr.assumingMemoryBound(to: spine_slot_data_wrapper.self))
|
||||
}
|
||||
}
|
||||
|
||||
@ -80,8 +78,7 @@ public class PathConstraintData: PosedData, ConstraintData {
|
||||
return PositionMode(rawValue: Int32(result.rawValue))!
|
||||
}
|
||||
set {
|
||||
spine_path_constraint_data_set_position_mode(
|
||||
_ptr.assumingMemoryBound(to: spine_path_constraint_data_wrapper.self), spine_position_mode(rawValue: UInt32(newValue.rawValue)))
|
||||
spine_path_constraint_data_set_position_mode(_ptr.assumingMemoryBound(to: spine_path_constraint_data_wrapper.self), spine_position_mode(rawValue: UInt32(newValue.rawValue)))
|
||||
}
|
||||
}
|
||||
|
||||
@ -92,8 +89,7 @@ public class PathConstraintData: PosedData, ConstraintData {
|
||||
return SpacingMode(rawValue: Int32(result.rawValue))!
|
||||
}
|
||||
set {
|
||||
spine_path_constraint_data_set_spacing_mode(
|
||||
_ptr.assumingMemoryBound(to: spine_path_constraint_data_wrapper.self), spine_spacing_mode(rawValue: UInt32(newValue.rawValue)))
|
||||
spine_path_constraint_data_set_spacing_mode(_ptr.assumingMemoryBound(to: spine_path_constraint_data_wrapper.self), spine_spacing_mode(rawValue: UInt32(newValue.rawValue)))
|
||||
}
|
||||
}
|
||||
|
||||
@ -104,8 +100,7 @@ public class PathConstraintData: PosedData, ConstraintData {
|
||||
return RotateMode(rawValue: Int32(result.rawValue))!
|
||||
}
|
||||
set {
|
||||
spine_path_constraint_data_set_rotate_mode(
|
||||
_ptr.assumingMemoryBound(to: spine_path_constraint_data_wrapper.self), spine_rotate_mode(rawValue: UInt32(newValue.rawValue)))
|
||||
spine_path_constraint_data_set_rotate_mode(_ptr.assumingMemoryBound(to: spine_path_constraint_data_wrapper.self), spine_rotate_mode(rawValue: UInt32(newValue.rawValue)))
|
||||
}
|
||||
}
|
||||
|
||||
@ -126,8 +121,7 @@ public class PathConstraintData: PosedData, ConstraintData {
|
||||
}
|
||||
|
||||
public func createMethod(_ skeleton: Skeleton) -> Constraint {
|
||||
let result = spine_path_constraint_data_create_method(
|
||||
_ptr.assumingMemoryBound(to: spine_path_constraint_data_wrapper.self), skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self))
|
||||
let result = spine_path_constraint_data_create_method(_ptr.assumingMemoryBound(to: spine_path_constraint_data_wrapper.self), skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self))
|
||||
let rtti = spine_constraint_get_rtti(result!)
|
||||
let rttiClassName = String(cString: spine_rtti_get_class_name(rtti)!)
|
||||
switch rttiClassName {
|
||||
|
||||
@ -49,13 +49,11 @@ public class PathConstraintMixTimeline: CurveTimeline, ConstraintTimeline {
|
||||
|
||||
public var constraintIndex: Int32 {
|
||||
get {
|
||||
let result = spine_path_constraint_mix_timeline_get_constraint_index(
|
||||
_ptr.assumingMemoryBound(to: spine_path_constraint_mix_timeline_wrapper.self))
|
||||
let result = spine_path_constraint_mix_timeline_get_constraint_index(_ptr.assumingMemoryBound(to: spine_path_constraint_mix_timeline_wrapper.self))
|
||||
return result
|
||||
}
|
||||
set {
|
||||
spine_path_constraint_mix_timeline_set_constraint_index(
|
||||
_ptr.assumingMemoryBound(to: spine_path_constraint_mix_timeline_wrapper.self), newValue)
|
||||
spine_path_constraint_mix_timeline_set_constraint_index(_ptr.assumingMemoryBound(to: spine_path_constraint_mix_timeline_wrapper.self), newValue)
|
||||
}
|
||||
}
|
||||
|
||||
@ -64,8 +62,7 @@ public class PathConstraintMixTimeline: CurveTimeline, ConstraintTimeline {
|
||||
/// - Parameter frame: Between 0 and frameCount, inclusive.
|
||||
/// - Parameter time: The frame time in seconds.
|
||||
public func setFrame(_ frame: Int32, _ time: Float, _ mixRotate: Float, _ mixX: Float, _ mixY: Float) {
|
||||
spine_path_constraint_mix_timeline_set_frame(
|
||||
_ptr.assumingMemoryBound(to: spine_path_constraint_mix_timeline_wrapper.self), frame, time, mixRotate, mixX, mixY)
|
||||
spine_path_constraint_mix_timeline_set_frame(_ptr.assumingMemoryBound(to: spine_path_constraint_mix_timeline_wrapper.self), frame, time, mixRotate, mixX, mixY)
|
||||
}
|
||||
|
||||
public func dispose() {
|
||||
|
||||
@ -106,9 +106,7 @@ public class PathConstraintPose: NSObject {
|
||||
}
|
||||
|
||||
public func set(_ pose: PathConstraintPose) {
|
||||
spine_path_constraint_pose_set(
|
||||
_ptr.assumingMemoryBound(to: spine_path_constraint_pose_wrapper.self),
|
||||
pose._ptr.assumingMemoryBound(to: spine_path_constraint_pose_wrapper.self))
|
||||
spine_path_constraint_pose_set(_ptr.assumingMemoryBound(to: spine_path_constraint_pose_wrapper.self), pose._ptr.assumingMemoryBound(to: spine_path_constraint_pose_wrapper.self))
|
||||
}
|
||||
|
||||
public func dispose() {
|
||||
|
||||
@ -42,9 +42,7 @@ public class PhysicsConstraint: PhysicsConstraintBase {
|
||||
}
|
||||
|
||||
public convenience init(_ data: PhysicsConstraintData, _ skeleton: Skeleton) {
|
||||
let ptr = spine_physics_constraint_create(
|
||||
data._ptr.assumingMemoryBound(to: spine_physics_constraint_data_wrapper.self),
|
||||
skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self))
|
||||
let ptr = spine_physics_constraint_create(data._ptr.assumingMemoryBound(to: spine_physics_constraint_data_wrapper.self), skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self))
|
||||
self.init(fromPointer: ptr!)
|
||||
}
|
||||
|
||||
@ -55,21 +53,17 @@ public class PhysicsConstraint: PhysicsConstraintBase {
|
||||
return BonePose(fromPointer: result!)
|
||||
}
|
||||
set {
|
||||
spine_physics_constraint_set_bone(
|
||||
_ptr.assumingMemoryBound(to: spine_physics_constraint_wrapper.self),
|
||||
newValue._ptr.assumingMemoryBound(to: spine_bone_pose_wrapper.self))
|
||||
spine_physics_constraint_set_bone(_ptr.assumingMemoryBound(to: spine_physics_constraint_wrapper.self), newValue._ptr.assumingMemoryBound(to: spine_bone_pose_wrapper.self))
|
||||
}
|
||||
}
|
||||
|
||||
public func copyAttachment(_ skeleton: Skeleton) -> PhysicsConstraint {
|
||||
let result = spine_physics_constraint_copy(
|
||||
_ptr.assumingMemoryBound(to: spine_physics_constraint_wrapper.self), skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self))
|
||||
let result = spine_physics_constraint_copy(_ptr.assumingMemoryBound(to: spine_physics_constraint_wrapper.self), skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self))
|
||||
return PhysicsConstraint(fromPointer: result!)
|
||||
}
|
||||
|
||||
public func reset(_ skeleton: Skeleton) {
|
||||
spine_physics_constraint_reset(
|
||||
_ptr.assumingMemoryBound(to: spine_physics_constraint_wrapper.self), skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self))
|
||||
spine_physics_constraint_reset(_ptr.assumingMemoryBound(to: spine_physics_constraint_wrapper.self), skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self))
|
||||
}
|
||||
|
||||
/// Translates the physics constraint so next update() forces are applied as if the bone moved
|
||||
|
||||
@ -83,16 +83,12 @@ open class PhysicsConstraintBase: PosedActive, Posed, Constraint {
|
||||
}
|
||||
|
||||
public func sort(_ skeleton: Skeleton) {
|
||||
spine_physics_constraint_base_sort(
|
||||
_ptr.assumingMemoryBound(to: spine_physics_constraint_base_wrapper.self),
|
||||
skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self))
|
||||
spine_physics_constraint_base_sort(_ptr.assumingMemoryBound(to: spine_physics_constraint_base_wrapper.self), skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self))
|
||||
}
|
||||
|
||||
/// Inherited from Update
|
||||
public func update(_ skeleton: Skeleton, _ physics: Physics) {
|
||||
spine_physics_constraint_base_update(
|
||||
_ptr.assumingMemoryBound(to: spine_physics_constraint_base_wrapper.self),
|
||||
skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self), spine_physics(rawValue: UInt32(physics.rawValue)))
|
||||
spine_physics_constraint_base_update(_ptr.assumingMemoryBound(to: spine_physics_constraint_base_wrapper.self), skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self), spine_physics(rawValue: UInt32(physics.rawValue)))
|
||||
}
|
||||
|
||||
public static func rttiStatic() -> Rtti {
|
||||
|
||||
@ -61,9 +61,7 @@ public class PhysicsConstraintData: PosedData, ConstraintData {
|
||||
return BoneData(fromPointer: result!)
|
||||
}
|
||||
set {
|
||||
spine_physics_constraint_data_set_bone(
|
||||
_ptr.assumingMemoryBound(to: spine_physics_constraint_data_wrapper.self),
|
||||
newValue._ptr.assumingMemoryBound(to: spine_bone_data_wrapper.self))
|
||||
spine_physics_constraint_data_set_bone(_ptr.assumingMemoryBound(to: spine_physics_constraint_data_wrapper.self), newValue._ptr.assumingMemoryBound(to: spine_bone_data_wrapper.self))
|
||||
}
|
||||
}
|
||||
|
||||
@ -213,9 +211,7 @@ public class PhysicsConstraintData: PosedData, ConstraintData {
|
||||
}
|
||||
|
||||
public func createMethod(_ skeleton: Skeleton) -> Constraint {
|
||||
let result = spine_physics_constraint_data_create_method(
|
||||
_ptr.assumingMemoryBound(to: spine_physics_constraint_data_wrapper.self),
|
||||
skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self))
|
||||
let result = spine_physics_constraint_data_create_method(_ptr.assumingMemoryBound(to: spine_physics_constraint_data_wrapper.self), skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self))
|
||||
let rtti = spine_constraint_get_rtti(result!)
|
||||
let rttiClassName = String(cString: spine_rtti_get_class_name(rtti)!)
|
||||
switch rttiClassName {
|
||||
|
||||
@ -120,9 +120,7 @@ public class PhysicsConstraintPose: NSObject {
|
||||
}
|
||||
|
||||
public func set(_ pose: PhysicsConstraintPose) {
|
||||
spine_physics_constraint_pose_set(
|
||||
_ptr.assumingMemoryBound(to: spine_physics_constraint_pose_wrapper.self),
|
||||
pose._ptr.assumingMemoryBound(to: spine_physics_constraint_pose_wrapper.self))
|
||||
spine_physics_constraint_pose_set(_ptr.assumingMemoryBound(to: spine_physics_constraint_pose_wrapper.self), pose._ptr.assumingMemoryBound(to: spine_physics_constraint_pose_wrapper.self))
|
||||
}
|
||||
|
||||
public func dispose() {
|
||||
|
||||
@ -49,20 +49,17 @@ public class PhysicsConstraintResetTimeline: Timeline, ConstraintTimeline {
|
||||
|
||||
public var constraintIndex: Int32 {
|
||||
get {
|
||||
let result = spine_physics_constraint_reset_timeline_get_constraint_index(
|
||||
_ptr.assumingMemoryBound(to: spine_physics_constraint_reset_timeline_wrapper.self))
|
||||
let result = spine_physics_constraint_reset_timeline_get_constraint_index(_ptr.assumingMemoryBound(to: spine_physics_constraint_reset_timeline_wrapper.self))
|
||||
return result
|
||||
}
|
||||
set {
|
||||
spine_physics_constraint_reset_timeline_set_constraint_index(
|
||||
_ptr.assumingMemoryBound(to: spine_physics_constraint_reset_timeline_wrapper.self), newValue)
|
||||
spine_physics_constraint_reset_timeline_set_constraint_index(_ptr.assumingMemoryBound(to: spine_physics_constraint_reset_timeline_wrapper.self), newValue)
|
||||
}
|
||||
}
|
||||
|
||||
/// Sets the time for the specified frame.
|
||||
public func setFrame(_ frame: Int32, _ time: Float) {
|
||||
spine_physics_constraint_reset_timeline_set_frame(
|
||||
_ptr.assumingMemoryBound(to: spine_physics_constraint_reset_timeline_wrapper.self), frame, time)
|
||||
spine_physics_constraint_reset_timeline_set_frame(_ptr.assumingMemoryBound(to: spine_physics_constraint_reset_timeline_wrapper.self), frame, time)
|
||||
}
|
||||
|
||||
public func dispose() {
|
||||
|
||||
@ -43,13 +43,11 @@ open class PhysicsConstraintTimeline: CurveTimeline1, ConstraintTimeline {
|
||||
|
||||
public var constraintIndex: Int32 {
|
||||
get {
|
||||
let result = spine_physics_constraint_timeline_get_constraint_index(
|
||||
_ptr.assumingMemoryBound(to: spine_physics_constraint_timeline_wrapper.self))
|
||||
let result = spine_physics_constraint_timeline_get_constraint_index(_ptr.assumingMemoryBound(to: spine_physics_constraint_timeline_wrapper.self))
|
||||
return result
|
||||
}
|
||||
set {
|
||||
spine_physics_constraint_timeline_set_constraint_index(
|
||||
_ptr.assumingMemoryBound(to: spine_physics_constraint_timeline_wrapper.self), newValue)
|
||||
spine_physics_constraint_timeline_set_constraint_index(_ptr.assumingMemoryBound(to: spine_physics_constraint_timeline_wrapper.self), newValue)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -86,8 +86,7 @@ public class PointAttachment: Attachment {
|
||||
}
|
||||
|
||||
public func computeWorldRotation(_ bone: BonePose) -> Float {
|
||||
let result = spine_point_attachment_compute_world_rotation(
|
||||
_ptr.assumingMemoryBound(to: spine_point_attachment_wrapper.self), bone._ptr.assumingMemoryBound(to: spine_bone_pose_wrapper.self))
|
||||
let result = spine_point_attachment_compute_world_rotation(_ptr.assumingMemoryBound(to: spine_point_attachment_wrapper.self), bone._ptr.assumingMemoryBound(to: spine_bone_pose_wrapper.self))
|
||||
return result
|
||||
}
|
||||
|
||||
|
||||
@ -53,17 +53,17 @@ public enum Property: Int32, CaseIterable {
|
||||
case pathConstraintPosition = 131072
|
||||
case pathConstraintSpacing = 262144
|
||||
case pathConstraintMix = 524288
|
||||
case physicsConstraintInertia = 1_048_576
|
||||
case physicsConstraintStrength = 2_097_152
|
||||
case physicsConstraintDamping = 4_194_304
|
||||
case physicsConstraintMass = 8_388_608
|
||||
case physicsConstraintWind = 16_777_216
|
||||
case physicsConstraintGravity = 33_554_432
|
||||
case physicsConstraintMix = 67_108_864
|
||||
case physicsConstraintReset = 134_217_728
|
||||
case sequence = 268_435_456
|
||||
case sliderTime = 536_870_912
|
||||
case sliderMix = 1_073_741_824
|
||||
case physicsConstraintInertia = 1048576
|
||||
case physicsConstraintStrength = 2097152
|
||||
case physicsConstraintDamping = 4194304
|
||||
case physicsConstraintMass = 8388608
|
||||
case physicsConstraintWind = 16777216
|
||||
case physicsConstraintGravity = 33554432
|
||||
case physicsConstraintMix = 67108864
|
||||
case physicsConstraintReset = 134217728
|
||||
case sequence = 268435456
|
||||
case sliderTime = 536870912
|
||||
case sliderMix = 1073741824
|
||||
|
||||
public static func fromValue(_ value: Int32) -> Property? {
|
||||
return Property(rawValue: value)
|
||||
|
||||
@ -41,8 +41,8 @@ public class RegionAttachment: Attachment {
|
||||
super.init(fromPointer: UnsafeMutableRawPointer(ptr).assumingMemoryBound(to: spine_attachment_wrapper.self))
|
||||
}
|
||||
|
||||
public convenience init(_ name: String) {
|
||||
let ptr = spine_region_attachment_create(name)
|
||||
public convenience init(_ name: String, _ sequence: Sequence?) {
|
||||
let ptr = spine_region_attachment_create(name, sequence?._ptr.assumingMemoryBound(to: spine_sequence_wrapper.self))
|
||||
self.init(fromPointer: ptr!)
|
||||
}
|
||||
|
||||
@ -66,16 +66,6 @@ public class RegionAttachment: Attachment {
|
||||
}
|
||||
}
|
||||
|
||||
public var rotation: Float {
|
||||
get {
|
||||
let result = spine_region_attachment_get_rotation(_ptr.assumingMemoryBound(to: spine_region_attachment_wrapper.self))
|
||||
return result
|
||||
}
|
||||
set {
|
||||
spine_region_attachment_set_rotation(_ptr.assumingMemoryBound(to: spine_region_attachment_wrapper.self), newValue)
|
||||
}
|
||||
}
|
||||
|
||||
public var scaleX: Float {
|
||||
get {
|
||||
let result = spine_region_attachment_get_scale_x(_ptr.assumingMemoryBound(to: spine_region_attachment_wrapper.self))
|
||||
@ -96,6 +86,16 @@ public class RegionAttachment: Attachment {
|
||||
}
|
||||
}
|
||||
|
||||
public var rotation: Float {
|
||||
get {
|
||||
let result = spine_region_attachment_get_rotation(_ptr.assumingMemoryBound(to: spine_region_attachment_wrapper.self))
|
||||
return result
|
||||
}
|
||||
set {
|
||||
spine_region_attachment_set_rotation(_ptr.assumingMemoryBound(to: spine_region_attachment_wrapper.self), newValue)
|
||||
}
|
||||
}
|
||||
|
||||
public var width: Float {
|
||||
get {
|
||||
let result = spine_region_attachment_get_width(_ptr.assumingMemoryBound(to: spine_region_attachment_wrapper.self))
|
||||
@ -116,9 +116,9 @@ public class RegionAttachment: Attachment {
|
||||
}
|
||||
}
|
||||
|
||||
public var color: Color {
|
||||
let result = spine_region_attachment_get_color(_ptr.assumingMemoryBound(to: spine_region_attachment_wrapper.self))
|
||||
return Color(fromPointer: result!)
|
||||
public var sequence: Sequence {
|
||||
let result = spine_region_attachment_get_sequence(_ptr.assumingMemoryBound(to: spine_region_attachment_wrapper.self))
|
||||
return Sequence(fromPointer: result!)
|
||||
}
|
||||
|
||||
public var path: String {
|
||||
@ -131,48 +131,31 @@ public class RegionAttachment: Attachment {
|
||||
}
|
||||
}
|
||||
|
||||
public var region: TextureRegion? {
|
||||
get {
|
||||
let result = spine_region_attachment_get_region(_ptr.assumingMemoryBound(to: spine_region_attachment_wrapper.self))
|
||||
return result.map { TextureRegion(fromPointer: $0) }
|
||||
}
|
||||
set {
|
||||
spine_region_attachment_set_region(
|
||||
_ptr.assumingMemoryBound(to: spine_region_attachment_wrapper.self),
|
||||
newValue?._ptr.assumingMemoryBound(to: spine_texture_region_wrapper.self))
|
||||
}
|
||||
public var color: Color {
|
||||
let result = spine_region_attachment_get_color(_ptr.assumingMemoryBound(to: spine_region_attachment_wrapper.self))
|
||||
return Color(fromPointer: result!)
|
||||
}
|
||||
|
||||
public var sequence: Sequence? {
|
||||
get {
|
||||
let result = spine_region_attachment_get_sequence(_ptr.assumingMemoryBound(to: spine_region_attachment_wrapper.self))
|
||||
return result.map { Sequence(fromPointer: $0) }
|
||||
}
|
||||
set {
|
||||
spine_region_attachment_set_sequence(
|
||||
_ptr.assumingMemoryBound(to: spine_region_attachment_wrapper.self),
|
||||
newValue?._ptr.assumingMemoryBound(to: spine_sequence_wrapper.self))
|
||||
}
|
||||
}
|
||||
|
||||
public var offset: ArrayFloat {
|
||||
let result = spine_region_attachment_get_offset(_ptr.assumingMemoryBound(to: spine_region_attachment_wrapper.self))
|
||||
/// Returns the vertex offsets for the specified slot pose.
|
||||
public func getOffsets(_ pose: SlotPose) -> ArrayFloat {
|
||||
let result = spine_region_attachment_get_offsets(_ptr.assumingMemoryBound(to: spine_region_attachment_wrapper.self), pose._ptr.assumingMemoryBound(to: spine_slot_pose_wrapper.self))
|
||||
return ArrayFloat(fromPointer: result!)
|
||||
}
|
||||
|
||||
public var uVs: ArrayFloat {
|
||||
let result = spine_region_attachment_get_u_vs(_ptr.assumingMemoryBound(to: spine_region_attachment_wrapper.self))
|
||||
return ArrayFloat(fromPointer: result!)
|
||||
public func updateSequence() {
|
||||
spine_region_attachment_update_sequence(_ptr.assumingMemoryBound(to: spine_region_attachment_wrapper.self))
|
||||
}
|
||||
|
||||
public func updateRegion() {
|
||||
spine_region_attachment_update_region(_ptr.assumingMemoryBound(to: spine_region_attachment_wrapper.self))
|
||||
/// Computes UVs and offsets for a region attachment.
|
||||
///
|
||||
/// - Parameter uvs: Output array for the computed UVs, length of 8.
|
||||
/// - Parameter offset: Output array for the computed vertex offsets, length of 8.
|
||||
public static func computeUVs(_ region: TextureRegion?, _ x: Float, _ y: Float, _ scaleX: Float, _ scaleY: Float, _ rotation: Float, _ width: Float, _ height: Float, _ offset: ArrayFloat, _ uvs: ArrayFloat) {
|
||||
spine_region_attachment_compute_u_vs(region?._ptr.assumingMemoryBound(to: spine_texture_region_wrapper.self), x, y, scaleX, scaleY, rotation, width, height, offset._ptr.assumingMemoryBound(to: spine_array_float_wrapper.self), uvs._ptr.assumingMemoryBound(to: spine_array_float_wrapper.self))
|
||||
}
|
||||
|
||||
public func computeWorldVertices(_ slot: Slot, _ worldVertices: ArrayFloat, _ offset: Int, _ stride: Int) {
|
||||
spine_region_attachment_compute_world_vertices_2(
|
||||
_ptr.assumingMemoryBound(to: spine_region_attachment_wrapper.self), slot._ptr.assumingMemoryBound(to: spine_slot_wrapper.self),
|
||||
worldVertices._ptr.assumingMemoryBound(to: spine_array_float_wrapper.self), offset, stride)
|
||||
public func computeWorldVertices(_ slot: Slot, _ vertexOffsets: ArrayFloat, _ worldVertices: ArrayFloat, _ offset: Int, _ stride: Int) {
|
||||
spine_region_attachment_compute_world_vertices_2(_ptr.assumingMemoryBound(to: spine_region_attachment_wrapper.self), slot._ptr.assumingMemoryBound(to: spine_slot_wrapper.self), vertexOffsets._ptr.assumingMemoryBound(to: spine_array_float_wrapper.self), worldVertices._ptr.assumingMemoryBound(to: spine_array_float_wrapper.self), offset, stride)
|
||||
}
|
||||
|
||||
public func dispose() {
|
||||
|
||||
@ -89,9 +89,7 @@ public class SequenceTimeline: Timeline, SlotTimeline {
|
||||
/// - Parameter frame: Between 0 and frameCount, inclusive.
|
||||
/// - Parameter delay: Seconds between frames.
|
||||
public func setFrame(_ frame: Int32, _ time: Float, _ mode: SequenceMode, _ index: Int32, _ delay: Float) {
|
||||
spine_sequence_timeline_set_frame(
|
||||
_ptr.assumingMemoryBound(to: spine_sequence_timeline_wrapper.self), frame, time, spine_sequence_mode(rawValue: UInt32(mode.rawValue)),
|
||||
index, delay)
|
||||
spine_sequence_timeline_set_frame(_ptr.assumingMemoryBound(to: spine_sequence_timeline_wrapper.self), frame, time, spine_sequence_mode(rawValue: UInt32(mode.rawValue)), index, delay)
|
||||
}
|
||||
|
||||
public func dispose() {
|
||||
|
||||
@ -104,9 +104,7 @@ public class SkeletonBounds: NSObject {
|
||||
/// - Parameter skeleton: The skeleton.
|
||||
/// - Parameter updateAabb: If true, the axis aligned bounding box containing all the polygons is computed. If false, the SkeletonBounds AABB methods will always return true.
|
||||
public func update(_ skeleton: Skeleton, _ updateAabb: Bool) {
|
||||
spine_skeleton_bounds_update(
|
||||
_ptr.assumingMemoryBound(to: spine_skeleton_bounds_wrapper.self), skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self),
|
||||
updateAabb)
|
||||
spine_skeleton_bounds_update(_ptr.assumingMemoryBound(to: spine_skeleton_bounds_wrapper.self), skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self), updateAabb)
|
||||
}
|
||||
|
||||
/// Returns true if the axis aligned bounding box contains the point.
|
||||
@ -124,31 +122,26 @@ public class SkeletonBounds: NSObject {
|
||||
/// Returns true if the axis aligned bounding box intersects the axis aligned bounding box of
|
||||
/// the specified bounds.
|
||||
public func aabbIntersectsSkeleton(_ bounds: SkeletonBounds) -> Bool {
|
||||
let result = spine_skeleton_bounds_aabb_intersects_skeleton(
|
||||
_ptr.assumingMemoryBound(to: spine_skeleton_bounds_wrapper.self), bounds._ptr.assumingMemoryBound(to: spine_skeleton_bounds_wrapper.self))
|
||||
let result = spine_skeleton_bounds_aabb_intersects_skeleton(_ptr.assumingMemoryBound(to: spine_skeleton_bounds_wrapper.self), bounds._ptr.assumingMemoryBound(to: spine_skeleton_bounds_wrapper.self))
|
||||
return result
|
||||
}
|
||||
|
||||
/// Returns the polygon for the given bounding box attachment or null if no polygon can be found
|
||||
/// for the attachment. Requires a call to update() first.
|
||||
public func getPolygon(_ attachment: BoundingBoxAttachment?) -> Polygon? {
|
||||
let result = spine_skeleton_bounds_get_polygon(
|
||||
_ptr.assumingMemoryBound(to: spine_skeleton_bounds_wrapper.self),
|
||||
attachment?._ptr.assumingMemoryBound(to: spine_bounding_box_attachment_wrapper.self))
|
||||
let result = spine_skeleton_bounds_get_polygon(_ptr.assumingMemoryBound(to: spine_skeleton_bounds_wrapper.self), attachment?._ptr.assumingMemoryBound(to: spine_bounding_box_attachment_wrapper.self))
|
||||
return result.map { Polygon(fromPointer: $0) }
|
||||
}
|
||||
|
||||
/// Returns the bounding box for the given polygon or null. Requires a call to update() first.
|
||||
public func getBoundingBox(_ polygon: Polygon?) -> BoundingBoxAttachment? {
|
||||
let result = spine_skeleton_bounds_get_bounding_box(
|
||||
_ptr.assumingMemoryBound(to: spine_skeleton_bounds_wrapper.self), polygon?._ptr.assumingMemoryBound(to: spine_polygon_wrapper.self))
|
||||
let result = spine_skeleton_bounds_get_bounding_box(_ptr.assumingMemoryBound(to: spine_skeleton_bounds_wrapper.self), polygon?._ptr.assumingMemoryBound(to: spine_polygon_wrapper.self))
|
||||
return result.map { BoundingBoxAttachment(fromPointer: $0) }
|
||||
}
|
||||
|
||||
/// Returns true if the polygon contains the point.
|
||||
public func containsPoint(_ polygon: Polygon, _ x: Float, _ y: Float) -> Bool {
|
||||
let result = spine_skeleton_bounds_contains_point_1(
|
||||
_ptr.assumingMemoryBound(to: spine_skeleton_bounds_wrapper.self), polygon._ptr.assumingMemoryBound(to: spine_polygon_wrapper.self), x, y)
|
||||
let result = spine_skeleton_bounds_contains_point_1(_ptr.assumingMemoryBound(to: spine_skeleton_bounds_wrapper.self), polygon._ptr.assumingMemoryBound(to: spine_polygon_wrapper.self), x, y)
|
||||
return result
|
||||
}
|
||||
|
||||
@ -170,9 +163,7 @@ public class SkeletonBounds: NSObject {
|
||||
|
||||
/// Returns true if the polygon contains any part of the line segment.
|
||||
public func intersectsSegment2(_ polygon: Polygon, _ x1: Float, _ y1: Float, _ x2: Float, _ y2: Float) -> Bool {
|
||||
let result = spine_skeleton_bounds_intersects_segment_2(
|
||||
_ptr.assumingMemoryBound(to: spine_skeleton_bounds_wrapper.self), polygon._ptr.assumingMemoryBound(to: spine_polygon_wrapper.self), x1,
|
||||
y1, x2, y2)
|
||||
let result = spine_skeleton_bounds_intersects_segment_2(_ptr.assumingMemoryBound(to: spine_skeleton_bounds_wrapper.self), polygon._ptr.assumingMemoryBound(to: spine_polygon_wrapper.self), x1, y1, x2, y2)
|
||||
return result
|
||||
}
|
||||
|
||||
|
||||
@ -69,15 +69,12 @@ public class SkeletonClipping: NSObject {
|
||||
}
|
||||
|
||||
public func clipStart(_ skeleton: Skeleton, _ slot: Slot, _ clip: ClippingAttachment?) -> Int {
|
||||
let result = spine_skeleton_clipping_clip_start(
|
||||
_ptr.assumingMemoryBound(to: spine_skeleton_clipping_wrapper.self), skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self),
|
||||
slot._ptr.assumingMemoryBound(to: spine_slot_wrapper.self), clip?._ptr.assumingMemoryBound(to: spine_clipping_attachment_wrapper.self))
|
||||
let result = spine_skeleton_clipping_clip_start(_ptr.assumingMemoryBound(to: spine_skeleton_clipping_wrapper.self), skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self), slot._ptr.assumingMemoryBound(to: spine_slot_wrapper.self), clip?._ptr.assumingMemoryBound(to: spine_clipping_attachment_wrapper.self))
|
||||
return result
|
||||
}
|
||||
|
||||
public func clipEnd(_ slot: Slot) {
|
||||
spine_skeleton_clipping_clip_end_1(
|
||||
_ptr.assumingMemoryBound(to: spine_skeleton_clipping_wrapper.self), slot._ptr.assumingMemoryBound(to: spine_slot_wrapper.self))
|
||||
spine_skeleton_clipping_clip_end_1(_ptr.assumingMemoryBound(to: spine_skeleton_clipping_wrapper.self), slot._ptr.assumingMemoryBound(to: spine_slot_wrapper.self))
|
||||
}
|
||||
|
||||
public func clipEnd2() {
|
||||
@ -85,10 +82,7 @@ public class SkeletonClipping: NSObject {
|
||||
}
|
||||
|
||||
public func clipTriangles(_ vertices: ArrayFloat, _ triangles: ArrayUnsignedShort, _ uvs: ArrayFloat, _ stride: Int) -> Bool {
|
||||
let result = spine_skeleton_clipping_clip_triangles_3(
|
||||
_ptr.assumingMemoryBound(to: spine_skeleton_clipping_wrapper.self), vertices._ptr.assumingMemoryBound(to: spine_array_float_wrapper.self),
|
||||
triangles._ptr.assumingMemoryBound(to: spine_array_unsigned_short_wrapper.self),
|
||||
uvs._ptr.assumingMemoryBound(to: spine_array_float_wrapper.self), stride)
|
||||
let result = spine_skeleton_clipping_clip_triangles_3(_ptr.assumingMemoryBound(to: spine_skeleton_clipping_wrapper.self), vertices._ptr.assumingMemoryBound(to: spine_array_float_wrapper.self), triangles._ptr.assumingMemoryBound(to: spine_array_unsigned_short_wrapper.self), uvs._ptr.assumingMemoryBound(to: spine_array_float_wrapper.self), stride)
|
||||
return result
|
||||
}
|
||||
|
||||
|
||||
@ -90,8 +90,7 @@ public class SkeletonData: NSObject {
|
||||
return result.map { Skin(fromPointer: $0) }
|
||||
}
|
||||
set {
|
||||
spine_skeleton_data_set_default_skin(
|
||||
_ptr.assumingMemoryBound(to: spine_skeleton_data_wrapper.self), newValue?._ptr.assumingMemoryBound(to: spine_skin_wrapper.self))
|
||||
spine_skeleton_data_set_default_skin(_ptr.assumingMemoryBound(to: spine_skeleton_data_wrapper.self), newValue?._ptr.assumingMemoryBound(to: spine_skin_wrapper.self))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -49,8 +49,7 @@ public class SkeletonRenderer: NSObject {
|
||||
}
|
||||
|
||||
public func render(_ skeleton: Skeleton) -> RenderCommand? {
|
||||
let result = spine_skeleton_renderer_render(
|
||||
_ptr.assumingMemoryBound(to: spine_skeleton_renderer_wrapper.self), skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self))
|
||||
let result = spine_skeleton_renderer_render(_ptr.assumingMemoryBound(to: spine_skeleton_renderer_wrapper.self), skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self))
|
||||
return result.map { RenderCommand(fromPointer: $0) }
|
||||
}
|
||||
|
||||
|
||||
@ -83,15 +83,12 @@ open class SliderBase: PosedActive, Posed, Constraint {
|
||||
}
|
||||
|
||||
public func sort(_ skeleton: Skeleton) {
|
||||
spine_slider_base_sort(
|
||||
_ptr.assumingMemoryBound(to: spine_slider_base_wrapper.self), skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self))
|
||||
spine_slider_base_sort(_ptr.assumingMemoryBound(to: spine_slider_base_wrapper.self), skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self))
|
||||
}
|
||||
|
||||
/// Inherited from Update
|
||||
public func update(_ skeleton: Skeleton, _ physics: Physics) {
|
||||
spine_slider_base_update(
|
||||
_ptr.assumingMemoryBound(to: spine_slider_base_wrapper.self), skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self),
|
||||
spine_physics(rawValue: UInt32(physics.rawValue)))
|
||||
spine_slider_base_update(_ptr.assumingMemoryBound(to: spine_slider_base_wrapper.self), skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self), spine_physics(rawValue: UInt32(physics.rawValue)))
|
||||
}
|
||||
|
||||
public static func rttiStatic() -> Rtti {
|
||||
|
||||
@ -57,8 +57,7 @@ public class SliderData: PosedData, ConstraintData {
|
||||
return Animation(fromPointer: result!)
|
||||
}
|
||||
set {
|
||||
spine_slider_data_set_animation(
|
||||
_ptr.assumingMemoryBound(to: spine_slider_data_wrapper.self), newValue._ptr.assumingMemoryBound(to: spine_animation_wrapper.self))
|
||||
spine_slider_data_set_animation(_ptr.assumingMemoryBound(to: spine_slider_data_wrapper.self), newValue._ptr.assumingMemoryBound(to: spine_animation_wrapper.self))
|
||||
}
|
||||
}
|
||||
|
||||
@ -88,8 +87,7 @@ public class SliderData: PosedData, ConstraintData {
|
||||
return result.map { BoneData(fromPointer: $0) }
|
||||
}
|
||||
set {
|
||||
spine_slider_data_set_bone(
|
||||
_ptr.assumingMemoryBound(to: spine_slider_data_wrapper.self), newValue?._ptr.assumingMemoryBound(to: spine_bone_data_wrapper.self))
|
||||
spine_slider_data_set_bone(_ptr.assumingMemoryBound(to: spine_slider_data_wrapper.self), newValue?._ptr.assumingMemoryBound(to: spine_bone_data_wrapper.self))
|
||||
}
|
||||
}
|
||||
|
||||
@ -123,9 +121,7 @@ public class SliderData: PosedData, ConstraintData {
|
||||
}
|
||||
}
|
||||
set {
|
||||
spine_slider_data_set_property(
|
||||
_ptr.assumingMemoryBound(to: spine_slider_data_wrapper.self), newValue?._ptr.assumingMemoryBound(to: spine_from_property_wrapper.self)
|
||||
)
|
||||
spine_slider_data_set_property(_ptr.assumingMemoryBound(to: spine_slider_data_wrapper.self), newValue?._ptr.assumingMemoryBound(to: spine_from_property_wrapper.self))
|
||||
}
|
||||
}
|
||||
|
||||
@ -166,8 +162,7 @@ public class SliderData: PosedData, ConstraintData {
|
||||
|
||||
/// Creates a slider instance.
|
||||
public func createMethod(_ skeleton: Skeleton) -> Constraint {
|
||||
let result = spine_slider_data_create_method(
|
||||
_ptr.assumingMemoryBound(to: spine_slider_data_wrapper.self), skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self))
|
||||
let result = spine_slider_data_create_method(_ptr.assumingMemoryBound(to: spine_slider_data_wrapper.self), skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self))
|
||||
let rtti = spine_constraint_get_rtti(result!)
|
||||
let rttiClassName = String(cString: spine_rtti_get_class_name(rtti)!)
|
||||
switch rttiClassName {
|
||||
|
||||
@ -69,8 +69,7 @@ public class SliderPose: NSObject {
|
||||
}
|
||||
|
||||
public func set(_ pose: SliderPose) {
|
||||
spine_slider_pose_set(
|
||||
_ptr.assumingMemoryBound(to: spine_slider_pose_wrapper.self), pose._ptr.assumingMemoryBound(to: spine_slider_pose_wrapper.self))
|
||||
spine_slider_pose_set(_ptr.assumingMemoryBound(to: spine_slider_pose_wrapper.self), pose._ptr.assumingMemoryBound(to: spine_slider_pose_wrapper.self))
|
||||
}
|
||||
|
||||
public func dispose() {
|
||||
|
||||
@ -77,8 +77,7 @@ public class SlotData: PosedData {
|
||||
return BlendMode(rawValue: Int32(result.rawValue))!
|
||||
}
|
||||
set {
|
||||
spine_slot_data_set_blend_mode(
|
||||
_ptr.assumingMemoryBound(to: spine_slot_data_wrapper.self), spine_blend_mode(rawValue: UInt32(newValue.rawValue)))
|
||||
spine_slot_data_set_blend_mode(_ptr.assumingMemoryBound(to: spine_slot_data_wrapper.self), spine_blend_mode(rawValue: UInt32(newValue.rawValue)))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -104,8 +104,7 @@ public class SlotPose: NSObject {
|
||||
}
|
||||
}
|
||||
set {
|
||||
spine_slot_pose_set_attachment(
|
||||
_ptr.assumingMemoryBound(to: spine_slot_pose_wrapper.self), newValue?._ptr.assumingMemoryBound(to: spine_attachment_wrapper.self))
|
||||
spine_slot_pose_set_attachment(_ptr.assumingMemoryBound(to: spine_slot_pose_wrapper.self), newValue?._ptr.assumingMemoryBound(to: spine_attachment_wrapper.self))
|
||||
}
|
||||
}
|
||||
|
||||
@ -132,8 +131,7 @@ public class SlotPose: NSObject {
|
||||
}
|
||||
|
||||
public func set(_ pose: SlotPose) {
|
||||
spine_slot_pose_set(
|
||||
_ptr.assumingMemoryBound(to: spine_slot_pose_wrapper.self), pose._ptr.assumingMemoryBound(to: spine_slot_pose_wrapper.self))
|
||||
spine_slot_pose_set(_ptr.assumingMemoryBound(to: spine_slot_pose_wrapper.self), pose._ptr.assumingMemoryBound(to: spine_slot_pose_wrapper.self))
|
||||
}
|
||||
|
||||
public func dispose() {
|
||||
|
||||
@ -80,18 +80,13 @@ open class ToProperty: NSObject {
|
||||
|
||||
/// Reads the mix for this property from the specified pose.
|
||||
public func mix(_ pose: TransformConstraintPose) -> Float {
|
||||
let result = spine_to_property_mix(
|
||||
_ptr.assumingMemoryBound(to: spine_to_property_wrapper.self),
|
||||
pose._ptr.assumingMemoryBound(to: spine_transform_constraint_pose_wrapper.self))
|
||||
let result = spine_to_property_mix(_ptr.assumingMemoryBound(to: spine_to_property_wrapper.self), pose._ptr.assumingMemoryBound(to: spine_transform_constraint_pose_wrapper.self))
|
||||
return result
|
||||
}
|
||||
|
||||
/// Applies the value to this property.
|
||||
public func apply(_ skeleton: Skeleton, _ pose: TransformConstraintPose, _ bone: BonePose, _ value: Float, _ local: Bool, _ additive: Bool) {
|
||||
spine_to_property_apply(
|
||||
_ptr.assumingMemoryBound(to: spine_to_property_wrapper.self), skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self),
|
||||
pose._ptr.assumingMemoryBound(to: spine_transform_constraint_pose_wrapper.self),
|
||||
bone._ptr.assumingMemoryBound(to: spine_bone_pose_wrapper.self), value, local, additive)
|
||||
spine_to_property_apply(_ptr.assumingMemoryBound(to: spine_to_property_wrapper.self), skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self), pose._ptr.assumingMemoryBound(to: spine_transform_constraint_pose_wrapper.self), bone._ptr.assumingMemoryBound(to: spine_bone_pose_wrapper.self), value, local, additive)
|
||||
}
|
||||
|
||||
public static func rttiStatic() -> Rtti {
|
||||
|
||||
@ -61,8 +61,7 @@ public class TrackEntry: NSObject {
|
||||
return Animation(fromPointer: result!)
|
||||
}
|
||||
set {
|
||||
spine_track_entry_set_animation(
|
||||
_ptr.assumingMemoryBound(to: spine_track_entry_wrapper.self), newValue._ptr.assumingMemoryBound(to: spine_animation_wrapper.self))
|
||||
spine_track_entry_set_animation(_ptr.assumingMemoryBound(to: spine_track_entry_wrapper.self), newValue._ptr.assumingMemoryBound(to: spine_animation_wrapper.self))
|
||||
}
|
||||
}
|
||||
|
||||
@ -364,8 +363,7 @@ public class TrackEntry: NSObject {
|
||||
return MixBlend(rawValue: Int32(result.rawValue))!
|
||||
}
|
||||
set {
|
||||
spine_track_entry_set_mix_blend(
|
||||
_ptr.assumingMemoryBound(to: spine_track_entry_wrapper.self), spine_mix_blend(rawValue: UInt32(newValue.rawValue)))
|
||||
spine_track_entry_set_mix_blend(_ptr.assumingMemoryBound(to: spine_track_entry_wrapper.self), spine_mix_blend(rawValue: UInt32(newValue.rawValue)))
|
||||
}
|
||||
}
|
||||
|
||||
@ -419,9 +417,7 @@ public class TrackEntry: NSObject {
|
||||
return result.map { AnimationState(fromPointer: $0) }
|
||||
}
|
||||
set {
|
||||
spine_track_entry_set_animation_state(
|
||||
_ptr.assumingMemoryBound(to: spine_track_entry_wrapper.self),
|
||||
newValue?._ptr.assumingMemoryBound(to: spine_animation_state_wrapper.self))
|
||||
spine_track_entry_set_animation_state(_ptr.assumingMemoryBound(to: spine_track_entry_wrapper.self), newValue?._ptr.assumingMemoryBound(to: spine_animation_state_wrapper.self))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -42,9 +42,7 @@ public class TransformConstraint: TransformConstraintBase {
|
||||
}
|
||||
|
||||
public convenience init(_ data: TransformConstraintData, _ skeleton: Skeleton) {
|
||||
let ptr = spine_transform_constraint_create(
|
||||
data._ptr.assumingMemoryBound(to: spine_transform_constraint_data_wrapper.self),
|
||||
skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self))
|
||||
let ptr = spine_transform_constraint_create(data._ptr.assumingMemoryBound(to: spine_transform_constraint_data_wrapper.self), skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self))
|
||||
self.init(fromPointer: ptr!)
|
||||
}
|
||||
|
||||
@ -61,14 +59,12 @@ public class TransformConstraint: TransformConstraintBase {
|
||||
return Bone(fromPointer: result!)
|
||||
}
|
||||
set {
|
||||
spine_transform_constraint_set_source(
|
||||
_ptr.assumingMemoryBound(to: spine_transform_constraint_wrapper.self), newValue._ptr.assumingMemoryBound(to: spine_bone_wrapper.self))
|
||||
spine_transform_constraint_set_source(_ptr.assumingMemoryBound(to: spine_transform_constraint_wrapper.self), newValue._ptr.assumingMemoryBound(to: spine_bone_wrapper.self))
|
||||
}
|
||||
}
|
||||
|
||||
public func copyAttachment(_ skeleton: Skeleton) -> TransformConstraint {
|
||||
let result = spine_transform_constraint_copy(
|
||||
_ptr.assumingMemoryBound(to: spine_transform_constraint_wrapper.self), skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self))
|
||||
let result = spine_transform_constraint_copy(_ptr.assumingMemoryBound(to: spine_transform_constraint_wrapper.self), skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self))
|
||||
return TransformConstraint(fromPointer: result!)
|
||||
}
|
||||
|
||||
|
||||
@ -57,8 +57,7 @@ open class TransformConstraintBase: PosedActive, Posed, Constraint {
|
||||
}
|
||||
|
||||
public var isPoseEqualToApplied: Bool {
|
||||
let result = spine_transform_constraint_base_is_pose_equal_to_applied(
|
||||
_ptr.assumingMemoryBound(to: spine_transform_constraint_base_wrapper.self))
|
||||
let result = spine_transform_constraint_base_is_pose_equal_to_applied(_ptr.assumingMemoryBound(to: spine_transform_constraint_base_wrapper.self))
|
||||
return result
|
||||
}
|
||||
|
||||
@ -81,16 +80,12 @@ open class TransformConstraintBase: PosedActive, Posed, Constraint {
|
||||
}
|
||||
|
||||
public func sort(_ skeleton: Skeleton) {
|
||||
spine_transform_constraint_base_sort(
|
||||
_ptr.assumingMemoryBound(to: spine_transform_constraint_base_wrapper.self),
|
||||
skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self))
|
||||
spine_transform_constraint_base_sort(_ptr.assumingMemoryBound(to: spine_transform_constraint_base_wrapper.self), skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self))
|
||||
}
|
||||
|
||||
/// Inherited from Update
|
||||
public func update(_ skeleton: Skeleton, _ physics: Physics) {
|
||||
spine_transform_constraint_base_update(
|
||||
_ptr.assumingMemoryBound(to: spine_transform_constraint_base_wrapper.self),
|
||||
skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self), spine_physics(rawValue: UInt32(physics.rawValue)))
|
||||
spine_transform_constraint_base_update(_ptr.assumingMemoryBound(to: spine_transform_constraint_base_wrapper.self), skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self), spine_physics(rawValue: UInt32(physics.rawValue)))
|
||||
}
|
||||
|
||||
public static func rttiStatic() -> Rtti {
|
||||
|
||||
@ -67,17 +67,14 @@ public class TransformConstraintData: PosedData, ConstraintData {
|
||||
return BoneData(fromPointer: result!)
|
||||
}
|
||||
set {
|
||||
spine_transform_constraint_data_set_source(
|
||||
_ptr.assumingMemoryBound(to: spine_transform_constraint_data_wrapper.self),
|
||||
newValue._ptr.assumingMemoryBound(to: spine_bone_data_wrapper.self))
|
||||
spine_transform_constraint_data_set_source(_ptr.assumingMemoryBound(to: spine_transform_constraint_data_wrapper.self), newValue._ptr.assumingMemoryBound(to: spine_bone_data_wrapper.self))
|
||||
}
|
||||
}
|
||||
|
||||
/// An offset added to the constrained bone rotation.
|
||||
public var offsetRotation: Float {
|
||||
get {
|
||||
let result = spine_transform_constraint_data_get_offset_rotation(
|
||||
_ptr.assumingMemoryBound(to: spine_transform_constraint_data_wrapper.self))
|
||||
let result = spine_transform_constraint_data_get_offset_rotation(_ptr.assumingMemoryBound(to: spine_transform_constraint_data_wrapper.self))
|
||||
return result
|
||||
}
|
||||
set {
|
||||
@ -110,8 +107,7 @@ public class TransformConstraintData: PosedData, ConstraintData {
|
||||
/// An offset added to the constrained bone scaleX.
|
||||
public var offsetScaleX: Float {
|
||||
get {
|
||||
let result = spine_transform_constraint_data_get_offset_scale_x(
|
||||
_ptr.assumingMemoryBound(to: spine_transform_constraint_data_wrapper.self))
|
||||
let result = spine_transform_constraint_data_get_offset_scale_x(_ptr.assumingMemoryBound(to: spine_transform_constraint_data_wrapper.self))
|
||||
return result
|
||||
}
|
||||
set {
|
||||
@ -122,8 +118,7 @@ public class TransformConstraintData: PosedData, ConstraintData {
|
||||
/// An offset added to the constrained bone scaleY.
|
||||
public var offsetScaleY: Float {
|
||||
get {
|
||||
let result = spine_transform_constraint_data_get_offset_scale_y(
|
||||
_ptr.assumingMemoryBound(to: spine_transform_constraint_data_wrapper.self))
|
||||
let result = spine_transform_constraint_data_get_offset_scale_y(_ptr.assumingMemoryBound(to: spine_transform_constraint_data_wrapper.self))
|
||||
return result
|
||||
}
|
||||
set {
|
||||
@ -134,8 +129,7 @@ public class TransformConstraintData: PosedData, ConstraintData {
|
||||
/// An offset added to the constrained bone shearY.
|
||||
public var offsetShearY: Float {
|
||||
get {
|
||||
let result = spine_transform_constraint_data_get_offset_shear_y(
|
||||
_ptr.assumingMemoryBound(to: spine_transform_constraint_data_wrapper.self))
|
||||
let result = spine_transform_constraint_data_get_offset_shear_y(_ptr.assumingMemoryBound(to: spine_transform_constraint_data_wrapper.self))
|
||||
return result
|
||||
}
|
||||
set {
|
||||
@ -199,9 +193,7 @@ public class TransformConstraintData: PosedData, ConstraintData {
|
||||
}
|
||||
|
||||
public func createMethod(_ skeleton: Skeleton) -> Constraint {
|
||||
let result = spine_transform_constraint_data_create_method(
|
||||
_ptr.assumingMemoryBound(to: spine_transform_constraint_data_wrapper.self),
|
||||
skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self))
|
||||
let result = spine_transform_constraint_data_create_method(_ptr.assumingMemoryBound(to: spine_transform_constraint_data_wrapper.self), skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self))
|
||||
let rtti = spine_constraint_get_rtti(result!)
|
||||
let rttiClassName = String(cString: spine_rtti_get_class_name(rtti)!)
|
||||
switch rttiClassName {
|
||||
|
||||
@ -117,9 +117,7 @@ public class TransformConstraintPose: NSObject {
|
||||
}
|
||||
|
||||
public func set(_ pose: TransformConstraintPose) {
|
||||
spine_transform_constraint_pose_set(
|
||||
_ptr.assumingMemoryBound(to: spine_transform_constraint_pose_wrapper.self),
|
||||
pose._ptr.assumingMemoryBound(to: spine_transform_constraint_pose_wrapper.self))
|
||||
spine_transform_constraint_pose_set(_ptr.assumingMemoryBound(to: spine_transform_constraint_pose_wrapper.self), pose._ptr.assumingMemoryBound(to: spine_transform_constraint_pose_wrapper.self))
|
||||
}
|
||||
|
||||
public func dispose() {
|
||||
|
||||
@ -51,13 +51,11 @@ public class TransformConstraintTimeline: CurveTimeline, ConstraintTimeline {
|
||||
|
||||
public var constraintIndex: Int32 {
|
||||
get {
|
||||
let result = spine_transform_constraint_timeline_get_constraint_index(
|
||||
_ptr.assumingMemoryBound(to: spine_transform_constraint_timeline_wrapper.self))
|
||||
let result = spine_transform_constraint_timeline_get_constraint_index(_ptr.assumingMemoryBound(to: spine_transform_constraint_timeline_wrapper.self))
|
||||
return result
|
||||
}
|
||||
set {
|
||||
spine_transform_constraint_timeline_set_constraint_index(
|
||||
_ptr.assumingMemoryBound(to: spine_transform_constraint_timeline_wrapper.self), newValue)
|
||||
spine_transform_constraint_timeline_set_constraint_index(_ptr.assumingMemoryBound(to: spine_transform_constraint_timeline_wrapper.self), newValue)
|
||||
}
|
||||
}
|
||||
|
||||
@ -65,12 +63,8 @@ public class TransformConstraintTimeline: CurveTimeline, ConstraintTimeline {
|
||||
///
|
||||
/// - Parameter frame: Between 0 and frameCount, inclusive.
|
||||
/// - Parameter time: The frame time in seconds.
|
||||
public func setFrame(
|
||||
_ frame: Int32, _ time: Float, _ mixRotate: Float, _ mixX: Float, _ mixY: Float, _ mixScaleX: Float, _ mixScaleY: Float, _ mixShearY: Float
|
||||
) {
|
||||
spine_transform_constraint_timeline_set_frame(
|
||||
_ptr.assumingMemoryBound(to: spine_transform_constraint_timeline_wrapper.self), frame, time, mixRotate, mixX, mixY, mixScaleX, mixScaleY,
|
||||
mixShearY)
|
||||
public func setFrame(_ frame: Int32, _ time: Float, _ mixRotate: Float, _ mixX: Float, _ mixY: Float, _ mixScaleX: Float, _ mixScaleY: Float, _ mixShearY: Float) {
|
||||
spine_transform_constraint_timeline_set_frame(_ptr.assumingMemoryBound(to: spine_transform_constraint_timeline_wrapper.self), frame, time, mixRotate, mixX, mixY, mixScaleX, mixScaleY, mixShearY)
|
||||
}
|
||||
|
||||
public func dispose() {
|
||||
|
||||
@ -54,9 +54,7 @@ open class VertexAttachment: Attachment {
|
||||
return ArrayInt(fromPointer: result!)
|
||||
}
|
||||
set {
|
||||
spine_vertex_attachment_set_bones(
|
||||
_ptr.assumingMemoryBound(to: spine_vertex_attachment_wrapper.self),
|
||||
newValue._ptr.assumingMemoryBound(to: spine_array_int_wrapper.self))
|
||||
spine_vertex_attachment_set_bones(_ptr.assumingMemoryBound(to: spine_vertex_attachment_wrapper.self), newValue._ptr.assumingMemoryBound(to: spine_array_int_wrapper.self))
|
||||
}
|
||||
}
|
||||
|
||||
@ -66,9 +64,7 @@ open class VertexAttachment: Attachment {
|
||||
return ArrayFloat(fromPointer: result!)
|
||||
}
|
||||
set {
|
||||
spine_vertex_attachment_set_vertices(
|
||||
_ptr.assumingMemoryBound(to: spine_vertex_attachment_wrapper.self),
|
||||
newValue._ptr.assumingMemoryBound(to: spine_array_float_wrapper.self))
|
||||
spine_vertex_attachment_set_vertices(_ptr.assumingMemoryBound(to: spine_vertex_attachment_wrapper.self), newValue._ptr.assumingMemoryBound(to: spine_array_float_wrapper.self))
|
||||
}
|
||||
}
|
||||
|
||||
@ -112,25 +108,16 @@ open class VertexAttachment: Attachment {
|
||||
}
|
||||
}
|
||||
set {
|
||||
spine_vertex_attachment_set_timeline_attachment(
|
||||
_ptr.assumingMemoryBound(to: spine_vertex_attachment_wrapper.self),
|
||||
newValue?._ptr.assumingMemoryBound(to: spine_attachment_wrapper.self))
|
||||
spine_vertex_attachment_set_timeline_attachment(_ptr.assumingMemoryBound(to: spine_vertex_attachment_wrapper.self), newValue?._ptr.assumingMemoryBound(to: spine_attachment_wrapper.self))
|
||||
}
|
||||
}
|
||||
|
||||
public func copyTo(_ other: VertexAttachment) {
|
||||
spine_vertex_attachment_copy_to(
|
||||
_ptr.assumingMemoryBound(to: spine_vertex_attachment_wrapper.self),
|
||||
other._ptr.assumingMemoryBound(to: spine_vertex_attachment_wrapper.self))
|
||||
spine_vertex_attachment_copy_to(_ptr.assumingMemoryBound(to: spine_vertex_attachment_wrapper.self), other._ptr.assumingMemoryBound(to: spine_vertex_attachment_wrapper.self))
|
||||
}
|
||||
|
||||
public func computeWorldVertices(
|
||||
_ skeleton: Skeleton, _ slot: Slot, _ start: Int, _ count: Int, _ worldVertices: ArrayFloat, _ offset: Int, _ stride: Int
|
||||
) {
|
||||
spine_vertex_attachment_compute_world_vertices_2(
|
||||
_ptr.assumingMemoryBound(to: spine_vertex_attachment_wrapper.self), skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self),
|
||||
slot._ptr.assumingMemoryBound(to: spine_slot_wrapper.self), start, count,
|
||||
worldVertices._ptr.assumingMemoryBound(to: spine_array_float_wrapper.self), offset, stride)
|
||||
public func computeWorldVertices(_ skeleton: Skeleton, _ slot: Slot, _ start: Int, _ count: Int, _ worldVertices: ArrayFloat, _ offset: Int, _ stride: Int) {
|
||||
spine_vertex_attachment_compute_world_vertices_2(_ptr.assumingMemoryBound(to: spine_vertex_attachment_wrapper.self), skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self), slot._ptr.assumingMemoryBound(to: spine_slot_wrapper.self), start, count, worldVertices._ptr.assumingMemoryBound(to: spine_array_float_wrapper.self), offset, stride)
|
||||
}
|
||||
|
||||
}
|
||||
@ -48,8 +48,9 @@ import Foundation
|
||||
backgroundColor: UIColor,
|
||||
scaleFactor: CGFloat = 1
|
||||
) throws -> CGImage? {
|
||||
let controller = SpineController(disposeDrawableOnDeInit: false) // Doesn't own the drawable
|
||||
let spineView = SpineUIView(
|
||||
controller: SpineController(disposeDrawableOnDeInit: false), // Doesn't own the drawable
|
||||
controller: controller,
|
||||
boundsProvider: boundsProvider,
|
||||
backgroundColor: backgroundColor
|
||||
)
|
||||
@ -59,6 +60,12 @@ import Foundation
|
||||
spineView.framebufferOnly = false
|
||||
spineView.contentScaleFactor = scaleFactor
|
||||
|
||||
defer {
|
||||
controller.drawable = nil
|
||||
spineView.delegate = nil
|
||||
spineView.renderer = nil
|
||||
}
|
||||
|
||||
try spineView.load(drawable: self)
|
||||
spineView.renderer?.waitUntilCompleted = true
|
||||
|
||||
|
||||
440
spine-ios/codegen/package-lock.json
generated
440
spine-ios/codegen/package-lock.json
generated
@ -25,6 +25,74 @@
|
||||
"typescript-formatter": "^7.2.2"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/aix-ppc64": {
|
||||
"version": "0.25.8",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.25.8.tgz",
|
||||
"integrity": "sha512-urAvrUedIqEiFR3FYSLTWQgLu5tb+m0qZw0NBEasUeo6wuqatkMDaRT+1uABiGXEu5vqgPd7FGE1BhsAIy9QVA==",
|
||||
"cpu": [
|
||||
"ppc64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"aix"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/android-arm": {
|
||||
"version": "0.25.8",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.25.8.tgz",
|
||||
"integrity": "sha512-RONsAvGCz5oWyePVnLdZY/HHwA++nxYWIX1atInlaW6SEkwq6XkP3+cb825EUcRs5Vss/lGh/2YxAb5xqc07Uw==",
|
||||
"cpu": [
|
||||
"arm"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"android"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/android-arm64": {
|
||||
"version": "0.25.8",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.25.8.tgz",
|
||||
"integrity": "sha512-OD3p7LYzWpLhZEyATcTSJ67qB5D+20vbtr6vHlHWSQYhKtzUYrETuWThmzFpZtFsBIxRvhO07+UgVA9m0i/O1w==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"android"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/android-x64": {
|
||||
"version": "0.25.8",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.25.8.tgz",
|
||||
"integrity": "sha512-yJAVPklM5+4+9dTeKwHOaA+LQkmrKFX96BM0A/2zQrbS6ENCmxc4OVoBs5dPkCCak2roAD+jKCdnmOqKszPkjA==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"android"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/darwin-arm64": {
|
||||
"version": "0.25.8",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.25.8.tgz",
|
||||
@ -42,6 +110,363 @@
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/darwin-x64": {
|
||||
"version": "0.25.8",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.25.8.tgz",
|
||||
"integrity": "sha512-Vh2gLxxHnuoQ+GjPNvDSDRpoBCUzY4Pu0kBqMBDlK4fuWbKgGtmDIeEC081xi26PPjn+1tct+Bh8FjyLlw1Zlg==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"darwin"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/freebsd-arm64": {
|
||||
"version": "0.25.8",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.25.8.tgz",
|
||||
"integrity": "sha512-YPJ7hDQ9DnNe5vxOm6jaie9QsTwcKedPvizTVlqWG9GBSq+BuyWEDazlGaDTC5NGU4QJd666V0yqCBL2oWKPfA==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"freebsd"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/freebsd-x64": {
|
||||
"version": "0.25.8",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.25.8.tgz",
|
||||
"integrity": "sha512-MmaEXxQRdXNFsRN/KcIimLnSJrk2r5H8v+WVafRWz5xdSVmWLoITZQXcgehI2ZE6gioE6HirAEToM/RvFBeuhw==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"freebsd"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/linux-arm": {
|
||||
"version": "0.25.8",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.25.8.tgz",
|
||||
"integrity": "sha512-FuzEP9BixzZohl1kLf76KEVOsxtIBFwCaLupVuk4eFVnOZfU+Wsn+x5Ryam7nILV2pkq2TqQM9EZPsOBuMC+kg==",
|
||||
"cpu": [
|
||||
"arm"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/linux-arm64": {
|
||||
"version": "0.25.8",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.25.8.tgz",
|
||||
"integrity": "sha512-WIgg00ARWv/uYLU7lsuDK00d/hHSfES5BzdWAdAig1ioV5kaFNrtK8EqGcUBJhYqotlUByUKz5Qo6u8tt7iD/w==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/linux-ia32": {
|
||||
"version": "0.25.8",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.25.8.tgz",
|
||||
"integrity": "sha512-A1D9YzRX1i+1AJZuFFUMP1E9fMaYY+GnSQil9Tlw05utlE86EKTUA7RjwHDkEitmLYiFsRd9HwKBPEftNdBfjg==",
|
||||
"cpu": [
|
||||
"ia32"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/linux-loong64": {
|
||||
"version": "0.25.8",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.25.8.tgz",
|
||||
"integrity": "sha512-O7k1J/dwHkY1RMVvglFHl1HzutGEFFZ3kNiDMSOyUrB7WcoHGf96Sh+64nTRT26l3GMbCW01Ekh/ThKM5iI7hQ==",
|
||||
"cpu": [
|
||||
"loong64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/linux-mips64el": {
|
||||
"version": "0.25.8",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.25.8.tgz",
|
||||
"integrity": "sha512-uv+dqfRazte3BzfMp8PAQXmdGHQt2oC/y2ovwpTteqrMx2lwaksiFZ/bdkXJC19ttTvNXBuWH53zy/aTj1FgGw==",
|
||||
"cpu": [
|
||||
"mips64el"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/linux-ppc64": {
|
||||
"version": "0.25.8",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.25.8.tgz",
|
||||
"integrity": "sha512-GyG0KcMi1GBavP5JgAkkstMGyMholMDybAf8wF5A70CALlDM2p/f7YFE7H92eDeH/VBtFJA5MT4nRPDGg4JuzQ==",
|
||||
"cpu": [
|
||||
"ppc64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/linux-riscv64": {
|
||||
"version": "0.25.8",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.25.8.tgz",
|
||||
"integrity": "sha512-rAqDYFv3yzMrq7GIcen3XP7TUEG/4LK86LUPMIz6RT8A6pRIDn0sDcvjudVZBiiTcZCY9y2SgYX2lgK3AF+1eg==",
|
||||
"cpu": [
|
||||
"riscv64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/linux-s390x": {
|
||||
"version": "0.25.8",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.25.8.tgz",
|
||||
"integrity": "sha512-Xutvh6VjlbcHpsIIbwY8GVRbwoviWT19tFhgdA7DlenLGC/mbc3lBoVb7jxj9Z+eyGqvcnSyIltYUrkKzWqSvg==",
|
||||
"cpu": [
|
||||
"s390x"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/linux-x64": {
|
||||
"version": "0.25.8",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.25.8.tgz",
|
||||
"integrity": "sha512-ASFQhgY4ElXh3nDcOMTkQero4b1lgubskNlhIfJrsH5OKZXDpUAKBlNS0Kx81jwOBp+HCeZqmoJuihTv57/jvQ==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/netbsd-arm64": {
|
||||
"version": "0.25.8",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.25.8.tgz",
|
||||
"integrity": "sha512-d1KfruIeohqAi6SA+gENMuObDbEjn22olAR7egqnkCD9DGBG0wsEARotkLgXDu6c4ncgWTZJtN5vcgxzWRMzcw==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"netbsd"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/netbsd-x64": {
|
||||
"version": "0.25.8",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.25.8.tgz",
|
||||
"integrity": "sha512-nVDCkrvx2ua+XQNyfrujIG38+YGyuy2Ru9kKVNyh5jAys6n+l44tTtToqHjino2My8VAY6Lw9H7RI73XFi66Cg==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"netbsd"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/openbsd-arm64": {
|
||||
"version": "0.25.8",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.25.8.tgz",
|
||||
"integrity": "sha512-j8HgrDuSJFAujkivSMSfPQSAa5Fxbvk4rgNAS5i3K+r8s1X0p1uOO2Hl2xNsGFppOeHOLAVgYwDVlmxhq5h+SQ==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"openbsd"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/openbsd-x64": {
|
||||
"version": "0.25.8",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.25.8.tgz",
|
||||
"integrity": "sha512-1h8MUAwa0VhNCDp6Af0HToI2TJFAn1uqT9Al6DJVzdIBAd21m/G0Yfc77KDM3uF3T/YaOgQq3qTJHPbTOInaIQ==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"openbsd"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/openharmony-arm64": {
|
||||
"version": "0.25.8",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.25.8.tgz",
|
||||
"integrity": "sha512-r2nVa5SIK9tSWd0kJd9HCffnDHKchTGikb//9c7HX+r+wHYCpQrSgxhlY6KWV1nFo1l4KFbsMlHk+L6fekLsUg==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"openharmony"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/sunos-x64": {
|
||||
"version": "0.25.8",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.25.8.tgz",
|
||||
"integrity": "sha512-zUlaP2S12YhQ2UzUfcCuMDHQFJyKABkAjvO5YSndMiIkMimPmxA+BYSBikWgsRpvyxuRnow4nS5NPnf9fpv41w==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"sunos"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/win32-arm64": {
|
||||
"version": "0.25.8",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.25.8.tgz",
|
||||
"integrity": "sha512-YEGFFWESlPva8hGL+zvj2z/SaK+pH0SwOM0Nc/d+rVnW7GSTFlLBGzZkuSU9kFIGIo8q9X3ucpZhu8PDN5A2sQ==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"win32"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/win32-ia32": {
|
||||
"version": "0.25.8",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.25.8.tgz",
|
||||
"integrity": "sha512-hiGgGC6KZ5LZz58OL/+qVVoZiuZlUYlYHNAmczOm7bs2oE1XriPFi5ZHHrS8ACpV5EjySrnoCKmcbQMN+ojnHg==",
|
||||
"cpu": [
|
||||
"ia32"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"win32"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/win32-x64": {
|
||||
"version": "0.25.8",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.25.8.tgz",
|
||||
"integrity": "sha512-cn3Yr7+OaaZq1c+2pe+8yxC8E144SReCQjN6/2ynubzYjvyqZjTXfQJpAcQpsdJq3My7XADANiYGHoFC69pLQw==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"win32"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/node": {
|
||||
"version": "20.19.9",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.19.9.tgz",
|
||||
@ -94,6 +519,21 @@
|
||||
"@esbuild/win32-x64": "0.25.8"
|
||||
}
|
||||
},
|
||||
"node_modules/fsevents": {
|
||||
"version": "2.3.3",
|
||||
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",
|
||||
"integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",
|
||||
"dev": true,
|
||||
"hasInstallScript": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"darwin"
|
||||
],
|
||||
"engines": {
|
||||
"node": "^8.16.0 || ^10.6.0 || >=11.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/get-tsconfig": {
|
||||
"version": "4.10.1",
|
||||
"resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.10.1.tgz",
|
||||
|
||||
@ -4,8 +4,8 @@ import SpineC
|
||||
func runSkeletonDrawableTest() {
|
||||
print("Testing SkeletonDrawable and event listeners...")
|
||||
|
||||
// Enable debug extension if needed
|
||||
spine_enable_debug_extension(false)
|
||||
// Enable debug extension for leak detection
|
||||
spine_enable_debug_extension(true)
|
||||
|
||||
// Load atlas and skeleton data
|
||||
let atlasPath = "../../spine-ts/assets/spineboy.atlas"
|
||||
|
||||
@ -5,10 +5,11 @@ func runSkeletonDrawableTestSwift() {
|
||||
print("Testing SkeletonDrawable with SpineSwift API...")
|
||||
|
||||
print("Step 1: Enable debug extension")
|
||||
// Enable debug extension if needed
|
||||
enableDebugExtension(false)
|
||||
// Enable debug extension for leak detection
|
||||
enableDebugExtension(true)
|
||||
print(" Debug extension configured")
|
||||
|
||||
do {
|
||||
print("Step 2: Load file paths")
|
||||
// Load atlas and skeleton data
|
||||
let atlasPath = "../../spine-ts/assets/spineboy.atlas"
|
||||
@ -51,6 +52,7 @@ func runSkeletonDrawableTestSwift() {
|
||||
return
|
||||
}
|
||||
|
||||
do {
|
||||
// Create skeleton drawable
|
||||
let drawable = SkeletonDrawable(skeletonData: skeletonData)
|
||||
print("✓ SkeletonDrawable created successfully")
|
||||
@ -305,14 +307,16 @@ func runSkeletonDrawableTestSwift() {
|
||||
|
||||
// Clear listener before cleanup
|
||||
// drawable.animationState.setListener(nil)
|
||||
}
|
||||
|
||||
// Cleanup happens automatically via deinit
|
||||
// skeletonData and atlas will be freed when out of scope
|
||||
|
||||
// Report memory leaks if debug extension is enabled
|
||||
reportLeaks()
|
||||
skeletonData.dispose()
|
||||
atlas.dispose()
|
||||
|
||||
print("\n✓ SpineSwift API test complete")
|
||||
}
|
||||
|
||||
// Report memory leaks after Swift objects have gone out of scope
|
||||
reportLeaks()
|
||||
}
|
||||
|
||||
// Test function is called from main.swift
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user