mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
[cpp] Completed 4.0 port.
This commit is contained in:
parent
1a928d9c65
commit
f8560fc551
@ -91,7 +91,6 @@ public:
|
|||||||
float offsetX, offsetY;
|
float offsetX, offsetY;
|
||||||
int originalWidth, originalHeight;
|
int originalWidth, originalHeight;
|
||||||
int index;
|
int index;
|
||||||
bool rotate;
|
|
||||||
int degrees;
|
int degrees;
|
||||||
Vector<int> splits;
|
Vector<int> splits;
|
||||||
Vector<int> pads;
|
Vector<int> pads;
|
||||||
|
|||||||
@ -78,9 +78,6 @@ namespace spine {
|
|||||||
float getRegionV2();
|
float getRegionV2();
|
||||||
void setRegionV2(float inValue);
|
void setRegionV2(float inValue);
|
||||||
|
|
||||||
bool getRegionRotate();
|
|
||||||
void setRegionRotate(bool inValue);
|
|
||||||
|
|
||||||
int getRegionDegrees();
|
int getRegionDegrees();
|
||||||
void setRegionDegrees(int inValue);
|
void setRegionDegrees(int inValue);
|
||||||
|
|
||||||
@ -135,7 +132,6 @@ namespace spine {
|
|||||||
float _height;
|
float _height;
|
||||||
Color _color;
|
Color _color;
|
||||||
int _hullLength;
|
int _hullLength;
|
||||||
bool _regionRotate;
|
|
||||||
int _regionDegrees;
|
int _regionDegrees;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@ -60,7 +60,7 @@ RegionAttachment *AtlasAttachmentLoader::newRegionAttachment(Skin &skin, const S
|
|||||||
|
|
||||||
RegionAttachment &attachment = *attachmentP;
|
RegionAttachment &attachment = *attachmentP;
|
||||||
attachment.setRendererObject(regionP);
|
attachment.setRendererObject(regionP);
|
||||||
attachment.setUVs(region.u, region.v, region.u2, region.v2, region.rotate);
|
attachment.setUVs(region.u, region.v, region.u2, region.v2, region.degrees);
|
||||||
attachment._regionOffsetX = region.offsetX;
|
attachment._regionOffsetX = region.offsetX;
|
||||||
attachment._regionOffsetY = region.offsetY;
|
attachment._regionOffsetY = region.offsetY;
|
||||||
attachment._regionWidth = (float)region.width;
|
attachment._regionWidth = (float)region.width;
|
||||||
@ -86,7 +86,6 @@ MeshAttachment *AtlasAttachmentLoader::newMeshAttachment(Skin &skin, const Strin
|
|||||||
attachment._regionV = region.v;
|
attachment._regionV = region.v;
|
||||||
attachment._regionU2 = region.u2;
|
attachment._regionU2 = region.u2;
|
||||||
attachment._regionV2 = region.v2;
|
attachment._regionV2 = region.v2;
|
||||||
attachment._regionRotate = region.rotate;
|
|
||||||
attachment._regionDegrees = region.degrees;
|
attachment._regionDegrees = region.degrees;
|
||||||
attachment._regionOffsetX = region.offsetX;
|
attachment._regionOffsetX = region.offsetX;
|
||||||
attachment._regionOffsetY = region.offsetY;
|
attachment._regionOffsetY = region.offsetY;
|
||||||
|
|||||||
@ -99,6 +99,8 @@ bool Json::getBoolean(spine::Json *value, const char *name, bool defaultValue) {
|
|||||||
if (value->_valueString) return strcmp(value->_valueString, "true") == 0;
|
if (value->_valueString) return strcmp(value->_valueString, "true") == 0;
|
||||||
if (value->_type == JSON_NULL) return false;
|
if (value->_type == JSON_NULL) return false;
|
||||||
if (value->_type == JSON_NUMBER) return value->_valueFloat != 0;
|
if (value->_type == JSON_NUMBER) return value->_valueFloat != 0;
|
||||||
|
if (value->_type == JSON_FALSE) return false;
|
||||||
|
if (value->_type == JSON_TRUE) return true;
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
} else {
|
} else {
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
|
|||||||
@ -55,7 +55,6 @@ MeshAttachment::MeshAttachment(const String &name) : VertexAttachment(name), Has
|
|||||||
_height(0),
|
_height(0),
|
||||||
_color(1, 1, 1, 1),
|
_color(1, 1, 1, 1),
|
||||||
_hullLength(0),
|
_hullLength(0),
|
||||||
_regionRotate(false),
|
|
||||||
_regionDegrees(0)
|
_regionDegrees(0)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
@ -185,14 +184,6 @@ void MeshAttachment::setRegionV2(float inValue) {
|
|||||||
_regionV2 = inValue;
|
_regionV2 = inValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MeshAttachment::getRegionRotate() {
|
|
||||||
return _regionRotate;
|
|
||||||
}
|
|
||||||
|
|
||||||
void MeshAttachment::setRegionRotate(bool inValue) {
|
|
||||||
_regionRotate = inValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
int MeshAttachment::getRegionDegrees() {
|
int MeshAttachment::getRegionDegrees() {
|
||||||
return _regionDegrees;
|
return _regionDegrees;
|
||||||
}
|
}
|
||||||
@ -301,7 +292,6 @@ Attachment* MeshAttachment::copy() {
|
|||||||
copy->_regionV = _regionV;
|
copy->_regionV = _regionV;
|
||||||
copy->_regionU2 = _regionU2;
|
copy->_regionU2 = _regionU2;
|
||||||
copy->_regionV2 = _regionV2;
|
copy->_regionV2 = _regionV2;
|
||||||
copy->_regionRotate = _regionRotate;
|
|
||||||
copy->_regionDegrees = _regionDegrees;
|
copy->_regionDegrees = _regionDegrees;
|
||||||
copy->_regionOffsetX = _regionOffsetX;
|
copy->_regionOffsetX = _regionOffsetX;
|
||||||
copy->_regionOffsetY = _regionOffsetY;
|
copy->_regionOffsetY = _regionOffsetY;
|
||||||
@ -332,7 +322,6 @@ MeshAttachment* MeshAttachment::newLinkedMesh() {
|
|||||||
copy->_regionV = _regionV;
|
copy->_regionV = _regionV;
|
||||||
copy->_regionU2 = _regionU2;
|
copy->_regionU2 = _regionU2;
|
||||||
copy->_regionV2 = _regionV2;
|
copy->_regionV2 = _regionV2;
|
||||||
copy->_regionRotate = _regionRotate;
|
|
||||||
copy->_regionDegrees = _regionDegrees;
|
copy->_regionDegrees = _regionDegrees;
|
||||||
copy->_regionOffsetX = _regionOffsetX;
|
copy->_regionOffsetX = _regionOffsetX;
|
||||||
copy->_regionOffsetY = _regionOffsetY;
|
copy->_regionOffsetY = _regionOffsetY;
|
||||||
|
|||||||
@ -100,7 +100,7 @@ static float toColor(const char *value, size_t index) {
|
|||||||
static void toColor(Color &color, const char *value, bool hasAlpha) {
|
static void toColor(Color &color, const char *value, bool hasAlpha) {
|
||||||
color.r = toColor(value, 0);
|
color.r = toColor(value, 0);
|
||||||
color.g = toColor(value, 1);
|
color.g = toColor(value, 1);
|
||||||
color.g = toColor(value, 2);
|
color.b = toColor(value, 2);
|
||||||
if (hasAlpha) color.a = toColor(value, 3);
|
if (hasAlpha) color.a = toColor(value, 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1036,7 +1036,8 @@ Animation *SkeletonJson::readAnimation(Json *root, SkeletonData *skeletonData) {
|
|||||||
float softness = Json::getFloat(keyMap, "softness", 0) * _scale;
|
float softness = Json::getFloat(keyMap, "softness", 0) * _scale;
|
||||||
|
|
||||||
for (frame = 0, bezier = 0;; frame++) {
|
for (frame = 0, bezier = 0;; frame++) {
|
||||||
timeline->setFrame(frame, time, mix, softness, Json::getBoolean(keyMap, "bendPositive", true) ? 1 : -1, Json::getBoolean(keyMap, "compress", false), Json::getBoolean(keyMap, "stretch", false));
|
int bendDirection = Json::getBoolean(keyMap, "bendPositive", true) ? 1 : -1;
|
||||||
|
timeline->setFrame(frame, time, mix, softness, bendDirection, Json::getBoolean(keyMap, "compress", false), Json::getBoolean(keyMap, "stretch", false));
|
||||||
nextMap = keyMap->_next;
|
nextMap = keyMap->_next;
|
||||||
if (!nextMap) break;
|
if (!nextMap) break;
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user