[cpp] Cleaned up API.

This commit is contained in:
badlogic 2018-03-05 16:58:12 +01:00
parent e4a029e1a7
commit bd665df1d3
98 changed files with 218 additions and 460 deletions

View File

@ -93,9 +93,7 @@ public:
const String &getName(); const String &getName();
Vector<Timeline *> getTimelines(); Vector<Timeline *> &getTimelines();
void setTimelines(Vector<Timeline *> &inValue);
float getDuration(); float getDuration();

View File

@ -250,8 +250,6 @@ namespace Spine {
Event* _event; Event* _event;
EventQueueEntry(EventType eventType, TrackEntry* trackEntry, Event* event = NULL); EventQueueEntry(EventType eventType, TrackEntry* trackEntry, Event* event = NULL);
}; };
class EventQueue : public SpineObject { class EventQueue : public SpineObject {
@ -370,14 +368,15 @@ namespace Spine {
AnimationStateData* getData(); AnimationStateData* getData();
/// A list of tracks that have animations, which may contain NULLs. /// A list of tracks that have animations, which may contain NULLs.
Vector<TrackEntry*> getTracks(); Vector<TrackEntry*> &getTracks();
float getTimeScale(); float getTimeScale();
void setTimeScale(float inValue); void setTimeScale(float inValue);
void setOnAnimationEventFunc(OnAnimationEventFunc inValue); void setOnAnimationEventFunc(OnAnimationEventFunc inValue);
void setRendererObject(void* inValue); void setRendererObject(void* inValue);
void* getRendererObject(); void* getRendererObject();
private: private:
static const int Subsequent, First, Dip, DipMix; static const int Subsequent, First, Dip, DipMix;

View File

@ -68,8 +68,6 @@ namespace Spine {
/// ///
float getMix(Animation* from, Animation* to); float getMix(Animation* from, Animation* to);
private: private:
class AnimationPair : public SpineObject { class AnimationPair : public SpineObject {
public: public:
@ -79,8 +77,6 @@ namespace Spine {
explicit AnimationPair(Animation* a1 = NULL, Animation* a2 = NULL); explicit AnimationPair(Animation* a1 = NULL, Animation* a2 = NULL);
bool operator==(const AnimationPair &other) const; bool operator==(const AnimationPair &other) const;
}; };
struct HashAnimationPair : public SpineObject { struct HashAnimationPair : public SpineObject {

View File

@ -63,8 +63,6 @@ namespace Spine {
virtual ClippingAttachment* newClippingAttachment(Skin& skin, const String& name); virtual ClippingAttachment* newClippingAttachment(Skin& skin, const String& name);
AtlasRegion* findRegion(const String& name); AtlasRegion* findRegion(const String& name);
private: private:
Atlas* _atlas; Atlas* _atlas;

View File

@ -38,7 +38,6 @@
#include <spine/MixDirection.h> #include <spine/MixDirection.h>
#include <spine/String.h> #include <spine/String.h>
namespace Spine { namespace Spine {
class Skeleton; class Skeleton;
class Event; class Event;
@ -62,9 +61,7 @@ namespace Spine {
int getSlotIndex(); int getSlotIndex();
void setSlotIndex(int inValue); void setSlotIndex(int inValue);
const Vector<float>& getFrames(); const Vector<float>& getFrames();
void setFrames(Vector<float>& inValue); // time, ...
const Vector<String>& getAttachmentNames(); const Vector<String>& getAttachmentNames();
void setAttachmentNames(Vector<String>& inValue);
int getFrameCount(); int getFrameCount();
private: private:
int _slotIndex; int _slotIndex;

View File

@ -221,8 +221,6 @@ public:
/// Returns the magnitide (always positive) of the world scale Y. /// Returns the magnitide (always positive) of the world scale Y.
float getWorldScaleY(); float getWorldScaleY();
private: private:
static bool yDown; static bool yDown;

View File

@ -107,8 +107,6 @@ public:
void setTransformMode(TransformMode inValue); void setTransformMode(TransformMode inValue);
private: private:
const int _index; const int _index;
const String _name; const String _name;

View File

@ -40,8 +40,6 @@ namespace Spine {
RTTI_DECL RTTI_DECL
explicit BoundingBoxAttachment(const String& name); explicit BoundingBoxAttachment(const String& name);
}; };
} }

View File

@ -49,8 +49,6 @@ namespace Spine {
SlotData* getEndSlot(); SlotData* getEndSlot();
void setEndSlot(SlotData* inValue); void setEndSlot(SlotData* inValue);
private: private:
SlotData* _endSlot; SlotData* _endSlot;

View File

@ -35,58 +35,58 @@
namespace Spine { namespace Spine {
class Color : public SpineObject { class Color : public SpineObject {
public: public:
Color() : _r(0), _g(0), _b(0), _a(0) { Color() : r(0), g(0), b(0), a(0) {
} }
Color(float r, float g, float b, float a) : _r(r), _g(g), _b(b), _a(a) { Color(float r, float g, float b, float a) : r(r), g(g), b(b), a(a) {
clamp(); clamp();
} }
inline Color &set(float r, float g, float b, float a) { inline Color &set(float r, float g, float b, float a) {
_r = r; r = r;
_g = g; g = g;
_b = b; b = b;
_a = a; a = a;
clamp(); clamp();
return *this; return *this;
} }
inline Color &set(const Color &other) { inline Color &set(const Color &other) {
_r = other._r; r = other.r;
_g = other._g; g = other.g;
_b = other._b; b = other.b;
_a = other._a; a = other.a;
clamp(); clamp();
return *this; return *this;
} }
inline Color &add(float r, float g, float b, float a) { inline Color &add(float r, float g, float b, float a) {
_r += r; r += r;
_g += g; g += g;
_b += b; b += b;
_a += a; a += a;
clamp(); clamp();
return *this; return *this;
} }
inline Color &add(const Color &other) { inline Color &add(const Color &other) {
_r += other._r; r += other.r;
_g += other._g; g += other.g;
_b += other._b; b += other.b;
_a += other._a; a += other.a;
clamp(); clamp();
return *this; return *this;
} }
inline Color &clamp() { inline Color &clamp() {
_r = MathUtil::clamp(this->_r, 0, 1); r = MathUtil::clamp(this->r, 0, 1);
_g = MathUtil::clamp(this->_g, 0, 1); g = MathUtil::clamp(this->g, 0, 1);
_b = MathUtil::clamp(this->_b, 0, 1); b = MathUtil::clamp(this->b, 0, 1);
_a = MathUtil::clamp(this->_a, 0, 1); a = MathUtil::clamp(this->a, 0, 1);
return *this; return *this;
} }
float _r, _g, _b, _a; float r, g, b, a;
}; };
} }

View File

@ -61,8 +61,6 @@ public:
Vector<float> &getFrames(); Vector<float> &getFrames();
void setFrames(Vector<float> &inValue); // time, r, g, b, a, ...
protected: protected:
static const int PREV_TIME, PREV_R, PREV_G, PREV_B, PREV_A; static const int PREV_TIME, PREV_R, PREV_G, PREV_B, PREV_A;
static const int R, G, B, A; static const int R, G, B, A;

View File

@ -55,9 +55,7 @@ namespace Spine {
int getSlotIndex(); int getSlotIndex();
void setSlotIndex(int inValue); void setSlotIndex(int inValue);
Vector<float>& getFrames(); Vector<float>& getFrames();
void setFrames(Vector<float>& inValue); // time, ...
Vector< Vector<float> >& getVertices(); Vector< Vector<float> >& getVertices();
void setVertices(Vector< Vector<float> >& inValue);
VertexAttachment* getAttachment(); VertexAttachment* getAttachment();
void setAttachment(VertexAttachment* inValue); void setAttachment(VertexAttachment* inValue);

View File

@ -52,9 +52,7 @@ namespace Spine {
void setFrame(int frameIndex, float time, Vector<int>& drawOrder); void setFrame(int frameIndex, float time, Vector<int>& drawOrder);
Vector<float>& getFrames(); Vector<float>& getFrames();
void setFrames(Vector<float>& inValue); // time, ...
Vector< Vector<int> >& getDrawOrders(); Vector< Vector<int> >& getDrawOrders();
void setDrawOrders(Vector< Vector<int> >& inValue);
int getFrameCount(); int getFrameCount();
private: private:

View File

@ -65,8 +65,6 @@ public:
void setStringValue(const String &inValue); void setStringValue(const String &inValue);
private: private:
const EventData &_data; const EventData &_data;
const float _time; const float _time;

View File

@ -61,8 +61,6 @@ public:
void setStringValue(const String &inValue); void setStringValue(const String &inValue);
private: private:
const String _name; const String _name;
int _intValue; int _intValue;

View File

@ -53,9 +53,7 @@ namespace Spine {
void setFrame(int frameIndex, Event* event); void setFrame(int frameIndex, Event* event);
Vector<float> getFrames(); Vector<float> getFrames();
void setFrames(Vector<float>& inValue);
Vector<Event*>& getEvents(); Vector<Event*>& getEvents();
void setEvents(Vector<Event*>& inValue);
int getFrameCount(); int getFrameCount();
private: private:

View File

@ -84,8 +84,6 @@ public:
void setMix(float inValue); void setMix(float inValue);
private: private:
IkConstraintData &_data; IkConstraintData &_data;
Vector<Bone *> _bones; Vector<Bone *> _bones;

View File

@ -68,8 +68,6 @@ namespace Spine {
float getMix(); float getMix();
void setMix(float inValue); void setMix(float inValue);
private: private:
const String _name; const String _name;
int _order; int _order;

View File

@ -45,8 +45,6 @@ class LinkedMesh : public SpineObject {
public: public:
LinkedMesh(MeshAttachment *mesh, const String &skin, int slotIndex, const String &parent); LinkedMesh(MeshAttachment *mesh, const String &skin, int slotIndex, const String &parent);
private: private:
MeshAttachment *_mesh; MeshAttachment *_mesh;
String _skin; String _skin;

View File

@ -35,7 +35,6 @@
#include <spine/Vector.h> #include <spine/Vector.h>
#include <spine/Color.h> #include <spine/Color.h>
namespace Spine { namespace Spine {
/// Attachment that displays a texture region using a mesh. /// Attachment that displays a texture region using a mesh.
class MeshAttachment : public VertexAttachment { class MeshAttachment : public VertexAttachment {
@ -56,14 +55,11 @@ namespace Spine {
void setHullLength(float inValue); void setHullLength(float inValue);
Vector<float>& getRegionUVs(); Vector<float>& getRegionUVs();
void setRegionUVs(Vector<float>& inValue);
/// The UV pair for each vertex, normalized within the entire texture. See also MeshAttachment::updateUVs /// The UV pair for each vertex, normalized within the entire texture. See also MeshAttachment::updateUVs
Vector<float>& getUVs(); Vector<float>& getUVs();
void setUVs(Vector<float>& inValue);
Vector<unsigned short>& getTriangles(); Vector<unsigned short>& getTriangles();
void setTriangles(Vector<unsigned short>& inValue);
Color& getColor(); Color& getColor();
@ -116,14 +112,11 @@ namespace Spine {
// Nonessential. // Nonessential.
Vector<unsigned short>& getEdges(); Vector<unsigned short>& getEdges();
void setEdges(Vector<unsigned short>& inValue);
float getWidth(); float getWidth();
void setWidth(float inValue); void setWidth(float inValue);
float getHeight(); float getHeight();
void setHeight(float inValue); void setHeight(float inValue);
private: private:
float _regionOffsetX, _regionOffsetY, _regionWidth, _regionHeight, _regionOriginalWidth, _regionOriginalHeight; float _regionOffsetX, _regionOffsetY, _regionWidth, _regionHeight, _regionOriginalWidth, _regionOriginalHeight;
MeshAttachment* _parentMesh; MeshAttachment* _parentMesh;

View File

@ -45,13 +45,10 @@ namespace Spine {
/// The length in the setup pose from the start of the path to the end of each curve. /// The length in the setup pose from the start of the path to the end of each curve.
Vector<float>& getLengths(); Vector<float>& getLengths();
void setLengths(Vector<float>& inValue);
bool isClosed(); bool isClosed();
void setClosed(bool inValue); void setClosed(bool inValue);
bool isConstantSpeed(); bool isConstantSpeed();
void setConstantSpeed(bool inValue); void setConstantSpeed(bool inValue);
private: private:
Vector<float> _lengths; Vector<float> _lengths;

View File

@ -78,8 +78,6 @@ namespace Spine {
void setTarget(Slot* inValue); void setTarget(Slot* inValue);
PathConstraintData& getData(); PathConstraintData& getData();
private: private:
static const float EPSILON; static const float EPSILON;

View File

@ -89,7 +89,6 @@ namespace Spine {
float getTranslateMix(); float getTranslateMix();
void setTranslateMix(float inValue); void setTranslateMix(float inValue);
private: private:
const String _name; const String _name;
int _order; int _order;

View File

@ -64,8 +64,6 @@ namespace Spine {
float getRotation(); float getRotation();
void setRotation(float inValue); void setRotation(float inValue);
private: private:
float _x, _y, _rotation; float _x, _y, _rotation;

View File

@ -48,8 +48,6 @@ public:
bool instanceOf(const RTTI &rtti) const; bool instanceOf(const RTTI &rtti) const;
private: private:
// Prevent copying // Prevent copying
RTTI(const RTTI &obj); RTTI(const RTTI &obj);

View File

@ -106,8 +106,6 @@ namespace Spine {
Vector<float>& getOffset(); Vector<float>& getOffset();
Vector<float>& getUVs(); Vector<float>& getUVs();
private: private:
static const int BLX; static const int BLX;

View File

@ -57,7 +57,6 @@ namespace Spine {
void setBoneIndex(int inValue); void setBoneIndex(int inValue);
Vector<float>& getFrames(); Vector<float>& getFrames();
void setFrames(Vector<float> inValue);
private: private:
static const int PREV_TIME = -2; static const int PREV_TIME = -2;

View File

@ -212,8 +212,6 @@ public:
void setFlipY(bool inValue); void setFlipY(bool inValue);
private: private:
SkeletonData *_data; SkeletonData *_data;
Vector<Bone *> _bones; Vector<Bone *> _bones;

View File

@ -80,8 +80,6 @@ namespace Spine {
void setScale(float scale) { _scale = scale; } void setScale(float scale) { _scale = scale; }
String& getError() { return _error; } String& getError() { return _error; }
private: private:
struct DataInput : public SpineObject { struct DataInput : public SpineObject {

View File

@ -37,7 +37,6 @@
namespace Spine { namespace Spine {
class Skeleton; class Skeleton;
class BoundingBoxAttachment; class BoundingBoxAttachment;
class Polygon; class Polygon;
/// ///
@ -86,8 +85,6 @@ namespace Spine {
float getWidth(); float getWidth();
float getHeight(); float getHeight();
private: private:
Vector<Polygon*> _polygonPool; Vector<Polygon*> _polygonPool;
Vector<BoundingBoxAttachment*> _boundingBoxes; Vector<BoundingBoxAttachment*> _boundingBoxes;
@ -105,8 +102,6 @@ namespace Spine {
Polygon() : _count(0) { Polygon() : _count(0) {
_vertices.ensureCapacity(16); _vertices.ensureCapacity(16);
} }
}; };
} }

View File

@ -55,8 +55,6 @@ namespace Spine {
Vector<float>& getClippedVertices(); Vector<float>& getClippedVertices();
Vector<unsigned short>& getClippedTriangles(); Vector<unsigned short>& getClippedTriangles();
Vector<float>& getClippedUVs(); Vector<float>& getClippedUVs();
private: private:
Triangulator _triangulator; Triangulator _triangulator;

View File

@ -111,8 +111,6 @@ public:
/// All skins, including the default skin. /// All skins, including the default skin.
Vector<Skin *> &getSkins(); Vector<Skin *> &getSkins();
void setSkins(Vector<Skin *> &inValue);
/// The skeleton's default skin. /// The skeleton's default skin.
/// By default this skin contains all attachments that were not in a skin in Spine. /// By default this skin contains all attachments that were not in a skin in Spine.
/// ///
@ -123,24 +121,14 @@ public:
Vector<EventData *> &getEvents(); Vector<EventData *> &getEvents();
void setEvents(Vector<EventData *> &inValue);
Vector<Animation *> &getAnimations(); Vector<Animation *> &getAnimations();
void setAnimations(Vector<Animation *> &inValue);
Vector<IkConstraintData *> &getIkConstraints(); Vector<IkConstraintData *> &getIkConstraints();
void setIkConstraints(Vector<IkConstraintData *> &inValue);
Vector<TransformConstraintData *> &getTransformConstraints(); Vector<TransformConstraintData *> &getTransformConstraints();
void setTransformConstraints(Vector<TransformConstraintData *> &inValue);
Vector<PathConstraintData *> &getPathConstraints(); Vector<PathConstraintData *> &getPathConstraints();
void setPathConstraints(Vector<PathConstraintData *> &inValue);
float getWidth(); float getWidth();
void setWidth(float inValue); void setWidth(float inValue);
@ -167,8 +155,6 @@ public:
void setFps(float inValue); void setFps(float inValue);
private: private:
String _name; String _name;
Vector<BoneData *> _bones; // Ordered parents first Vector<BoneData *> _bones; // Ordered parents first

View File

@ -70,8 +70,6 @@ public:
String &getError() { return _error; } String &getError() { return _error; }
private: private:
AttachmentLoader *_attachmentLoader; AttachmentLoader *_attachmentLoader;
Vector<LinkedMesh *> _linkedMeshes; Vector<LinkedMesh *> _linkedMeshes;

View File

@ -60,8 +60,6 @@ public:
} }
bool operator==(const AttachmentKey &other) const; bool operator==(const AttachmentKey &other) const;
}; };
struct HashAttachmentKey : public SpineObject { struct HashAttachmentKey : public SpineObject {
@ -93,8 +91,6 @@ public:
HashMap<AttachmentKey, Attachment *> &getAttachments(); HashMap<AttachmentKey, Attachment *> &getAttachments();
private: private:
const String _name; const String _name;
HashMap<AttachmentKey, Attachment *> _attachments; HashMap<AttachmentKey, Attachment *> _attachments;

View File

@ -113,10 +113,6 @@ public:
Vector<float> &getAttachmentVertices(); Vector<float> &getAttachmentVertices();
void setAttachmentVertices(Vector<float> &inValue);
private: private:
SlotData &_data; SlotData &_data;
Bone &_bone; Bone &_bone;

View File

@ -98,8 +98,6 @@ public:
void setBlendMode(BlendMode inValue); void setBlendMode(BlendMode inValue);
private: private:
const int _index; const int _index;
String _name; String _name;

View File

@ -73,8 +73,6 @@ namespace Spine {
float getShearMix(); float getShearMix();
void setShearMix(float inValue); void setShearMix(float inValue);
private: private:
TransformConstraintData& _data; TransformConstraintData& _data;

View File

@ -67,8 +67,6 @@ namespace Spine {
bool isRelative(); bool isRelative();
bool isLocal(); bool isLocal();
private: private:
const String _name; const String _name;

View File

@ -43,8 +43,6 @@ public:
Vector< Vector<float>* > &decompose(Vector<float> &vertices, Vector<int> &triangles); Vector< Vector<float>* > &decompose(Vector<float> &vertices, Vector<int> &triangles);
private: private:
Vector<Vector < float>* > _convexPolygons; Vector<Vector < float>* > _convexPolygons;
Vector<Vector < int>* > _convexPolygonsIndices; Vector<Vector < int>* > _convexPolygonsIndices;

View File

@ -68,10 +68,8 @@ namespace Spine {
int getId(); int getId();
Vector<int>& getBones(); Vector<int>& getBones();
void setBones(Vector<int> inValue);
Vector<float>& getVertices(); Vector<float>& getVertices();
void setVertices(Vector<float> inValue);
int getWorldVerticesLength(); int getWorldVerticesLength();
void setWorldVerticesLength(int inValue); void setWorldVerticesLength(int inValue);

View File

@ -36,7 +36,8 @@
#include <spine/ContainerUtil.h> #include <spine/ContainerUtil.h>
namespace Spine { using namespace Spine;
Animation::Animation(const String &name, Vector<Timeline *> &timelines, float duration) : Animation::Animation(const String &name, Vector<Timeline *> &timelines, float duration) :
_timelines(timelines), _timelines(timelines),
_duration(duration), _duration(duration),
@ -66,15 +67,10 @@ const String &Animation::getName() {
return _name; return _name;
} }
Vector<Timeline *> Animation::getTimelines() { Vector<Timeline *> &Animation::getTimelines() {
return _timelines; return _timelines;
} }
void Animation::setTimelines(Vector<Timeline *> &inValue) {
_timelines.clear();
_timelines.addAll(inValue);
}
float Animation::getDuration() { float Animation::getDuration() {
return _duration; return _duration;
} }
@ -140,4 +136,3 @@ int Animation::linearSearch(Vector<float> &values, float target, int step) {
return -1; return -1;
} }
}

View File

@ -42,7 +42,8 @@
#include <spine/AttachmentTimeline.h> #include <spine/AttachmentTimeline.h>
#include <spine/DrawOrderTimeline.h> #include <spine/DrawOrderTimeline.h>
namespace Spine { using namespace Spine;
void dummyOnAnimationEventFunc(AnimationState *state, EventType type, TrackEntry *entry, Event *event = NULL) { void dummyOnAnimationEventFunc(AnimationState *state, EventType type, TrackEntry *entry, Event *event = NULL) {
} }
@ -633,7 +634,7 @@ AnimationStateData *AnimationState::getData() {
return _data; return _data;
} }
Vector<TrackEntry *> AnimationState::getTracks() { Vector<TrackEntry *> &AnimationState::getTracks() {
return _tracks; return _tracks;
} }
@ -980,5 +981,3 @@ void AnimationState::animationsChanged() {
} }
} }
} }
}

View File

@ -33,7 +33,8 @@
#include <spine/SkeletonData.h> #include <spine/SkeletonData.h>
#include <spine/Animation.h> #include <spine/Animation.h>
namespace Spine { using namespace Spine;
AnimationStateData::AnimationStateData(SkeletonData *skeletonData) : _skeletonData(skeletonData), _defaultMix(0) { AnimationStateData::AnimationStateData(SkeletonData *skeletonData) : _skeletonData(skeletonData), _defaultMix(0) {
} }
@ -97,4 +98,3 @@ AnimationStateData::HashAnimationPair::operator()(const Spine::AnimationStateDat
return (((h1 << 5) + h1) ^ h2); return (((h1 << 5) + h1) ^ h2);
} }
}

View File

@ -34,7 +34,8 @@
#include <spine/ContainerUtil.h> #include <spine/ContainerUtil.h>
namespace Spine { using namespace Spine;
Atlas::Atlas(const String &path, TextureLoader *textureLoader) : _textureLoader(textureLoader) { Atlas::Atlas(const String &path, TextureLoader *textureLoader) : _textureLoader(textureLoader) {
int dirLength; int dirLength;
char *dir; char *dir;
@ -348,5 +349,3 @@ int Atlas::equals(Str *str, const char *other) {
int Atlas::toInt(Str *str) { int Atlas::toInt(Str *str) {
return (int) strtol(str->begin, (char **) &str->end, 10); return (int) strtol(str->begin, (char **) &str->end, 10);
} }
}

View File

@ -32,7 +32,8 @@
#include <assert.h> #include <assert.h>
namespace Spine { using namespace Spine;
RTTI_IMPL_NOPARENT(Attachment); RTTI_IMPL_NOPARENT(Attachment);
Attachment::Attachment(const String &name) : _name(name) { Attachment::Attachment(const String &name) : _name(name) {
@ -45,4 +46,3 @@ Attachment::~Attachment() {
const String &Attachment::getName() const { const String &Attachment::getName() const {
return _name; return _name;
} }
}

View File

@ -38,7 +38,8 @@
#include <spine/PointAttachment.h> #include <spine/PointAttachment.h>
#include <spine/ClippingAttachment.h> #include <spine/ClippingAttachment.h>
namespace Spine { using namespace Spine;
RTTI_IMPL_NOPARENT(AttachmentLoader); RTTI_IMPL_NOPARENT(AttachmentLoader);
AttachmentLoader::AttachmentLoader() { AttachmentLoader::AttachmentLoader() {
@ -46,4 +47,3 @@ AttachmentLoader::AttachmentLoader() {
AttachmentLoader::~AttachmentLoader() { AttachmentLoader::~AttachmentLoader() {
} }
}

View File

@ -38,7 +38,8 @@
#include <spine/Slot.h> #include <spine/Slot.h>
#include <spine/SlotData.h> #include <spine/SlotData.h>
namespace Spine { using namespace Spine;
RTTI_IMPL(AttachmentTimeline, Timeline); RTTI_IMPL(AttachmentTimeline, Timeline);
AttachmentTimeline::AttachmentTimeline(int frameCount) : Timeline(), _slotIndex(0) { AttachmentTimeline::AttachmentTimeline(int frameCount) : Timeline(), _slotIndex(0) {
@ -108,21 +109,10 @@ const Vector<float> &AttachmentTimeline::getFrames() {
return _frames; return _frames;
} }
void AttachmentTimeline::setFrames(Vector<float> &inValue) {
_frames.clear();
_frames.addAll(inValue);
}
const Vector<String> &AttachmentTimeline::getAttachmentNames() { const Vector<String> &AttachmentTimeline::getAttachmentNames() {
return _attachmentNames; return _attachmentNames;
} }
void AttachmentTimeline::setAttachmentNames(Vector<String> &inValue) {
_attachmentNames.clear();
_attachmentNames.addAll(inValue);
}
int AttachmentTimeline::getFrameCount() { int AttachmentTimeline::getFrameCount() {
return static_cast<int>(_frames.size()); return static_cast<int>(_frames.size());
} }
}

View File

@ -33,7 +33,8 @@
#include <spine/BoneData.h> #include <spine/BoneData.h>
#include <spine/Skeleton.h> #include <spine/Skeleton.h>
namespace Spine { using namespace Spine;
RTTI_IMPL(Bone, Updatable); RTTI_IMPL(Bone, Updatable);
bool Bone::yDown = false; bool Bone::yDown = false;
@ -544,5 +545,3 @@ void Bone::updateAppliedTransform() {
} }
} }
} }
}

View File

@ -32,7 +32,8 @@
#include <assert.h> #include <assert.h>
namespace Spine { using namespace Spine;
BoneData::BoneData(int index, const String &name, BoneData *parent) : BoneData::BoneData(int index, const String &name, BoneData *parent) :
_index(index), _index(index),
_name(name), _name(name),
@ -133,5 +134,3 @@ TransformMode BoneData::getTransformMode() {
void BoneData::setTransformMode(TransformMode inValue) { void BoneData::setTransformMode(TransformMode inValue) {
_transformMode = inValue; _transformMode = inValue;
} }
}

View File

@ -30,9 +30,9 @@
#include <spine/BoundingBoxAttachment.h> #include <spine/BoundingBoxAttachment.h>
namespace Spine { using namespace Spine;
RTTI_IMPL(BoundingBoxAttachment, VertexAttachment); RTTI_IMPL(BoundingBoxAttachment, VertexAttachment);
BoundingBoxAttachment::BoundingBoxAttachment(const String &name) : VertexAttachment(name) { BoundingBoxAttachment::BoundingBoxAttachment(const String &name) : VertexAttachment(name) {
} }
}

View File

@ -32,7 +32,8 @@
#include <spine/SlotData.h> #include <spine/SlotData.h>
namespace Spine { using namespace Spine;
RTTI_IMPL(ClippingAttachment, VertexAttachment); RTTI_IMPL(ClippingAttachment, VertexAttachment);
ClippingAttachment::ClippingAttachment(const String &name) : VertexAttachment(name), _endSlot(NULL) { ClippingAttachment::ClippingAttachment(const String &name) : VertexAttachment(name), _endSlot(NULL) {
@ -45,4 +46,3 @@ SlotData *ClippingAttachment::getEndSlot() {
void ClippingAttachment::setEndSlot(SlotData *inValue) { void ClippingAttachment::setEndSlot(SlotData *inValue) {
_endSlot = inValue; _endSlot = inValue;
} }
}

View File

@ -38,7 +38,8 @@
#include <spine/Slot.h> #include <spine/Slot.h>
#include <spine/SlotData.h> #include <spine/SlotData.h>
namespace Spine { using namespace Spine;
RTTI_IMPL(ColorTimeline, CurveTimeline); RTTI_IMPL(ColorTimeline, CurveTimeline);
const int ColorTimeline::ENTRIES = 5; const int ColorTimeline::ENTRIES = 5;
@ -69,9 +70,9 @@ void ColorTimeline::apply(Skeleton &skeleton, float lastTime, float time, Vector
case MixPose_Current: { case MixPose_Current: {
Color &color = slot.getColor(); Color &color = slot.getColor();
Color &setup = slot.getData().getColor(); Color &setup = slot.getData().getColor();
color.add((setup._r - color._r) * alpha, (setup._g - color._g) * alpha, color.add((setup.r - color.r) * alpha, (setup.g - color.g) * alpha,
(setup._b - color._b) * alpha, (setup.b - color.b) * alpha,
(setup._a - color._a) * alpha); (setup.a - color.a) * alpha);
return; return;
} }
case MixPose_CurrentLayered: case MixPose_CurrentLayered:
@ -110,7 +111,7 @@ void ColorTimeline::apply(Skeleton &skeleton, float lastTime, float time, Vector
} else { } else {
Color &color = slot.getColor(); Color &color = slot.getColor();
if (pose == MixPose_Setup) color.set(slot.getData().getColor()); if (pose == MixPose_Setup) color.set(slot.getData().getColor());
color.add((r - color._r) * alpha, (g - color._g) * alpha, (b - color._b) * alpha, (a - color._a) * alpha); color.add((r - color.r) * alpha, (g - color.g) * alpha, (b - color.b) * alpha, (a - color.a) * alpha);
} }
} }
@ -138,9 +139,3 @@ void ColorTimeline::setSlotIndex(int inValue) {
Vector<float> &ColorTimeline::getFrames() { Vector<float> &ColorTimeline::getFrames() {
return _frames; return _frames;
} }
void ColorTimeline::setFrames(Vector<float> &inValue) {
_frames.clear();
_frames.addAll(inValue);
}
}

View File

@ -30,7 +30,8 @@
#include <spine/Constraint.h> #include <spine/Constraint.h>
namespace Spine { using namespace Spine;
RTTI_IMPL(Constraint, Updatable); RTTI_IMPL(Constraint, Updatable);
Constraint::Constraint() { Constraint::Constraint() {
@ -38,4 +39,3 @@ Constraint::Constraint() {
Constraint::~Constraint() { Constraint::~Constraint() {
} }
}

View File

@ -32,7 +32,8 @@
#include <spine/MathUtil.h> #include <spine/MathUtil.h>
namespace Spine { using namespace Spine;
RTTI_IMPL(CurveTimeline, Timeline); RTTI_IMPL(CurveTimeline, Timeline);
const float CurveTimeline::LINEAR = 0; const float CurveTimeline::LINEAR = 0;
@ -122,4 +123,3 @@ float CurveTimeline::getCurvePercent(int frameIndex, float percent) {
float CurveTimeline::getCurveType(int frameIndex) { float CurveTimeline::getCurveType(int frameIndex) {
return _curves[frameIndex * BEZIER_SIZE]; return _curves[frameIndex * BEZIER_SIZE];
} }
}

View File

@ -40,7 +40,8 @@
#include <spine/Slot.h> #include <spine/Slot.h>
#include <spine/SlotData.h> #include <spine/SlotData.h>
namespace Spine { using namespace Spine;
RTTI_IMPL(DeformTimeline, CurveTimeline); RTTI_IMPL(DeformTimeline, CurveTimeline);
DeformTimeline::DeformTimeline(int frameCount) : CurveTimeline(frameCount), _slotIndex(0), _attachment(NULL) { DeformTimeline::DeformTimeline(int frameCount) : CurveTimeline(frameCount), _slotIndex(0), _attachment(NULL) {
@ -206,20 +207,10 @@ Vector<float> &DeformTimeline::getFrames() {
return _frames; return _frames;
} }
void DeformTimeline::setFrames(Vector<float> &inValue) {
_frames.clear();
_frames.addAll(inValue);
}
Vector<Vector<float> > &DeformTimeline::getVertices() { Vector<Vector<float> > &DeformTimeline::getVertices() {
return _frameVertices; return _frameVertices;
} }
void DeformTimeline::setVertices(Vector<Vector<float> > &inValue) {
_frameVertices.clear();
_frameVertices.addAll(inValue);
}
VertexAttachment *DeformTimeline::getAttachment() { VertexAttachment *DeformTimeline::getAttachment() {
return _attachment; return _attachment;
} }
@ -227,4 +218,3 @@ VertexAttachment *DeformTimeline::getAttachment() {
void DeformTimeline::setAttachment(VertexAttachment *inValue) { void DeformTimeline::setAttachment(VertexAttachment *inValue) {
_attachment = inValue; _attachment = inValue;
} }
}

View File

@ -38,7 +38,8 @@
#include <spine/Slot.h> #include <spine/Slot.h>
#include <spine/SlotData.h> #include <spine/SlotData.h>
namespace Spine { using namespace Spine;
RTTI_IMPL(DrawOrderTimeline, Timeline); RTTI_IMPL(DrawOrderTimeline, Timeline);
DrawOrderTimeline::DrawOrderTimeline(int frameCount) : Timeline() { DrawOrderTimeline::DrawOrderTimeline(int frameCount) : Timeline() {
@ -112,21 +113,10 @@ Vector<float> &DrawOrderTimeline::getFrames() {
return _frames; return _frames;
} }
void DrawOrderTimeline::setFrames(Vector<float> &inValue) {
_frames.clear();
_frames.addAll(inValue);
}
Vector<Vector<int> > &DrawOrderTimeline::getDrawOrders() { Vector<Vector<int> > &DrawOrderTimeline::getDrawOrders() {
return _drawOrders; return _drawOrders;
} }
void DrawOrderTimeline::setDrawOrders(Vector<Vector<int> > &inValue) {
_drawOrders.clear();
_drawOrders.addAll(inValue);
}
int DrawOrderTimeline::getFrameCount() { int DrawOrderTimeline::getFrameCount() {
return static_cast<int>(_frames.size()); return static_cast<int>(_frames.size());
} }
}

View File

@ -32,7 +32,8 @@
#include <spine/EventData.h> #include <spine/EventData.h>
namespace Spine { using namespace Spine;
Event::Event(float time, const EventData &data) : Event::Event(float time, const EventData &data) :
_data(data), _data(data),
_time(time), _time(time),
@ -72,5 +73,3 @@ const String &Event::getStringValue() {
void Event::setStringValue(const String &inValue) { void Event::setStringValue(const String &inValue) {
_stringValue = inValue; _stringValue = inValue;
} }
}

View File

@ -32,7 +32,8 @@
#include <assert.h> #include <assert.h>
namespace Spine { using namespace Spine;
EventData::EventData(const String &name) : EventData::EventData(const String &name) :
_name(name), _name(name),
_intValue(0), _intValue(0),
@ -69,5 +70,3 @@ const String &EventData::getStringValue() {
void EventData::setStringValue(const String &inValue) { void EventData::setStringValue(const String &inValue) {
_stringValue = inValue; _stringValue = inValue;
} }
}

View File

@ -40,7 +40,8 @@
#include <spine/EventData.h> #include <spine/EventData.h>
#include <spine/ContainerUtil.h> #include <spine/ContainerUtil.h>
namespace Spine { using namespace Spine;
RTTI_IMPL(EventTimeline, Timeline); RTTI_IMPL(EventTimeline, Timeline);
EventTimeline::EventTimeline(int frameCount) : Timeline() { EventTimeline::EventTimeline(int frameCount) : Timeline() {
@ -110,16 +111,6 @@ void EventTimeline::setFrame(int frameIndex, Event *event) {
Vector<float> EventTimeline::getFrames() { return _frames; } Vector<float> EventTimeline::getFrames() { return _frames; }
void EventTimeline::setFrames(Vector<float> &inValue) {
_frames.clear();
_frames.addAll(inValue);
} // time, ...
Vector<Event *> &EventTimeline::getEvents() { return _events; } Vector<Event *> &EventTimeline::getEvents() { return _events; }
void EventTimeline::setEvents(Vector<Event *> &inValue) {
_events.clear();
_events.addAll(inValue);
}
int EventTimeline::getFrameCount() { return static_cast<int>(_frames.size()); } int EventTimeline::getFrameCount() { return static_cast<int>(_frames.size()); }
}

View File

@ -33,7 +33,8 @@
#include <assert.h> #include <assert.h>
namespace Spine { using namespace Spine;
DefaultSpineExtension _defaultExtension; DefaultSpineExtension _defaultExtension;
SpineExtension *SpineExtension::_instance = &_defaultExtension; SpineExtension *SpineExtension::_instance = &_defaultExtension;
@ -109,4 +110,3 @@ char *DefaultSpineExtension::_readFile(const String &path, int *length) {
DefaultSpineExtension::DefaultSpineExtension() : SpineExtension() { DefaultSpineExtension::DefaultSpineExtension() : SpineExtension() {
} }
}

View File

@ -36,7 +36,8 @@
#include <spine/BoneData.h> #include <spine/BoneData.h>
namespace Spine { using namespace Spine;
RTTI_IMPL(IkConstraint, Constraint); RTTI_IMPL(IkConstraint, Constraint);
void IkConstraint::apply(Bone &bone, float targetX, float targetY, float alpha) { void IkConstraint::apply(Bone &bone, float targetX, float targetY, float alpha) {
@ -257,5 +258,3 @@ float IkConstraint::getMix() {
void IkConstraint::setMix(float inValue) { void IkConstraint::setMix(float inValue) {
_mix = inValue; _mix = inValue;
} }
}

View File

@ -32,7 +32,8 @@
#include <spine/BoneData.h> #include <spine/BoneData.h>
namespace Spine { using namespace Spine;
IkConstraintData::IkConstraintData(const String &name) : IkConstraintData::IkConstraintData(const String &name) :
_name(name), _name(name),
_order(0), _order(0),
@ -80,5 +81,3 @@ float IkConstraintData::getMix() {
void IkConstraintData::setMix(float inValue) { void IkConstraintData::setMix(float inValue) {
_mix = inValue; _mix = inValue;
} }
}

View File

@ -40,7 +40,8 @@
#include <spine/IkConstraint.h> #include <spine/IkConstraint.h>
#include <spine/IkConstraintData.h> #include <spine/IkConstraintData.h>
namespace Spine { using namespace Spine;
RTTI_IMPL(IkConstraintTimeline, CurveTimeline); RTTI_IMPL(IkConstraintTimeline, CurveTimeline);
const int IkConstraintTimeline::ENTRIES = 3; const int IkConstraintTimeline::ENTRIES = 3;
@ -122,4 +123,3 @@ void IkConstraintTimeline::setFrame(int frameIndex, float time, float mix, int b
_frames[frameIndex + MIX] = mix; _frames[frameIndex + MIX] = mix;
_frames[frameIndex + BEND_DIRECTION] = bendDirection; _frames[frameIndex + BEND_DIRECTION] = bendDirection;
} }
}

View File

@ -48,7 +48,8 @@
#include <assert.h> #include <assert.h>
#include <math.h> #include <math.h>
namespace Spine { using namespace Spine;
const int Json::JSON_FALSE = 0; const int Json::JSON_FALSE = 0;
const int Json::JSON_TRUE = 1; const int Json::JSON_TRUE = 1;
const int Json::JSON_NULL = 2; const int Json::JSON_NULL = 2;
@ -537,5 +538,3 @@ int Json::json_strcasecmp(const char *s1, const char *s2) {
} }
} }
} }
}

View File

@ -32,12 +32,11 @@
#include <spine/MeshAttachment.h> #include <spine/MeshAttachment.h>
namespace Spine { using namespace Spine;
LinkedMesh::LinkedMesh(MeshAttachment *mesh, const String &skin, int slotIndex, const String &parent) : LinkedMesh::LinkedMesh(MeshAttachment *mesh, const String &skin, int slotIndex, const String &parent) :
_mesh(mesh), _mesh(mesh),
_skin(skin), _skin(skin),
_slotIndex(slotIndex), _slotIndex(slotIndex),
_parent(parent) { _parent(parent) {
} }
}

View File

@ -30,7 +30,8 @@
#include <spine/MeshAttachment.h> #include <spine/MeshAttachment.h>
namespace Spine { using namespace Spine;
RTTI_IMPL(MeshAttachment, VertexAttachment); RTTI_IMPL(MeshAttachment, VertexAttachment);
MeshAttachment::MeshAttachment(const String &name) : VertexAttachment(name), MeshAttachment::MeshAttachment(const String &name) : VertexAttachment(name),
@ -90,29 +91,14 @@ Vector<float> &MeshAttachment::getRegionUVs() {
return _regionUVs; return _regionUVs;
} }
void MeshAttachment::setRegionUVs(Vector<float> &inValue) {
_regionUVs.clear();
_regionUVs.addAll(inValue);
}
Vector<float> &MeshAttachment::getUVs() { Vector<float> &MeshAttachment::getUVs() {
return _uvs; return _uvs;
} }
void MeshAttachment::setUVs(Vector<float> &inValue) {
_uvs.clear();
_uvs.addAll(inValue);
}
Vector<unsigned short> &MeshAttachment::getTriangles() { Vector<unsigned short> &MeshAttachment::getTriangles() {
return _triangles; return _triangles;
} }
void MeshAttachment::setTriangles(Vector<unsigned short> &inValue) {
_triangles.clear();
_triangles.addAll(inValue);
}
const String &MeshAttachment::getPath() { const String &MeshAttachment::getPath() {
return _path; return _path;
} }
@ -248,10 +234,6 @@ Vector<unsigned short> &MeshAttachment::getEdges() {
return _edges; return _edges;
} }
void MeshAttachment::setEdges(Vector<unsigned short> &inValue) {
_edges.clearAndAddAll(inValue);
}
float MeshAttachment::getWidth() { float MeshAttachment::getWidth() {
return _width; return _width;
} }
@ -271,5 +253,3 @@ void MeshAttachment::setHeight(float inValue) {
Spine::Color &MeshAttachment::getColor() { Spine::Color &MeshAttachment::getColor() {
return _color; return _color;
} }
}

View File

@ -30,7 +30,8 @@
#include <spine/PathAttachment.h> #include <spine/PathAttachment.h>
namespace Spine { using namespace Spine;
RTTI_IMPL(PathAttachment, VertexAttachment); RTTI_IMPL(PathAttachment, VertexAttachment);
PathAttachment::PathAttachment(const String &name) : VertexAttachment(name), _closed(false), _constantSpeed(false) { PathAttachment::PathAttachment(const String &name) : VertexAttachment(name), _closed(false), _constantSpeed(false) {
@ -40,11 +41,6 @@ Vector<float> &PathAttachment::getLengths() {
return _lengths; return _lengths;
} }
void PathAttachment::setLengths(Vector<float> &inValue) {
_lengths.clear();
_lengths.addAll(inValue);
}
bool PathAttachment::isClosed() { bool PathAttachment::isClosed() {
return _closed; return _closed;
} }
@ -60,5 +56,3 @@ bool PathAttachment::isConstantSpeed() {
void PathAttachment::setConstantSpeed(bool inValue) { void PathAttachment::setConstantSpeed(bool inValue) {
_constantSpeed = inValue; _constantSpeed = inValue;
} }
}

View File

@ -39,7 +39,8 @@
#include <spine/SlotData.h> #include <spine/SlotData.h>
#include <spine/BoneData.h> #include <spine/BoneData.h>
namespace Spine { using namespace Spine;
RTTI_IMPL(PathConstraint, Constraint); RTTI_IMPL(PathConstraint, Constraint);
const float PathConstraint::EPSILON = 0.00001f; const float PathConstraint::EPSILON = 0.00001f;
@ -546,5 +547,3 @@ void PathConstraint::addCurvePosition(float p, float x1, float y1, float cx1, fl
x - (x1 * uu + cx1 * ut * 2 + cx2 * tt)); x - (x1 * uu + cx1 * ut * 2 + cx2 * tt));
} }
} }
}

View File

@ -35,7 +35,8 @@
#include <assert.h> #include <assert.h>
namespace Spine { using namespace Spine;
PathConstraintData::PathConstraintData(const String &name) : PathConstraintData::PathConstraintData(const String &name) :
_name(name), _name(name),
_order(0), _order(0),
@ -138,5 +139,3 @@ float PathConstraintData::getTranslateMix() {
void PathConstraintData::setTranslateMix(float inValue) { void PathConstraintData::setTranslateMix(float inValue) {
_translateMix = inValue; _translateMix = inValue;
} }
}

View File

@ -40,7 +40,8 @@
#include <spine/PathConstraint.h> #include <spine/PathConstraint.h>
#include <spine/PathConstraintData.h> #include <spine/PathConstraintData.h>
namespace Spine { using namespace Spine;
RTTI_IMPL(PathConstraintMixTimeline, CurveTimeline); RTTI_IMPL(PathConstraintMixTimeline, CurveTimeline);
const int PathConstraintMixTimeline::ENTRIES = 3; const int PathConstraintMixTimeline::ENTRIES = 3;
@ -114,4 +115,3 @@ void PathConstraintMixTimeline::setFrame(int frameIndex, float time, float rotat
_frames[frameIndex + ROTATE] = rotateMix; _frames[frameIndex + ROTATE] = rotateMix;
_frames[frameIndex + TRANSLATE] = translateMix; _frames[frameIndex + TRANSLATE] = translateMix;
} }
}

View File

@ -40,7 +40,8 @@
#include <spine/PathConstraint.h> #include <spine/PathConstraint.h>
#include <spine/PathConstraintData.h> #include <spine/PathConstraintData.h>
namespace Spine { using namespace Spine;
RTTI_IMPL(PathConstraintPositionTimeline, CurveTimeline); RTTI_IMPL(PathConstraintPositionTimeline, CurveTimeline);
const int PathConstraintPositionTimeline::ENTRIES = 2; const int PathConstraintPositionTimeline::ENTRIES = 2;
@ -104,4 +105,3 @@ void PathConstraintPositionTimeline::setFrame(int frameIndex, float time, float
_frames[frameIndex] = time; _frames[frameIndex] = time;
_frames[frameIndex + VALUE] = value; _frames[frameIndex + VALUE] = value;
} }
}

View File

@ -40,7 +40,8 @@
#include <spine/PathConstraint.h> #include <spine/PathConstraint.h>
#include <spine/PathConstraintData.h> #include <spine/PathConstraintData.h>
namespace Spine { using namespace Spine;
RTTI_IMPL(PathConstraintSpacingTimeline, PathConstraintPositionTimeline); RTTI_IMPL(PathConstraintSpacingTimeline, PathConstraintPositionTimeline);
PathConstraintSpacingTimeline::PathConstraintSpacingTimeline(int frameCount) : PathConstraintPositionTimeline( PathConstraintSpacingTimeline::PathConstraintSpacingTimeline(int frameCount) : PathConstraintPositionTimeline(
@ -90,4 +91,3 @@ void PathConstraintSpacingTimeline::apply(Skeleton &skeleton, float lastTime, fl
int PathConstraintSpacingTimeline::getPropertyId() { int PathConstraintSpacingTimeline::getPropertyId() {
return ((int) TimelineType_PathConstraintSpacing << 24) + _pathConstraintIndex; return ((int) TimelineType_PathConstraintSpacing << 24) + _pathConstraintIndex;
} }
}

View File

@ -34,7 +34,8 @@
#include <spine/MathUtil.h> #include <spine/MathUtil.h>
namespace Spine { using namespace Spine;
RTTI_IMPL(PointAttachment, Attachment); RTTI_IMPL(PointAttachment, Attachment);
PointAttachment::PointAttachment(const String &name) : Attachment(name), _x(0), _y(0), _rotation(0) { PointAttachment::PointAttachment(const String &name) : Attachment(name), _x(0), _y(0), _rotation(0) {
@ -76,5 +77,3 @@ float PointAttachment::getRotation() {
void PointAttachment::setRotation(float inValue) { void PointAttachment::setRotation(float inValue) {
_rotation = inValue; _rotation = inValue;
} }
}

View File

@ -31,7 +31,8 @@
#include <spine/RTTI.h> #include <spine/RTTI.h>
#include <spine/String.h> #include <spine/String.h>
namespace Spine { using namespace Spine;
RTTI::RTTI(const std::string &className) : _className(className), _pBaseRTTI(NULL) { RTTI::RTTI(const std::string &className) : _className(className), _pBaseRTTI(NULL) {
} }
@ -59,5 +60,3 @@ bool RTTI::instanceOf(const RTTI &rtti) const {
return false; return false;
} }
}

View File

@ -34,7 +34,8 @@
#include <assert.h> #include <assert.h>
namespace Spine { using namespace Spine;
RTTI_IMPL(RegionAttachment, Attachment); RTTI_IMPL(RegionAttachment, Attachment);
const int RegionAttachment::BLX = 0; const int RegionAttachment::BLX = 0;
@ -283,4 +284,3 @@ Vector<float> &RegionAttachment::getUVs() {
Spine::Color &RegionAttachment::getColor() { Spine::Color &RegionAttachment::getColor() {
return _color; return _color;
} }
}

View File

@ -38,7 +38,8 @@
#include <spine/Animation.h> #include <spine/Animation.h>
#include <spine/TimelineType.h> #include <spine/TimelineType.h>
namespace Spine { using namespace Spine;
RTTI_IMPL(RotateTimeline, CurveTimeline); RTTI_IMPL(RotateTimeline, CurveTimeline);
RotateTimeline::RotateTimeline(int frameCount) : CurveTimeline(frameCount), _boneIndex(0) { RotateTimeline::RotateTimeline(int frameCount) : CurveTimeline(frameCount), _boneIndex(0) {
@ -125,8 +126,3 @@ void RotateTimeline::setBoneIndex(int inValue) {
Vector<float> &RotateTimeline::getFrames() { Vector<float> &RotateTimeline::getFrames() {
return _frames; return _frames;
} }
void RotateTimeline::setFrames(Vector<float> inValue) {
_frames.clearAndAddAll(inValue);
}
}

View File

@ -38,7 +38,8 @@
#include <spine/Bone.h> #include <spine/Bone.h>
#include <spine/BoneData.h> #include <spine/BoneData.h>
namespace Spine { using namespace Spine;
RTTI_IMPL(ScaleTimeline, TranslateTimeline); RTTI_IMPL(ScaleTimeline, TranslateTimeline);
ScaleTimeline::ScaleTimeline(int frameCount) : TranslateTimeline(frameCount) { ScaleTimeline::ScaleTimeline(int frameCount) : TranslateTimeline(frameCount) {
@ -111,4 +112,3 @@ void ScaleTimeline::apply(Skeleton &skeleton, float lastTime, float time, Vector
int ScaleTimeline::getPropertyId() { int ScaleTimeline::getPropertyId() {
return ((int) TimelineType_Scale << 24) + _boneIndex; return ((int) TimelineType_Scale << 24) + _boneIndex;
} }
}

View File

@ -38,7 +38,8 @@
#include <spine/Bone.h> #include <spine/Bone.h>
#include <spine/BoneData.h> #include <spine/BoneData.h>
namespace Spine { using namespace Spine;
RTTI_IMPL(ShearTimeline, TranslateTimeline); RTTI_IMPL(ShearTimeline, TranslateTimeline);
ShearTimeline::ShearTimeline(int frameCount) : TranslateTimeline(frameCount) { ShearTimeline::ShearTimeline(int frameCount) : TranslateTimeline(frameCount) {
@ -95,4 +96,3 @@ void ShearTimeline::apply(Skeleton &skeleton, float lastTime, float time, Vector
int ShearTimeline::getPropertyId() { int ShearTimeline::getPropertyId() {
return ((int) TimelineType_Shear << 24) + _boneIndex; return ((int) TimelineType_Shear << 24) + _boneIndex;
} }
}

View File

@ -50,7 +50,8 @@
#include <spine/ContainerUtil.h> #include <spine/ContainerUtil.h>
namespace Spine { using namespace Spine;
Skeleton::Skeleton(SkeletonData *skeletonData) : Skeleton::Skeleton(SkeletonData *skeletonData) :
_data(skeletonData), _data(skeletonData),
_skin(NULL), _skin(NULL),
@ -644,4 +645,3 @@ void Skeleton::sortReset(Vector<Bone *> &bones) {
bone->_sorted = false; bone->_sorted = false;
} }
} }
}

View File

@ -71,7 +71,8 @@
#include <spine/EventTimeline.h> #include <spine/EventTimeline.h>
#include <spine/Event.h> #include <spine/Event.h>
namespace Spine { using namespace Spine;
const int SkeletonBinary::BONE_ROTATE = 0; const int SkeletonBinary::BONE_ROTATE = 0;
const int SkeletonBinary::BONE_TRANSLATE = 1; const int SkeletonBinary::BONE_TRANSLATE = 1;
const int SkeletonBinary::BONE_SCALE = 2; const int SkeletonBinary::BONE_SCALE = 2;
@ -401,10 +402,10 @@ int SkeletonBinary::readInt(DataInput *input) {
} }
void SkeletonBinary::readColor(DataInput *input, Color &color) { void SkeletonBinary::readColor(DataInput *input, Color &color) {
color._r = readByte(input) / 255.0f; color.r = readByte(input) / 255.0f;
color._g = readByte(input) / 255.0f; color.g = readByte(input) / 255.0f;
color._b = readByte(input) / 255.0f; color.b = readByte(input) / 255.0f;
color._a = readByte(input) / 255.0f; color.a = readByte(input) / 255.0f;
} }
int SkeletonBinary::readVarint(DataInput *input, bool optimizePositive) { int SkeletonBinary::readVarint(DataInput *input, bool optimizePositive) {
@ -1008,4 +1009,3 @@ void SkeletonBinary::readCurve(DataInput *input, int frameIndex, CurveTimeline *
} }
} }
} }
}

View File

@ -35,7 +35,8 @@
#include <spine/Slot.h> #include <spine/Slot.h>
namespace Spine { using namespace Spine;
SkeletonBounds::SkeletonBounds() : _minX(0), _minY(0), _maxX(0), _maxY(0) { SkeletonBounds::SkeletonBounds() : _minX(0), _minY(0), _maxX(0), _maxY(0) {
} }
@ -231,6 +232,3 @@ void SkeletonBounds::aabbCompute() {
_maxX = maxX; _maxX = maxX;
_maxY = maxY; _maxY = maxY;
} }
}

View File

@ -33,7 +33,8 @@
#include <spine/Slot.h> #include <spine/Slot.h>
#include <spine/ClippingAttachment.h> #include <spine/ClippingAttachment.h>
namespace Spine { using namespace Spine;
SkeletonClipping::SkeletonClipping() : _clipAttachment(NULL) { SkeletonClipping::SkeletonClipping() : _clipAttachment(NULL) {
_clipOutput.ensureCapacity(128); _clipOutput.ensureCapacity(128);
_clippedVertices.ensureCapacity(128); _clippedVertices.ensureCapacity(128);
@ -315,5 +316,3 @@ void SkeletonClipping::makeClockwise(Vector<float> &polygon) {
polygon[other + 1] = y; polygon[other + 1] = y;
} }
} }
}

View File

@ -41,7 +41,8 @@
#include <spine/ContainerUtil.h> #include <spine/ContainerUtil.h>
namespace Spine { using namespace Spine;
SkeletonData::SkeletonData() : SkeletonData::SkeletonData() :
_name(), _name(),
_defaultSkin(NULL), _defaultSkin(NULL),
@ -131,10 +132,6 @@ Vector<Skin *> &SkeletonData::getSkins() {
return _skins; return _skins;
} }
void SkeletonData::setSkins(Vector<Skin *> &inValue) {
_skins.clearAndAddAll(inValue);
}
Skin *SkeletonData::getDefaultSkin() { Skin *SkeletonData::getDefaultSkin() {
return _defaultSkin; return _defaultSkin;
} }
@ -147,42 +144,22 @@ Vector<EventData *> &SkeletonData::getEvents() {
return _events; return _events;
} }
void SkeletonData::setEvents(Vector<EventData *> &inValue) {
_events.clearAndAddAll(inValue);
}
Vector<Animation *> &SkeletonData::getAnimations() { Vector<Animation *> &SkeletonData::getAnimations() {
return _animations; return _animations;
} }
void SkeletonData::setAnimations(Vector<Animation *> &inValue) {
_animations.clearAndAddAll(inValue);
}
Vector<IkConstraintData *> &SkeletonData::getIkConstraints() { Vector<IkConstraintData *> &SkeletonData::getIkConstraints() {
return _ikConstraints; return _ikConstraints;
} }
void SkeletonData::setIkConstraints(Vector<IkConstraintData *> &inValue) {
_ikConstraints.clearAndAddAll(inValue);
}
Vector<TransformConstraintData *> &SkeletonData::getTransformConstraints() { Vector<TransformConstraintData *> &SkeletonData::getTransformConstraints() {
return _transformConstraints; return _transformConstraints;
} }
void SkeletonData::setTransformConstraints(Vector<TransformConstraintData *> &inValue) {
_transformConstraints.clearAndAddAll(inValue);
}
Vector<PathConstraintData *> &SkeletonData::getPathConstraints() { Vector<PathConstraintData *> &SkeletonData::getPathConstraints() {
return _pathConstraints; return _pathConstraints;
} }
void SkeletonData::setPathConstraints(Vector<PathConstraintData *> &inValue) {
_pathConstraints.clearAndAddAll(inValue);
}
float SkeletonData::getWidth() { float SkeletonData::getWidth() {
return _width; return _width;
} }
@ -230,4 +207,3 @@ float SkeletonData::getFps() {
void SkeletonData::setFps(float inValue) { void SkeletonData::setFps(float inValue) {
_fps = inValue; _fps = inValue;
} }
}

View File

@ -75,7 +75,8 @@
#define strdup _strdup #define strdup _strdup
#endif #endif
namespace Spine { using namespace Spine;
SkeletonJson::SkeletonJson(Atlas *atlas) : _attachmentLoader(new(__FILE__, __LINE__) AtlasAttachmentLoader(atlas)), SkeletonJson::SkeletonJson(Atlas *atlas) : _attachmentLoader(new(__FILE__, __LINE__) AtlasAttachmentLoader(atlas)),
_scale(1), _ownsLoader(true) { _scale(1), _ownsLoader(true) {
} }
@ -210,19 +211,19 @@ SkeletonData *SkeletonJson::readSkeletonData(const char *json) {
color = Json::getString(slotMap, "color", 0); color = Json::getString(slotMap, "color", 0);
if (color) { if (color) {
Color &c = data->getColor(); Color &c = data->getColor();
c._r = toColor(color, 0); c.r = toColor(color, 0);
c._g = toColor(color, 1); c.g = toColor(color, 1);
c._b = toColor(color, 2); c.b = toColor(color, 2);
c._a = toColor(color, 3); c.a = toColor(color, 3);
} }
dark = Json::getString(slotMap, "dark", 0); dark = Json::getString(slotMap, "dark", 0);
if (dark) { if (dark) {
Color &darkColor = data->getDarkColor(); Color &darkColor = data->getDarkColor();
darkColor._r = toColor(dark, 0); darkColor.r = toColor(dark, 0);
darkColor._g = toColor(dark, 1); darkColor.g = toColor(dark, 1);
darkColor._b = toColor(dark, 2); darkColor.b = toColor(dark, 2);
darkColor._a = toColor(dark, 3); darkColor.a = toColor(dark, 3);
data->setHasDarkColor(true); data->setHasDarkColor(true);
} }
@ -487,10 +488,10 @@ SkeletonData *SkeletonJson::readSkeletonData(const char *json) {
color = Json::getString(attachmentMap, "color", 0); color = Json::getString(attachmentMap, "color", 0);
if (color) { if (color) {
region->getColor()._r = toColor(color, 0); region->getColor().r = toColor(color, 0);
region->getColor()._g = toColor(color, 1); region->getColor().g = toColor(color, 1);
region->getColor()._b = toColor(color, 2); region->getColor().b = toColor(color, 2);
region->getColor()._a = toColor(color, 3); region->getColor().a = toColor(color, 3);
} }
region->updateOffset(); region->updateOffset();
@ -506,10 +507,10 @@ SkeletonData *SkeletonJson::readSkeletonData(const char *json) {
color = Json::getString(attachmentMap, "color", 0); color = Json::getString(attachmentMap, "color", 0);
if (color) { if (color) {
mesh->getColor()._r = toColor(color, 0); mesh->getColor().r = toColor(color, 0);
mesh->getColor()._g = toColor(color, 1); mesh->getColor().g = toColor(color, 1);
mesh->getColor()._b = toColor(color, 2); mesh->getColor().b = toColor(color, 2);
mesh->getColor()._a = toColor(color, 3); mesh->getColor().a = toColor(color, 3);
} }
mesh->_width = Json::getFloat(attachmentMap, "width", 32) * _scale; mesh->_width = Json::getFloat(attachmentMap, "width", 32) * _scale;
@ -1185,7 +1186,7 @@ void SkeletonJson::readVertices(Json *attachmentMap, VertexAttachment *attachmen
} }
} }
attachment->setVertices(vertices); attachment->getVertices().clearAndAddAll(vertices);
return; return;
} }
@ -1204,8 +1205,8 @@ void SkeletonJson::readVertices(Json *attachmentMap, VertexAttachment *attachmen
} }
} }
attachment->setVertices(bonesAndWeights._vertices); attachment->getVertices().clearAndAddAll(bonesAndWeights._vertices);
attachment->setBones(bonesAndWeights._bones); attachment->getBones().clearAndAddAll(bonesAndWeights._bones);
} }
void SkeletonJson::setError(Json *root, const String &value1, const String &value2) { void SkeletonJson::setError(Json *root, const String &value1, const String &value2) {
@ -1213,4 +1214,3 @@ void SkeletonJson::setError(Json *root, const String &value1, const String &valu
delete root; delete root;
} }
}

View File

@ -37,7 +37,8 @@
#include <assert.h> #include <assert.h>
namespace Spine { using namespace Spine;
Skin::AttachmentKey::AttachmentKey(int slotIndex, const String &name) : Skin::AttachmentKey::AttachmentKey(int slotIndex, const String &name) :
_slotIndex(slotIndex), _slotIndex(slotIndex),
_name(name) { _name(name) {
@ -122,4 +123,3 @@ void Skin::attachAll(Skeleton &skeleton, Skin &oldSkin) {
} }
} }
} }
}

View File

@ -35,7 +35,8 @@
#include <spine/Skeleton.h> #include <spine/Skeleton.h>
#include <spine/Attachment.h> #include <spine/Attachment.h>
namespace Spine { using namespace Spine;
Slot::Slot(SlotData &data, Bone &bone) : Slot::Slot(SlotData &data, Bone &bone) :
_data(data), _data(data),
_bone(bone), _bone(bone),
@ -113,9 +114,3 @@ void Slot::setAttachmentTime(float inValue) {
Vector<float> &Slot::getAttachmentVertices() { Vector<float> &Slot::getAttachmentVertices() {
return _attachmentVertices; return _attachmentVertices;
} }
void Slot::setAttachmentVertices(Vector<float> &inValue) {
_attachmentVertices.clearAndAddAll(inValue);
}
}

View File

@ -32,7 +32,8 @@
#include <assert.h> #include <assert.h>
namespace Spine { using namespace Spine;
SlotData::SlotData(int index, const String &name, BoneData &boneData) : SlotData::SlotData(int index, const String &name, BoneData &boneData) :
_index(index), _index(index),
_name(name), _name(name),
@ -89,5 +90,3 @@ BlendMode SlotData::getBlendMode() {
void SlotData::setBlendMode(BlendMode inValue) { void SlotData::setBlendMode(BlendMode inValue) {
_blendMode = inValue; _blendMode = inValue;
} }
}

View File

@ -31,7 +31,7 @@
#include <spine/SpineObject.h> #include <spine/SpineObject.h>
#include <spine/Extension.h> #include <spine/Extension.h>
namespace Spine { using namespace Spine;
void *SpineObject::operator new(size_t sz, const char *file, int line) { void *SpineObject::operator new(size_t sz, const char *file, int line) {
return SpineExtension::calloc<SpineObject>(sz, file, line); return SpineExtension::calloc<SpineObject>(sz, file, line);
@ -47,4 +47,3 @@ void SpineObject::operator delete(void *p) {
SpineObject::~SpineObject() { SpineObject::~SpineObject() {
} }
}

View File

@ -36,7 +36,8 @@
#include <spine/BoneData.h> #include <spine/BoneData.h>
namespace Spine { using namespace Spine;
RTTI_IMPL(TransformConstraint, Constraint); RTTI_IMPL(TransformConstraint, Constraint);
TransformConstraint::TransformConstraint(TransformConstraintData &data, Skeleton &skeleton) : Constraint(), TransformConstraint::TransformConstraint(TransformConstraintData &data, Skeleton &skeleton) : Constraint(),
@ -376,4 +377,3 @@ void TransformConstraint::applyRelativeLocal() {
bone.updateWorldTransform(x, y, rotation, scaleX, scaleY, bone._ashearX, shearY); bone.updateWorldTransform(x, y, rotation, scaleX, scaleY, bone._ashearX, shearY);
} }
} }
}

View File

@ -34,7 +34,7 @@
#include <assert.h> #include <assert.h>
namespace Spine { using namespace Spine;
TransformConstraintData::TransformConstraintData(const String &name) : TransformConstraintData::TransformConstraintData(const String &name) :
_name(name), _name(name),
_order(0), _order(0),
@ -117,5 +117,3 @@ bool TransformConstraintData::isRelative() {
bool TransformConstraintData::isLocal() { bool TransformConstraintData::isLocal() {
return _local; return _local;
} }
}

View File

@ -40,7 +40,8 @@
#include <spine/TransformConstraint.h> #include <spine/TransformConstraint.h>
#include <spine/TransformConstraintData.h> #include <spine/TransformConstraintData.h>
namespace Spine { using namespace Spine;
RTTI_IMPL(TransformConstraintTimeline, CurveTimeline); RTTI_IMPL(TransformConstraintTimeline, CurveTimeline);
const int TransformConstraintTimeline::ENTRIES = 5; const int TransformConstraintTimeline::ENTRIES = 5;
@ -137,4 +138,3 @@ TransformConstraintTimeline::setFrame(int frameIndex, float time, float rotateMi
_frames[frameIndex + SCALE] = scaleMix; _frames[frameIndex + SCALE] = scaleMix;
_frames[frameIndex + SHEAR] = shearMix; _frames[frameIndex + SHEAR] = shearMix;
} }
}

View File

@ -38,7 +38,8 @@
#include <spine/Bone.h> #include <spine/Bone.h>
#include <spine/BoneData.h> #include <spine/BoneData.h>
namespace Spine { using namespace Spine;
RTTI_IMPL(TranslateTimeline, CurveTimeline); RTTI_IMPL(TranslateTimeline, CurveTimeline);
const int TranslateTimeline::ENTRIES = 3; const int TranslateTimeline::ENTRIES = 3;
@ -114,4 +115,3 @@ void TranslateTimeline::setFrame(int frameIndex, float time, float x, float y) {
_frames[frameIndex + X] = x; _frames[frameIndex + X] = x;
_frames[frameIndex + Y] = y; _frames[frameIndex + Y] = y;
} }
}

View File

@ -32,7 +32,7 @@
#include <spine/MathUtil.h> #include <spine/MathUtil.h>
namespace Spine { using namespace Spine;
Triangulator::~Triangulator() { Triangulator::~Triangulator() {
ContainerUtil::cleanUpVectorOfPointers(_convexPolygons); ContainerUtil::cleanUpVectorOfPointers(_convexPolygons);
@ -296,5 +296,3 @@ int Triangulator::winding(float p1x, float p1y, float p2x, float p2y, float p3x,
return p3x * py - p3y * px + px * p1y - p1x * py >= 0 ? 1 : -1; return p3x * py - p3y * px + px * p1y - p1x * py >= 0 ? 1 : -1;
} }
}

View File

@ -38,7 +38,8 @@
#include <spine/Slot.h> #include <spine/Slot.h>
#include <spine/SlotData.h> #include <spine/SlotData.h>
namespace Spine { using namespace Spine;
RTTI_IMPL(TwoColorTimeline, CurveTimeline); RTTI_IMPL(TwoColorTimeline, CurveTimeline);
const int TwoColorTimeline::ENTRIES = 8; const int TwoColorTimeline::ENTRIES = 8;
@ -77,15 +78,15 @@ void TwoColorTimeline::apply(Skeleton &skeleton, float lastTime, float time, Vec
return; return;
case MixPose_Current: { case MixPose_Current: {
Color &color = slot.getColor(); Color &color = slot.getColor();
color._r += (color._r - slot._data.getColor()._r) * alpha; color.r += (color.r - slot._data.getColor().r) * alpha;
color._g += (color._g - slot._data.getColor()._g) * alpha; color.g += (color.g - slot._data.getColor().g) * alpha;
color._b += (color._b - slot._data.getColor()._b) * alpha; color.b += (color.b - slot._data.getColor().b) * alpha;
color._a += (color._a - slot._data.getColor()._a) * alpha; color.a += (color.a - slot._data.getColor().a) * alpha;
Color &darkColor = slot.getDarkColor(); Color &darkColor = slot.getDarkColor();
darkColor._r += (darkColor._r - slot._data.getDarkColor()._r) * alpha; darkColor.r += (darkColor.r - slot._data.getDarkColor().r) * alpha;
darkColor._g += (darkColor._g - slot._data.getDarkColor()._g) * alpha; darkColor.g += (darkColor.g - slot._data.getDarkColor().g) * alpha;
darkColor._b += (darkColor._b - slot._data.getDarkColor()._b) * alpha; darkColor.b += (darkColor.b - slot._data.getDarkColor().b) * alpha;
return; return;
} }
case MixPose_CurrentLayered: case MixPose_CurrentLayered:
@ -130,48 +131,48 @@ void TwoColorTimeline::apply(Skeleton &skeleton, float lastTime, float time, Vec
if (alpha == 1) { if (alpha == 1) {
Color &color = slot.getColor(); Color &color = slot.getColor();
color._r = r; color.r = r;
color._g = g; color.g = g;
color._b = b; color.b = b;
color._a = a; color.a = a;
Color &darkColor = slot.getDarkColor(); Color &darkColor = slot.getDarkColor();
darkColor._r = r2; darkColor.r = r2;
darkColor._g = g2; darkColor.g = g2;
darkColor._b = b2; darkColor.b = b2;
} else { } else {
float br, bg, bb, ba, br2, bg2, bb2; float br, bg, bb, ba, br2, bg2, bb2;
if (pose == MixPose_Setup) { if (pose == MixPose_Setup) {
br = slot._data.getColor()._r; br = slot._data.getColor().r;
bg = slot._data.getColor()._g; bg = slot._data.getColor().g;
bb = slot._data.getColor()._b; bb = slot._data.getColor().b;
ba = slot._data.getColor()._a; ba = slot._data.getColor().a;
br2 = slot._data.getDarkColor()._r; br2 = slot._data.getDarkColor().r;
bg2 = slot._data.getDarkColor()._g; bg2 = slot._data.getDarkColor().g;
bb2 = slot._data.getDarkColor()._b; bb2 = slot._data.getDarkColor().b;
} else { } else {
Color &color = slot.getColor(); Color &color = slot.getColor();
br = color._r; br = color.r;
bg = color._g; bg = color.g;
bb = color._b; bb = color.b;
ba = color._a; ba = color.a;
Color &darkColor = slot.getDarkColor(); Color &darkColor = slot.getDarkColor();
br2 = darkColor._r; br2 = darkColor.r;
bg2 = darkColor._g; bg2 = darkColor.g;
bb2 = darkColor._b; bb2 = darkColor.b;
} }
Color &color = slot.getColor(); Color &color = slot.getColor();
color._r = br + ((r - br) * alpha); color.r = br + ((r - br) * alpha);
color._g = bg + ((g - bg) * alpha); color.g = bg + ((g - bg) * alpha);
color._b = bb + ((b - bb) * alpha); color.b = bb + ((b - bb) * alpha);
color._a = ba + ((a - ba) * alpha); color.a = ba + ((a - ba) * alpha);
Color &darkColor = slot.getDarkColor(); Color &darkColor = slot.getDarkColor();
darkColor._r = br2 + ((r2 - br2) * alpha); darkColor.r = br2 + ((r2 - br2) * alpha);
darkColor._g = bg2 + ((g2 - bg2) * alpha); darkColor.g = bg2 + ((g2 - bg2) * alpha);
darkColor._b = bb2 + ((b2 - bb2) * alpha); darkColor.b = bb2 + ((b2 - bb2) * alpha);
} }
} }
@ -200,4 +201,3 @@ void TwoColorTimeline::setSlotIndex(int inValue) {
assert(inValue >= 0); assert(inValue >= 0);
_slotIndex = inValue; _slotIndex = inValue;
} }
}

View File

@ -30,7 +30,8 @@
#include <spine/Updatable.h> #include <spine/Updatable.h>
namespace Spine { using namespace Spine;
RTTI_IMPL_NOPARENT(Updatable); RTTI_IMPL_NOPARENT(Updatable);
Updatable::Updatable() { Updatable::Updatable() {
@ -38,4 +39,3 @@ Updatable::Updatable() {
Updatable::~Updatable() { Updatable::~Updatable() {
} }
}

View File

@ -35,7 +35,8 @@
#include <spine/Bone.h> #include <spine/Bone.h>
#include <spine/Skeleton.h> #include <spine/Skeleton.h>
namespace Spine { using namespace Spine;
RTTI_IMPL(VertexAttachment, Attachment); RTTI_IMPL(VertexAttachment, Attachment);
VertexAttachment::VertexAttachment(const String &name) : Attachment(name), _worldVerticesLength(0), _id(getNextID()) { VertexAttachment::VertexAttachment(const String &name) : Attachment(name), _worldVerticesLength(0), _id(getNextID()) {
@ -130,18 +131,10 @@ Vector<int> &VertexAttachment::getBones() {
return _bones; return _bones;
} }
void VertexAttachment::setBones(Vector<int> inValue) {
_bones.clearAndAddAll(inValue);
}
Vector<float> &VertexAttachment::getVertices() { Vector<float> &VertexAttachment::getVertices() {
return _vertices; return _vertices;
} }
void VertexAttachment::setVertices(Vector<float> inValue) {
_vertices.clearAndAddAll(inValue);
}
int VertexAttachment::getWorldVerticesLength() { int VertexAttachment::getWorldVerticesLength() {
return _worldVerticesLength; return _worldVerticesLength;
} }
@ -155,4 +148,3 @@ int VertexAttachment::getNextID() {
return (nextID++ & 65535) << 11; return (nextID++ & 65535) << 11;
} }
}

View File

@ -146,11 +146,11 @@ void spineboy (SkeletonData* skeletonData, Atlas* atlas) {
bounds.update(*skeleton, true); bounds.update(*skeleton, true);
sf::Vector2i position = sf::Mouse::getPosition(window); sf::Vector2i position = sf::Mouse::getPosition(window);
if (bounds.containsPoint(position.x, position.y)) { if (bounds.containsPoint(position.x, position.y)) {
headSlot->getColor()._g = 0; headSlot->getColor().g = 0;
headSlot->getColor()._b = 0; headSlot->getColor().b = 0;
} else { } else {
headSlot->getColor()._g = 1; headSlot->getColor().g = 1;
headSlot->getColor()._b = 1; headSlot->getColor().b = 1;
} }
drawable->update(delta); drawable->update(delta);

View File

@ -134,20 +134,20 @@ void SkeletonDrawable::draw(RenderTarget &target, RenderStates states) const {
continue; continue;
} else continue; } else continue;
Uint8 r = static_cast<Uint8>(skeleton->getColor()._r * slot.getColor()._r * attachmentColor->_r * 255); Uint8 r = static_cast<Uint8>(skeleton->getColor().r * slot.getColor().r * attachmentColor->r * 255);
Uint8 g = static_cast<Uint8>(skeleton->getColor()._g * slot.getColor()._g * attachmentColor->_g * 255); Uint8 g = static_cast<Uint8>(skeleton->getColor().g * slot.getColor().g * attachmentColor->g * 255);
Uint8 b = static_cast<Uint8>(skeleton->getColor()._b * slot.getColor()._b * attachmentColor->_b * 255); Uint8 b = static_cast<Uint8>(skeleton->getColor().b * slot.getColor().b * attachmentColor->b * 255);
Uint8 a = static_cast<Uint8>(skeleton->getColor()._a * slot.getColor()._a * attachmentColor->_a * 255); Uint8 a = static_cast<Uint8>(skeleton->getColor().a * slot.getColor().a * attachmentColor->a * 255);
vertex.color.r = r; vertex.color.r = r;
vertex.color.g = g; vertex.color.g = g;
vertex.color.b = b; vertex.color.b = b;
vertex.color.a = a; vertex.color.a = a;
Color light; Color light;
light._r = r / 255.0f; light.r = r / 255.0f;
light._g = g / 255.0f; light.g = g / 255.0f;
light._b = b / 255.0f; light.b = b / 255.0f;
light._a = a / 255.0f; light.a = a / 255.0f;
sf::BlendMode blend; sf::BlendMode blend;
if (!usePremultipliedAlpha) { if (!usePremultipliedAlpha) {
@ -212,7 +212,7 @@ void SkeletonDrawable::draw(RenderTarget &target, RenderStates states) const {
for (int i = 0; i < verticesCount; i++) { for (int i = 0; i < verticesCount; i++) {
Color vertexColor = light; Color vertexColor = light;
Color dark; Color dark;
dark._r = dark._g = dark._b = dark._a = 0; dark.r = dark.g = dark.b = dark.a = 0;
int index = i << 1; int index = i << 1;
float x = (*vertices)[index]; float x = (*vertices)[index];
float y = (*vertices)[index + 1]; float y = (*vertices)[index + 1];
@ -233,10 +233,10 @@ void SkeletonDrawable::draw(RenderTarget &target, RenderStates states) const {
vertex.texCoords.x = (*uvs)[index] * size.x; vertex.texCoords.x = (*uvs)[index] * size.x;
vertex.texCoords.y = (*uvs)[index + 1] * size.y; vertex.texCoords.y = (*uvs)[index + 1] * size.y;
Color vertexColor = tempColors[index >> 1]; Color vertexColor = tempColors[index >> 1];
vertex.color.r = static_cast<Uint8>(vertexColor._r * 255); vertex.color.r = static_cast<Uint8>(vertexColor.r * 255);
vertex.color.g = static_cast<Uint8>(vertexColor._g * 255); vertex.color.g = static_cast<Uint8>(vertexColor.g * 255);
vertex.color.b = static_cast<Uint8>(vertexColor._b * 255); vertex.color.b = static_cast<Uint8>(vertexColor.b * 255);
vertex.color.a = static_cast<Uint8>(vertexColor._a * 255); vertex.color.a = static_cast<Uint8>(vertexColor.a * 255);
vertexArray->append(vertex); vertexArray->append(vertex);
} }
} else { } else {