[cpp] Completed 4.0 port.

This commit is contained in:
badlogic 2021-03-06 10:03:31 +01:00
parent 1a928d9c65
commit f8560fc551
6 changed files with 6 additions and 20 deletions

View File

@ -91,7 +91,6 @@ public:
float offsetX, offsetY;
int originalWidth, originalHeight;
int index;
bool rotate;
int degrees;
Vector<int> splits;
Vector<int> pads;

View File

@ -78,9 +78,6 @@ namespace spine {
float getRegionV2();
void setRegionV2(float inValue);
bool getRegionRotate();
void setRegionRotate(bool inValue);
int getRegionDegrees();
void setRegionDegrees(int inValue);
@ -135,7 +132,6 @@ namespace spine {
float _height;
Color _color;
int _hullLength;
bool _regionRotate;
int _regionDegrees;
};
}

View File

@ -60,7 +60,7 @@ RegionAttachment *AtlasAttachmentLoader::newRegionAttachment(Skin &skin, const S
RegionAttachment &attachment = *attachmentP;
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._regionOffsetY = region.offsetY;
attachment._regionWidth = (float)region.width;
@ -86,7 +86,6 @@ MeshAttachment *AtlasAttachmentLoader::newMeshAttachment(Skin &skin, const Strin
attachment._regionV = region.v;
attachment._regionU2 = region.u2;
attachment._regionV2 = region.v2;
attachment._regionRotate = region.rotate;
attachment._regionDegrees = region.degrees;
attachment._regionOffsetX = region.offsetX;
attachment._regionOffsetY = region.offsetY;

View File

@ -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->_type == JSON_NULL) return false;
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;
} else {
return defaultValue;

View File

@ -55,7 +55,6 @@ MeshAttachment::MeshAttachment(const String &name) : VertexAttachment(name), Has
_height(0),
_color(1, 1, 1, 1),
_hullLength(0),
_regionRotate(false),
_regionDegrees(0)
{}
@ -185,14 +184,6 @@ void MeshAttachment::setRegionV2(float inValue) {
_regionV2 = inValue;
}
bool MeshAttachment::getRegionRotate() {
return _regionRotate;
}
void MeshAttachment::setRegionRotate(bool inValue) {
_regionRotate = inValue;
}
int MeshAttachment::getRegionDegrees() {
return _regionDegrees;
}
@ -301,7 +292,6 @@ Attachment* MeshAttachment::copy() {
copy->_regionV = _regionV;
copy->_regionU2 = _regionU2;
copy->_regionV2 = _regionV2;
copy->_regionRotate = _regionRotate;
copy->_regionDegrees = _regionDegrees;
copy->_regionOffsetX = _regionOffsetX;
copy->_regionOffsetY = _regionOffsetY;
@ -332,7 +322,6 @@ MeshAttachment* MeshAttachment::newLinkedMesh() {
copy->_regionV = _regionV;
copy->_regionU2 = _regionU2;
copy->_regionV2 = _regionV2;
copy->_regionRotate = _regionRotate;
copy->_regionDegrees = _regionDegrees;
copy->_regionOffsetX = _regionOffsetX;
copy->_regionOffsetY = _regionOffsetY;

View File

@ -100,7 +100,7 @@ static float toColor(const char *value, size_t index) {
static void toColor(Color &color, const char *value, bool hasAlpha) {
color.r = toColor(value, 0);
color.g = toColor(value, 1);
color.g = toColor(value, 2);
color.b = toColor(value, 2);
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;
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;
if (!nextMap) break;