From 35d84fff30f1e4e7c54e3923fc909a4f616a97f1 Mon Sep 17 00:00:00 2001 From: Stephen Gowen Date: Mon, 2 Oct 2017 17:23:50 -0400 Subject: [PATCH] wip --- spine-cpp/spine-cpp/include/spine/BlendMode.h | 8 +- .../spine-cpp/include/spine/Constraint.h | 49 +++++ spine-cpp/spine-cpp/include/spine/Event.h | 71 +++++++ spine-cpp/spine-cpp/include/spine/EventData.h | 68 +++++++ .../include/spine/IkConstraintData.h | 6 +- .../include/spine/PathConstraintData.h | 100 ++++++++++ .../spine-cpp/include/spine/PositionMode.h | 43 +++++ .../spine-cpp/include/spine/RotateMode.h | 44 +++++ spine-cpp/spine-cpp/include/spine/SlotData.h | 92 +++++++++ .../spine-cpp/include/spine/SpacingMode.h | 44 +++++ .../spine-cpp/include/spine/TransformMode.h | 10 +- spine-cpp/spine-cpp/src/spine/BoneData.cpp | 3 +- spine-cpp/spine-cpp/src/spine/Event.cpp | 93 +++++++++ spine-cpp/spine-cpp/src/spine/EventData.cpp | 88 +++++++++ .../spine-cpp/src/spine/IkConstraintData.cpp | 2 +- .../src/spine/PathConstraintData.cpp | 172 +++++++++++++++++ spine-cpp/spine-cpp/src/spine/SlotData.cpp | 177 ++++++++++++++++++ 17 files changed, 1056 insertions(+), 14 deletions(-) create mode 100644 spine-cpp/spine-cpp/include/spine/Constraint.h create mode 100644 spine-cpp/spine-cpp/include/spine/Event.h create mode 100644 spine-cpp/spine-cpp/include/spine/EventData.h create mode 100644 spine-cpp/spine-cpp/include/spine/PathConstraintData.h create mode 100644 spine-cpp/spine-cpp/include/spine/PositionMode.h create mode 100644 spine-cpp/spine-cpp/include/spine/RotateMode.h create mode 100644 spine-cpp/spine-cpp/include/spine/SlotData.h create mode 100644 spine-cpp/spine-cpp/include/spine/SpacingMode.h create mode 100644 spine-cpp/spine-cpp/src/spine/Event.cpp create mode 100644 spine-cpp/spine-cpp/src/spine/EventData.cpp create mode 100644 spine-cpp/spine-cpp/src/spine/PathConstraintData.cpp create mode 100644 spine-cpp/spine-cpp/src/spine/SlotData.cpp diff --git a/spine-cpp/spine-cpp/include/spine/BlendMode.h b/spine-cpp/spine-cpp/include/spine/BlendMode.h index 13ee4a0c2..0f0afa645 100644 --- a/spine-cpp/spine-cpp/include/spine/BlendMode.h +++ b/spine-cpp/spine-cpp/include/spine/BlendMode.h @@ -35,10 +35,10 @@ namespace Spine { enum BlendMode { - Normal = 0, - Additive, - Multiply, - Screen + BlendMode_Normal = 0, + BlendMode_Additive, + BlendMode_Multiply, + BlendMode_Screen }; } diff --git a/spine-cpp/spine-cpp/include/spine/Constraint.h b/spine-cpp/spine-cpp/include/spine/Constraint.h new file mode 100644 index 000000000..50d7d0977 --- /dev/null +++ b/spine-cpp/spine-cpp/include/spine/Constraint.h @@ -0,0 +1,49 @@ +/****************************************************************************** + * Spine Runtimes Software License v2.5 + * + * Copyright (c) 2013-2016, Esoteric Software + * All rights reserved. + * + * You are granted a perpetual, non-exclusive, non-sublicensable, and + * non-transferable license to use, install, execute, and perform the Spine + * Runtimes software and derivative works solely for personal or internal + * use. Without the written permission of Esoteric Software (see Section 2 of + * the Spine Software License Agreement), you may not (a) modify, translate, + * adapt, or develop new applications using the Spine Runtimes or otherwise + * create derivative works or improvements of the Spine Runtimes or (b) remove, + * delete, alter, or obscure any trademarks or any copyright, trademark, patent, + * or other intellectual property or proprietary rights notices on or in the + * Software, including any copy thereof. Redistributions in binary or source + * form must include this license and terms. + * + * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF + * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *****************************************************************************/ + +#ifndef Spine_Constraint_h +#define Spine_Constraint_h + +namespace Spine +{ + /// The interface for all constraints. + class Constraint : public Updatable + { + public: + Constraint(); + + virtual Constraint(); + + /// The ordinal for the order a skeleton's constraints will be applied. + virtual int getOrder() = 0; + }; +} + +#endif /* Spine_Constraint_h */ diff --git a/spine-cpp/spine-cpp/include/spine/Event.h b/spine-cpp/spine-cpp/include/spine/Event.h new file mode 100644 index 000000000..37d1acd6a --- /dev/null +++ b/spine-cpp/spine-cpp/include/spine/Event.h @@ -0,0 +1,71 @@ +/****************************************************************************** + * Spine Runtimes Software License v2.5 + * + * Copyright (c) 2013-2016, Esoteric Software + * All rights reserved. + * + * You are granted a perpetual, non-exclusive, non-sublicensable, and + * non-transferable license to use, install, execute, and perform the Spine + * Runtimes software and derivative works solely for personal or internal + * use. Without the written permission of Esoteric Software (see Section 2 of + * the Spine Software License Agreement), you may not (a) modify, translate, + * adapt, or develop new applications using the Spine Runtimes or otherwise + * create derivative works or improvements of the Spine Runtimes or (b) remove, + * delete, alter, or obscure any trademarks or any copyright, trademark, patent, + * or other intellectual property or proprietary rights notices on or in the + * Software, including any copy thereof. Redistributions in binary or source + * form must include this license and terms. + * + * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF + * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *****************************************************************************/ + +#ifndef Spine_Event_h +#define Spine_Event_h + +#include + +namespace Spine +{ + class EventData; + + /// Stores the current pose values for an Event. + class Event + { + public: + Event(float time, const EventData& data); + + const EventData& getData(); + + /// The animation time this event was keyed. + float getTime(); + + int getIntValue(); + void setIntValue(int inValue); + + float getFloatValue(); + void setFloatValue(int inValue); + + std::string getStringValue(); + void setStringValue(std::string inValue); + + private: + const EventData& _data; + const float _time; + int _intValue; + float _floatValue; + std::string _stringValue; + + friend std::ostream& operator <<(std::ostream& os, const Event& ref); + }; +} + +#endif /* Spine_Event_h */ diff --git a/spine-cpp/spine-cpp/include/spine/EventData.h b/spine-cpp/spine-cpp/include/spine/EventData.h new file mode 100644 index 000000000..e26a44d7c --- /dev/null +++ b/spine-cpp/spine-cpp/include/spine/EventData.h @@ -0,0 +1,68 @@ +/****************************************************************************** + * Spine Runtimes Software License v2.5 + * + * Copyright (c) 2013-2016, Esoteric Software + * All rights reserved. + * + * You are granted a perpetual, non-exclusive, non-sublicensable, and + * non-transferable license to use, install, execute, and perform the Spine + * Runtimes software and derivative works solely for personal or internal + * use. Without the written permission of Esoteric Software (see Section 2 of + * the Spine Software License Agreement), you may not (a) modify, translate, + * adapt, or develop new applications using the Spine Runtimes or otherwise + * create derivative works or improvements of the Spine Runtimes or (b) remove, + * delete, alter, or obscure any trademarks or any copyright, trademark, patent, + * or other intellectual property or proprietary rights notices on or in the + * Software, including any copy thereof. Redistributions in binary or source + * form must include this license and terms. + * + * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF + * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *****************************************************************************/ + +#ifndef Spine_EventData_h +#define Spine_EventData_h + +#include + +namespace Spine +{ + /// Stores the setup pose values for an Event. + class EventData + { + public: + int _intValue; + float _floatValue; + std::string _stringValue; + + EventData(std::string name); + + /// The name of the event, which is unique within the skeleton. + const std::string& getName(); + + int getIntValue(); + void setIntValue(int inValue); + + float getFloatValue(); + void setFloatValue(float inValue); + + std::string getStringValue(); + void setStringValue(std::string inValue); + + private: + friend class Event; + const std::string _name; + + friend std::ostream& operator <<(std::ostream& os, const EventData& ref); + }; +} + +#endif /* Spine_EventData_h */ diff --git a/spine-cpp/spine-cpp/include/spine/IkConstraintData.h b/spine-cpp/spine-cpp/include/spine/IkConstraintData.h index d4c089921..ad0018068 100644 --- a/spine-cpp/spine-cpp/include/spine/IkConstraintData.h +++ b/spine-cpp/spine-cpp/include/spine/IkConstraintData.h @@ -32,7 +32,7 @@ #define Spine_IkConstraintData_h #include -#include +#include class BoneData; @@ -50,7 +50,7 @@ namespace Spine void setOrder(int inValue); /// The bones that are constrained by this IK Constraint. - std::list& getBones(); + std::vector& getBones(); /// The bone that is the IK target. BoneData* getTarget(); @@ -66,7 +66,7 @@ namespace Spine private: const std::string _name; int _order; - std::list _bones; + std::vector _bones; BoneData* _target; int _bendDirection; float _mix; diff --git a/spine-cpp/spine-cpp/include/spine/PathConstraintData.h b/spine-cpp/spine-cpp/include/spine/PathConstraintData.h new file mode 100644 index 000000000..17f0b02d3 --- /dev/null +++ b/spine-cpp/spine-cpp/include/spine/PathConstraintData.h @@ -0,0 +1,100 @@ +/****************************************************************************** + * Spine Runtimes Software License v2.5 + * + * Copyright (c) 2013-2016, Esoteric Software + * All rights reserved. + * + * You are granted a perpetual, non-exclusive, non-sublicensable, and + * non-transferable license to use, install, execute, and perform the Spine + * Runtimes software and derivative works solely for personal or internal + * use. Without the written permission of Esoteric Software (see Section 2 of + * the Spine Software License Agreement), you may not (a) modify, translate, + * adapt, or develop new applications using the Spine Runtimes or otherwise + * create derivative works or improvements of the Spine Runtimes or (b) remove, + * delete, alter, or obscure any trademarks or any copyright, trademark, patent, + * or other intellectual property or proprietary rights notices on or in the + * Software, including any copy thereof. Redistributions in binary or source + * form must include this license and terms. + * + * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF + * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *****************************************************************************/ + +#ifndef Spine_PathConstraintData_h +#define Spine_PathConstraintData_h + +#include +#include +#include + +#include +#include + +namespace Spine +{ + class BoneData; + class SlotData; + + class PathConstraintData + { + public: + PathConstraintData(std::string name); + + const std::string& getName(); + + int getOrder(); + void setOrder(int inValue); + + std::vector& getBones(); + + SlotData* getTarget(); + void setTarget(SlotData* inValue); + + PositionMode getPositionMode(); + void setPositionMode(PositionMode inValue); + + SpacingMode getSpacingMode(); + void setSpacingMode(SpacingMode inValue); + + RotateMode getRotateMode(); + void setRotateMode(RotateMode inValue); + + float getOffsetRotation(); + void setOffsetRotation(float inValue); + + float getPosition(); + void setPosition(float inValue); + + float getSpacing(); + void setSpacing(float inValue); + + float getRotateMix(); + void setRotateMix(float inValue); + + float getTranslateMix(); + void setTranslateMix(float inValue); + + private: + const std::string _name; + int _order; + std::vector _bones; + SlotData* _target; + PositionMode _positionMode; + SpacingMode _spacingMode; + RotateMode _rotateMode; + float _offsetRotation; + float _position, _spacing, _rotateMix, _translateMix; + + friend std::ostream& operator <<(std::ostream& os, const PathConstraintData& ref); + }; +} + +#endif /* Spine_PathConstraintData_h */ diff --git a/spine-cpp/spine-cpp/include/spine/PositionMode.h b/spine-cpp/spine-cpp/include/spine/PositionMode.h new file mode 100644 index 000000000..66a601cac --- /dev/null +++ b/spine-cpp/spine-cpp/include/spine/PositionMode.h @@ -0,0 +1,43 @@ +/****************************************************************************** + * Spine Runtimes Software License v2.5 + * + * Copyright (c) 2013-2016, Esoteric Software + * All rights reserved. + * + * You are granted a perpetual, non-exclusive, non-sublicensable, and + * non-transferable license to use, install, execute, and perform the Spine + * Runtimes software and derivative works solely for personal or internal + * use. Without the written permission of Esoteric Software (see Section 2 of + * the Spine Software License Agreement), you may not (a) modify, translate, + * adapt, or develop new applications using the Spine Runtimes or otherwise + * create derivative works or improvements of the Spine Runtimes or (b) remove, + * delete, alter, or obscure any trademarks or any copyright, trademark, patent, + * or other intellectual property or proprietary rights notices on or in the + * Software, including any copy thereof. Redistributions in binary or source + * form must include this license and terms. + * + * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF + * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *****************************************************************************/ + +#ifndef Spine_PositionMode_h +#define Spine_PositionMode_h + +namespace Spine +{ + enum PositionMode + { + PositionMode_Fixed = 0, + PositionMode_Percent + }; +} + +#endif /* Spine_PositionMode_h */ diff --git a/spine-cpp/spine-cpp/include/spine/RotateMode.h b/spine-cpp/spine-cpp/include/spine/RotateMode.h new file mode 100644 index 000000000..a8ccd6f97 --- /dev/null +++ b/spine-cpp/spine-cpp/include/spine/RotateMode.h @@ -0,0 +1,44 @@ +/****************************************************************************** + * Spine Runtimes Software License v2.5 + * + * Copyright (c) 2013-2016, Esoteric Software + * All rights reserved. + * + * You are granted a perpetual, non-exclusive, non-sublicensable, and + * non-transferable license to use, install, execute, and perform the Spine + * Runtimes software and derivative works solely for personal or internal + * use. Without the written permission of Esoteric Software (see Section 2 of + * the Spine Software License Agreement), you may not (a) modify, translate, + * adapt, or develop new applications using the Spine Runtimes or otherwise + * create derivative works or improvements of the Spine Runtimes or (b) remove, + * delete, alter, or obscure any trademarks or any copyright, trademark, patent, + * or other intellectual property or proprietary rights notices on or in the + * Software, including any copy thereof. Redistributions in binary or source + * form must include this license and terms. + * + * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF + * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *****************************************************************************/ + +#ifndef Spine_RotateMode_h +#define Spine_RotateMode_h + +namespace Spine +{ + enum RotateMode + { + RotateMode_Tangent = 0, + RotateMode_Chain, + RotateMode_ChainScale + }; +} + +#endif /* Spine_RotateMode_h */ diff --git a/spine-cpp/spine-cpp/include/spine/SlotData.h b/spine-cpp/spine-cpp/include/spine/SlotData.h new file mode 100644 index 000000000..6eb358a40 --- /dev/null +++ b/spine-cpp/spine-cpp/include/spine/SlotData.h @@ -0,0 +1,92 @@ +/****************************************************************************** + * Spine Runtimes Software License v2.5 + * + * Copyright (c) 2013-2016, Esoteric Software + * All rights reserved. + * + * You are granted a perpetual, non-exclusive, non-sublicensable, and + * non-transferable license to use, install, execute, and perform the Spine + * Runtimes software and derivative works solely for personal or internal + * use. Without the written permission of Esoteric Software (see Section 2 of + * the Spine Software License Agreement), you may not (a) modify, translate, + * adapt, or develop new applications using the Spine Runtimes or otherwise + * create derivative works or improvements of the Spine Runtimes or (b) remove, + * delete, alter, or obscure any trademarks or any copyright, trademark, patent, + * or other intellectual property or proprietary rights notices on or in the + * Software, including any copy thereof. Redistributions in binary or source + * form must include this license and terms. + * + * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF + * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *****************************************************************************/ + +#ifndef Spine_SlotData_h +#define Spine_SlotData_h + +#include + +#include + +namespace Spine +{ + class BoneData; + + class SlotData + { + public: + SlotData(int index, std::string name, const BoneData& boneData); + + const int getIndex(); + + const std::string& getName(); + + const BoneData& getBoneData(); + + float getR(); + void setR(float inValue); + float getG(); + void setG(float inValue); + float getB(); + void setB(float inValue); + float getA(); + void setA(float inValue); + + float getR2(); + void setR2(float inValue); + float getG2(); + void setG2(float inValue); + float getB2(); + void setB2(float inValue); + bool hasSecondColor(); + void setHasSecondColor(bool inValue); + + /// May be empty. + std::string getAttachmentName(); + void setAttachmentName(std::string inValue); + + BlendMode getBlendMode(); + void setBlendMode(BlendMode inValue); + + private: + const int _index; + const std::string _name; + const BoneData& _boneData; + float _r, _g, _b, _a; + float _r2, _g2, _b2; + bool _hasSecondColor; + std::string _attachmentName; + BlendMode _blendMode; + + friend std::ostream& operator <<(std::ostream& os, const SlotData& ref); + }; +} + +#endif /* Spine_SlotData_h */ diff --git a/spine-cpp/spine-cpp/include/spine/SpacingMode.h b/spine-cpp/spine-cpp/include/spine/SpacingMode.h new file mode 100644 index 000000000..76b2986b4 --- /dev/null +++ b/spine-cpp/spine-cpp/include/spine/SpacingMode.h @@ -0,0 +1,44 @@ +/****************************************************************************** + * Spine Runtimes Software License v2.5 + * + * Copyright (c) 2013-2016, Esoteric Software + * All rights reserved. + * + * You are granted a perpetual, non-exclusive, non-sublicensable, and + * non-transferable license to use, install, execute, and perform the Spine + * Runtimes software and derivative works solely for personal or internal + * use. Without the written permission of Esoteric Software (see Section 2 of + * the Spine Software License Agreement), you may not (a) modify, translate, + * adapt, or develop new applications using the Spine Runtimes or otherwise + * create derivative works or improvements of the Spine Runtimes or (b) remove, + * delete, alter, or obscure any trademarks or any copyright, trademark, patent, + * or other intellectual property or proprietary rights notices on or in the + * Software, including any copy thereof. Redistributions in binary or source + * form must include this license and terms. + * + * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF + * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *****************************************************************************/ + +#ifndef Spine_SpacingMode_h +#define Spine_SpacingMode_h + +namespace Spine +{ + enum SpacingMode + { + SpacingMode_Length = 0, + SpacingMode_Fixed, + SpacingMode_Percent + }; +} + +#endif /* Spine_SpacingMode_h */ diff --git a/spine-cpp/spine-cpp/include/spine/TransformMode.h b/spine-cpp/spine-cpp/include/spine/TransformMode.h index 5af1b802f..35c1ae55b 100644 --- a/spine-cpp/spine-cpp/include/spine/TransformMode.h +++ b/spine-cpp/spine-cpp/include/spine/TransformMode.h @@ -36,11 +36,11 @@ namespace Spine enum TransformMode { //0000 0 Flip Scale Rotation - Normal = 0, // 0000 - OnlyTranslation = 7, // 0111 - NoRotationOrReflection = 1, // 0001 - NoScale = 2, // 0010 - NoScaleOrReflection = 6, // 0110 + TransformMode_Normal = 0, // 0000 + TransformMode_OnlyTranslation = 7, // 0111 + TransformMode_NoRotationOrReflection = 1, // 0001 + TransformMode_NoScale = 2, // 0010 + TransformMode_NoScaleOrReflection = 6, // 0110 }; } diff --git a/spine-cpp/spine-cpp/src/spine/BoneData.cpp b/spine-cpp/spine-cpp/src/spine/BoneData.cpp index f5d23e76c..17f508e1a 100644 --- a/spine-cpp/spine-cpp/src/spine/BoneData.cpp +++ b/spine-cpp/spine-cpp/src/spine/BoneData.cpp @@ -46,9 +46,10 @@ namespace Spine _scaleY(1), _shearX(0), _shearY(0), - _transformMode(TransformMode::Normal) + _transformMode(TransformMode_Normal) { assert(index < 0); + assert(_name.length() > 0); } const int BoneData::getIndex() diff --git a/spine-cpp/spine-cpp/src/spine/Event.cpp b/spine-cpp/spine-cpp/src/spine/Event.cpp new file mode 100644 index 000000000..548a32798 --- /dev/null +++ b/spine-cpp/spine-cpp/src/spine/Event.cpp @@ -0,0 +1,93 @@ +/****************************************************************************** +* Spine Runtimes Software License v2.5 +* +* Copyright (c) 2013-2016, Esoteric Software +* All rights reserved. +* +* You are granted a perpetual, non-exclusive, non-sublicensable, and +* non-transferable license to use, install, execute, and perform the Spine +* Runtimes software and derivative works solely for personal or internal +* use. Without the written permission of Esoteric Software (see Section 2 of +* the Spine Software License Agreement), you may not (a) modify, translate, +* adapt, or develop new applications using the Spine Runtimes or otherwise +* create derivative works or improvements of the Spine Runtimes or (b) remove, +* delete, alter, or obscure any trademarks or any copyright, trademark, patent, +* or other intellectual property or proprietary rights notices on or in the +* Software, including any copy thereof. Redistributions in binary or source +* form must include this license and terms. +* +* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +* EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF +* USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +*****************************************************************************/ + +#include + +#include + +namespace Spine +{ + Event::Event(float time, const EventData& data) : + _time(time), + _data(data), + _intValue(0), + _floatValue(0), + _stringValue(0) + { + // Empty + } + + const EventData& Event::getData() + { + return _data; + } + + float Event::getTime() + { + return _time; + } + + int Event::getIntValue() + { + return _intValue; + } + + void Event::setIntValue(int inValue) + { + _intValue = inValue; + } + + float Event::getFloatValue() + { + return _floatValue; + } + + void Event::setFloatValue(int inValue) + { + _floatValue = inValue; + } + + std::string Event::getStringValue() + { + return _stringValue; + } + + void Event::setStringValue(std::string inValue) + { + _stringValue = inValue; + } + + std::ostream& operator <<(std::ostream& os, const Event& ref) + { + os << ref._data; + + return os; + } +} diff --git a/spine-cpp/spine-cpp/src/spine/EventData.cpp b/spine-cpp/spine-cpp/src/spine/EventData.cpp new file mode 100644 index 000000000..1f6438a09 --- /dev/null +++ b/spine-cpp/spine-cpp/src/spine/EventData.cpp @@ -0,0 +1,88 @@ +/****************************************************************************** +* Spine Runtimes Software License v2.5 +* +* Copyright (c) 2013-2016, Esoteric Software +* All rights reserved. +* +* You are granted a perpetual, non-exclusive, non-sublicensable, and +* non-transferable license to use, install, execute, and perform the Spine +* Runtimes software and derivative works solely for personal or internal +* use. Without the written permission of Esoteric Software (see Section 2 of +* the Spine Software License Agreement), you may not (a) modify, translate, +* adapt, or develop new applications using the Spine Runtimes or otherwise +* create derivative works or improvements of the Spine Runtimes or (b) remove, +* delete, alter, or obscure any trademarks or any copyright, trademark, patent, +* or other intellectual property or proprietary rights notices on or in the +* Software, including any copy thereof. Redistributions in binary or source +* form must include this license and terms. +* +* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +* EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF +* USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +*****************************************************************************/ + +#include + +#include + +namespace Spine +{ + EventData::EventData(std::string name) : + _name(name), + _intValue(0), + _floatValue(0), + _stringValue() + { + assert(_name.length() > 0); + } + + /// The name of the event, which is unique within the skeleton. + const std::string& EventData::getName() + { + return _name; + } + + int EventData::getIntValue() + { + return _intValue; + } + + void EventData::setIntValue(int inValue) + { + _intValue = inValue; + } + + float EventData::getFloatValue() + { + return _floatValue; + } + + void EventData::setFloatValue(float inValue) + { + _floatValue = inValue; + } + + std::string EventData::getStringValue() + { + return _stringValue; + } + + void EventData::setStringValue(std::string inValue) + { + _stringValue = inValue; + } + + std::ostream& operator <<(std::ostream& os, const EventData& ref) + { + os << ref._name; + + return os; + } +} diff --git a/spine-cpp/spine-cpp/src/spine/IkConstraintData.cpp b/spine-cpp/spine-cpp/src/spine/IkConstraintData.cpp index a241f7dec..b8f3b9373 100644 --- a/spine-cpp/spine-cpp/src/spine/IkConstraintData.cpp +++ b/spine-cpp/spine-cpp/src/spine/IkConstraintData.cpp @@ -57,7 +57,7 @@ namespace Spine _order = inValue; } - std::list& IkConstraintData::getBones() + std::vector& IkConstraintData::getBones() { return _bones; } diff --git a/spine-cpp/spine-cpp/src/spine/PathConstraintData.cpp b/spine-cpp/spine-cpp/src/spine/PathConstraintData.cpp new file mode 100644 index 000000000..71ae38541 --- /dev/null +++ b/spine-cpp/spine-cpp/src/spine/PathConstraintData.cpp @@ -0,0 +1,172 @@ +/****************************************************************************** +* Spine Runtimes Software License v2.5 +* +* Copyright (c) 2013-2016, Esoteric Software +* All rights reserved. +* +* You are granted a perpetual, non-exclusive, non-sublicensable, and +* non-transferable license to use, install, execute, and perform the Spine +* Runtimes software and derivative works solely for personal or internal +* use. Without the written permission of Esoteric Software (see Section 2 of +* the Spine Software License Agreement), you may not (a) modify, translate, +* adapt, or develop new applications using the Spine Runtimes or otherwise +* create derivative works or improvements of the Spine Runtimes or (b) remove, +* delete, alter, or obscure any trademarks or any copyright, trademark, patent, +* or other intellectual property or proprietary rights notices on or in the +* Software, including any copy thereof. Redistributions in binary or source +* form must include this license and terms. +* +* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +* EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF +* USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +*****************************************************************************/ + +#include + +#include +#include + +#include + +namespace Spine +{ + PathConstraintData::PathConstraintData(std::string name) : + _name(name), + _order(0), + _target(nullptr), + _positionMode(PositionMode_Fixed), + _spacingMode(SpacingMode_Length), + _rotateMode(RotateMode_Tangent), + _offsetRotation(0), + _position(0), + _spacing(0), + _rotateMix(0), + _translateMix(0) + { + assert(_name.length() > 0); + } + + const std::string& PathConstraintData::getName() + { + return _name; + } + + int PathConstraintData::getOrder() + { + return _order; + } + + void PathConstraintData::setOrder(int inValue) + { + _order = inValue; + } + + std::vector& PathConstraintData::getBones() + { + return _bones; + } + + SlotData* PathConstraintData::getTarget() + { + return _target; + } + + void PathConstraintData::setTarget(SlotData* inValue) + { + _target = inValue; + } + + PositionMode PathConstraintData::getPositionMode() + { + return _positionMode; + } + + void PathConstraintData::setPositionMode(PositionMode inValue) + { + _positionMode = inValue; + } + + SpacingMode PathConstraintData::getSpacingMode() + { + return _spacingMode; + } + + void PathConstraintData::setSpacingMode(SpacingMode inValue) + { + _spacingMode = inValue; + } + + RotateMode PathConstraintData::getRotateMode() + { + return _rotateMode; + } + + void PathConstraintData::setRotateMode(RotateMode inValue) + { + _rotateMode = inValue; + } + + float PathConstraintData::getOffsetRotation() + { + return _offsetRotation; + } + + void PathConstraintData::setOffsetRotation(float inValue) + { + _offsetRotation = inValue; + } + + float PathConstraintData::getPosition() + { + return _position; + } + + void PathConstraintData::setPosition(float inValue) + { + _position = inValue; + } + + float PathConstraintData::getSpacing() + { + return _spacing; + } + + void PathConstraintData::setSpacing(float inValue) + { + _spacing = inValue; + } + + float PathConstraintData::getRotateMix() + { + return _rotateMix; + } + + void PathConstraintData::setRotateMix(float inValue) + { + _rotateMix = inValue; + } + + float PathConstraintData::getTranslateMix() + { + return _translateMix; + } + + void PathConstraintData::setTranslateMix(float inValue) + { + _translateMix = inValue; + } + + std::ostream& operator <<(std::ostream& os, const PathConstraintData& ref) + { + os << ref._name; + + return os; + } +} diff --git a/spine-cpp/spine-cpp/src/spine/SlotData.cpp b/spine-cpp/spine-cpp/src/spine/SlotData.cpp new file mode 100644 index 000000000..a8bf97ff7 --- /dev/null +++ b/spine-cpp/spine-cpp/src/spine/SlotData.cpp @@ -0,0 +1,177 @@ +/****************************************************************************** +* Spine Runtimes Software License v2.5 +* +* Copyright (c) 2013-2016, Esoteric Software +* All rights reserved. +* +* You are granted a perpetual, non-exclusive, non-sublicensable, and +* non-transferable license to use, install, execute, and perform the Spine +* Runtimes software and derivative works solely for personal or internal +* use. Without the written permission of Esoteric Software (see Section 2 of +* the Spine Software License Agreement), you may not (a) modify, translate, +* adapt, or develop new applications using the Spine Runtimes or otherwise +* create derivative works or improvements of the Spine Runtimes or (b) remove, +* delete, alter, or obscure any trademarks or any copyright, trademark, patent, +* or other intellectual property or proprietary rights notices on or in the +* Software, including any copy thereof. Redistributions in binary or source +* form must include this license and terms. +* +* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +* EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF +* USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +*****************************************************************************/ + +#include + +#include + +namespace Spine +{ + SlotData::SlotData(int index, std::string name, const BoneData& boneData) : + _index(index), + _name(name), + _boneData(boneData), + _r(1), + _g(1), + _b(1), + _a(1), + _r2(0), + _g2(0), + _b2(0), + _hasSecondColor(false), + _attachmentName(), + _blendMode(BlendMode_Normal) + { + assert(_index >= 0); + assert(_name.length() > 0); + } + + const int SlotData::getIndex() + { + return _index; + } + + const std::string& SlotData::getName() + { + return _name; + } + + const BoneData& SlotData::getBoneData() + { + return _boneData; + } + + float SlotData::getR() + { + return _r; + } + + void SlotData::setR(float inValue) + { + _r = inValue; + } + + float SlotData::getG() + { + return _g; + } + + void SlotData::setG(float inValue) + { + _g = inValue; + } + + float SlotData::getB() + { + return _b; + } + + void SlotData::setB(float inValue) + { + _b = inValue; + } + + float SlotData::getA() + { + return _a; + } + + void SlotData::setA(float inValue) + { + _a = inValue; + } + + float SlotData::getR2() + { + return _r2; + } + + void SlotData::setR2(float inValue) + { + _r2 = inValue; + } + + float SlotData::getG2() + { + return _g2; + } + + void SlotData::setG2(float inValue) + { + _g2 = inValue; + } + + float SlotData::getB2() + { + return _b2; + } + + void SlotData::setB2(float inValue) + { + _b2 = inValue; + } + + bool SlotData::hasSecondColor() + { + return _hasSecondColor; + } + + void SlotData::setHasSecondColor(bool inValue) + { + _hasSecondColor = inValue; + } + + std::string SlotData::getAttachmentName() + { + return _attachmentName; + } + + void SlotData::setAttachmentName(std::string inValue) + { + _attachmentName = inValue; + } + + BlendMode SlotData::getBlendMode() + { + return _blendMode; + } + + void SlotData::setBlendMode(BlendMode inValue) + { + _blendMode = inValue; + } + + std::ostream& operator <<(std::ostream& os, const SlotData& ref) + { + os << ref._name; + + return os; + } +}