sequence_timeline.dart 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. //
  2. // Spine Runtimes License Agreement
  3. // Last updated April 5, 2025. Replaces all prior versions.
  4. //
  5. // Copyright (c) 2013-2025, Esoteric Software LLC
  6. //
  7. // Integration of the Spine Runtimes into software or otherwise creating
  8. // derivative works of the Spine Runtimes is permitted under the terms and
  9. // conditions of Section 2 of the Spine Editor License Agreement:
  10. // http://esotericsoftware.com/spine-editor-license
  11. //
  12. // Otherwise, it is permitted to integrate the Spine Runtimes into software
  13. // or otherwise create derivative works of the Spine Runtimes (collectively,
  14. // "Products"), provided that each user of the Products must obtain their own
  15. // Spine Editor license and redistribution of the Products in any form must
  16. // include this license and copyright notice.
  17. //
  18. // THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
  19. // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  20. // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  21. // DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
  22. // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  23. // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
  24. // BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
  25. // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  26. // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  27. // THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  28. //
  29. // AUTO GENERATED FILE, DO NOT EDIT.
  30. import 'dart:ffi';
  31. import 'package:ffi/ffi.dart';
  32. import 'spine_dart_bindings_generated.dart';
  33. import '../spine_bindings.dart';
  34. import 'attachment.dart';
  35. import 'bounding_box_attachment.dart';
  36. import 'clipping_attachment.dart';
  37. import 'mesh_attachment.dart';
  38. import 'path_attachment.dart';
  39. import 'point_attachment.dart';
  40. import 'region_attachment.dart';
  41. import 'sequence_mode.dart';
  42. import 'slot_timeline.dart';
  43. import 'timeline.dart';
  44. /// SequenceTimeline wrapper
  45. class SequenceTimeline extends Timeline implements SlotTimeline {
  46. final Pointer<spine_sequence_timeline_wrapper> _ptr;
  47. SequenceTimeline.fromPointer(this._ptr) : super.fromPointer(_ptr.cast());
  48. /// Get the native pointer for FFI calls
  49. @override
  50. Pointer get nativePtr => _ptr;
  51. factory SequenceTimeline(int frameCount, int slotIndex, Attachment attachment) {
  52. final ptr =
  53. SpineBindings.bindings.spine_sequence_timeline_create(frameCount, slotIndex, attachment.nativePtr.cast());
  54. return SequenceTimeline.fromPointer(ptr);
  55. }
  56. void dispose() {
  57. SpineBindings.bindings.spine_sequence_timeline_dispose(_ptr);
  58. }
  59. void setFrame(int frame, double time, SequenceMode mode, int index, double delay) {
  60. SpineBindings.bindings.spine_sequence_timeline_set_frame(_ptr, frame, time, mode.value, index, delay);
  61. }
  62. Attachment get attachment {
  63. final result = SpineBindings.bindings.spine_sequence_timeline_get_attachment(_ptr);
  64. final rtti = SpineBindings.bindings.spine_attachment_get_rtti(result);
  65. final className = SpineBindings.bindings.spine_rtti_get_class_name(rtti).cast<Utf8>().toDartString();
  66. switch (className) {
  67. case 'spine_bounding_box_attachment':
  68. return BoundingBoxAttachment.fromPointer(result.cast());
  69. case 'spine_clipping_attachment':
  70. return ClippingAttachment.fromPointer(result.cast());
  71. case 'spine_mesh_attachment':
  72. return MeshAttachment.fromPointer(result.cast());
  73. case 'spine_path_attachment':
  74. return PathAttachment.fromPointer(result.cast());
  75. case 'spine_point_attachment':
  76. return PointAttachment.fromPointer(result.cast());
  77. case 'spine_region_attachment':
  78. return RegionAttachment.fromPointer(result.cast());
  79. default:
  80. throw UnsupportedError('Unknown concrete type: $className for abstract class Attachment');
  81. }
  82. }
  83. @override
  84. int get slotIndex {
  85. final result = SpineBindings.bindings.spine_sequence_timeline_get_slot_index(_ptr);
  86. return result;
  87. }
  88. @override
  89. set slotIndex(int value) {
  90. SpineBindings.bindings.spine_sequence_timeline_set_slot_index(_ptr, value);
  91. }
  92. }