[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();
Vector<Timeline *> getTimelines();
void setTimelines(Vector<Timeline *> &inValue);
Vector<Timeline *> &getTimelines();
float getDuration();

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -40,7 +40,8 @@
#include <spine/IkConstraint.h>
#include <spine/IkConstraintData.h>
namespace Spine {
using namespace Spine;
RTTI_IMPL(IkConstraintTimeline, CurveTimeline);
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 + BEND_DIRECTION] = bendDirection;
}
}

View File

@ -48,7 +48,8 @@
#include <assert.h>
#include <math.h>
namespace Spine {
using namespace Spine;
const int Json::JSON_FALSE = 0;
const int Json::JSON_TRUE = 1;
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>
namespace Spine {
using namespace Spine;
LinkedMesh::LinkedMesh(MeshAttachment *mesh, const String &skin, int slotIndex, const String &parent) :
_mesh(mesh),
_skin(skin),
_slotIndex(slotIndex),
_parent(parent) {
}
}

View File

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

View File

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

View File

@ -39,7 +39,8 @@
#include <spine/SlotData.h>
#include <spine/BoneData.h>
namespace Spine {
using namespace Spine;
RTTI_IMPL(PathConstraint, Constraint);
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));
}
}
}

View File

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

View File

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

View File

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

View File

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

View File

@ -34,7 +34,8 @@
#include <spine/MathUtil.h>
namespace Spine {
using namespace Spine;
RTTI_IMPL(PointAttachment, Attachment);
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) {
_rotation = inValue;
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -71,7 +71,8 @@
#include <spine/EventTimeline.h>
#include <spine/Event.h>
namespace Spine {
using namespace Spine;
const int SkeletonBinary::BONE_ROTATE = 0;
const int SkeletonBinary::BONE_TRANSLATE = 1;
const int SkeletonBinary::BONE_SCALE = 2;
@ -401,10 +402,10 @@ int SkeletonBinary::readInt(DataInput *input) {
}
void SkeletonBinary::readColor(DataInput *input, Color &color) {
color._r = readByte(input) / 255.0f;
color._g = readByte(input) / 255.0f;
color._b = readByte(input) / 255.0f;
color._a = readByte(input) / 255.0f;
color.r = readByte(input) / 255.0f;
color.g = readByte(input) / 255.0f;
color.b = readByte(input) / 255.0f;
color.a = readByte(input) / 255.0f;
}
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>
namespace Spine {
using namespace Spine;
SkeletonBounds::SkeletonBounds() : _minX(0), _minY(0), _maxX(0), _maxY(0) {
}
@ -231,6 +232,3 @@ void SkeletonBounds::aabbCompute() {
_maxX = maxX;
_maxY = maxY;
}
}

View File

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

View File

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

View File

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

View File

@ -37,7 +37,8 @@
#include <assert.h>
namespace Spine {
using namespace Spine;
Skin::AttachmentKey::AttachmentKey(int slotIndex, const String &name) :
_slotIndex(slotIndex),
_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/Attachment.h>
namespace Spine {
using namespace Spine;
Slot::Slot(SlotData &data, Bone &bone) :
_data(data),
_bone(bone),
@ -113,9 +114,3 @@ void Slot::setAttachmentTime(float inValue) {
Vector<float> &Slot::getAttachmentVertices() {
return _attachmentVertices;
}
void Slot::setAttachmentVertices(Vector<float> &inValue) {
_attachmentVertices.clearAndAddAll(inValue);
}
}

View File

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

View File

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

View File

@ -36,7 +36,8 @@
#include <spine/BoneData.h>
namespace Spine {
using namespace Spine;
RTTI_IMPL(TransformConstraint, 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);
}
}
}

View File

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

View File

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

View File

@ -38,7 +38,8 @@
#include <spine/Bone.h>
#include <spine/BoneData.h>
namespace Spine {
using namespace Spine;
RTTI_IMPL(TranslateTimeline, CurveTimeline);
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 + Y] = y;
}
}

View File

@ -32,7 +32,7 @@
#include <spine/MathUtil.h>
namespace Spine {
using namespace Spine;
Triangulator::~Triangulator() {
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;
}
}

View File

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

View File

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

View File

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

View File

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

View File

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