Bone.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /******************************************************************************
  2. * Spine Runtimes Software License
  3. * Version 2
  4. *
  5. * Copyright (c) 2013, Esoteric Software
  6. * All rights reserved.
  7. *
  8. * You are granted a perpetual, non-exclusive, non-sublicensable and
  9. * non-transferable license to install, execute and perform the Spine Runtimes
  10. * Software (the "Software") solely for internal use. Without the written
  11. * permission of Esoteric Software, you may not (a) modify, translate, adapt or
  12. * otherwise create derivative works, improvements of the Software or develop
  13. * new applications using the Software or (b) remove, delete, alter or obscure
  14. * any trademarks or any copyright, trademark, patent or other intellectual
  15. * property or proprietary rights notices on or in the Software, including
  16. * any copy thereof. Redistributions in binary or source form must include
  17. * this license and terms. THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE
  18. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  19. * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  20. * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTARE BE LIABLE FOR ANY
  21. * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  22. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  23. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  24. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  25. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  26. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  27. *****************************************************************************/
  28. #ifndef SPINE_BONE_H_
  29. #define SPINE_BONE_H_
  30. #include <spine/BoneData.h>
  31. #ifdef __cplusplus
  32. extern "C" {
  33. #endif
  34. typedef struct spBone spBone;
  35. struct spBone {
  36. spBoneData* const data;
  37. spBone* const parent;
  38. float x, y;
  39. float rotation;
  40. float scaleX, scaleY;
  41. float const m00, m01, worldX; /* a b x */
  42. float const m10, m11, worldY; /* c d y */
  43. float const worldRotation;
  44. float const worldScaleX, worldScaleY;
  45. };
  46. void spBone_setYDown (int/*bool*/yDown);
  47. /* @param parent May be 0. */
  48. spBone* spBone_create (spBoneData* data, spBone* parent);
  49. void spBone_dispose (spBone* self);
  50. void spBone_setToSetupPose (spBone* self);
  51. void spBone_updateWorldTransform (spBone* self, int/*bool*/flipX, int/*bool*/flipY);
  52. #ifdef SPINE_SHORT_NAMES
  53. typedef spBone Bone;
  54. #define Bone_setYDown(...) spBone_setYDown(__VA_ARGS__)
  55. #define Bone_create(...) spBone_create(__VA_ARGS__)
  56. #define Bone_dispose(...) spBone_dispose(__VA_ARGS__)
  57. #define Bone_setToSetupPose(...) spBone_setToSetupPose(__VA_ARGS__)
  58. #define Bone_updateWorldTransform(...) spBone_updateWorldTransform(__VA_ARGS__)
  59. #endif
  60. #ifdef __cplusplus
  61. }
  62. #endif
  63. #endif /* SPINE_BONE_H_ */