[cpp] MSVC fixes

This commit is contained in:
badlogic 2025-09-10 13:08:08 +02:00
parent b33e13f985
commit ef57000eab
2 changed files with 16 additions and 15 deletions

View File

@ -163,12 +163,12 @@ void BonePose::updateLocalTransform(Skeleton &skeleton) {
if (_bone->getParent() == nullptr) {
_x = _worldX - skeleton.getX();
_y = _worldY - skeleton.getY();
float _a = this->_a, _b = this->_b, _c = this->_c, _d = this->_d;
_rotation = MathUtil::atan2(_c, _a) * MathUtil::Rad_Deg;
_scaleX = MathUtil::sqrt(_a * _a + _c * _c);
_scaleY = MathUtil::sqrt(_b * _b + _d * _d);
float a = this->_a, b = this->_b, c = this->_c, d = this->_d;
_rotation = MathUtil::atan2(c, a) * MathUtil::Rad_Deg;
_scaleX = MathUtil::sqrt(a * a + c * c);
_scaleY = MathUtil::sqrt(b * b + d * d);
_shearX = 0;
_shearY = MathUtil::atan2(_a * _b + _c * _d, _a * _d - _b * _c) * MathUtil::Rad_Deg;
_shearY = MathUtil::atan2(a * b + c * d, a * d - b * c) * MathUtil::Rad_Deg;
return;
}
@ -306,16 +306,16 @@ float BonePose::getWorldX() {
return _worldX;
}
void BonePose::setWorldX(float _worldX) {
this->_worldX = _worldX;
void BonePose::setWorldX(float worldX) {
this->_worldX = worldX;
}
float BonePose::getWorldY() {
return _worldY;
}
void BonePose::setWorldY(float _worldY) {
this->_worldY = _worldY;
void BonePose::setWorldY(float worldY) {
this->_worldY = worldY;
}
float BonePose::getWorldRotationX() {
@ -337,9 +337,9 @@ float BonePose::getWorldScaleY() {
void BonePose::worldToLocal(float worldX, float worldY, float &outLocalX, float &outLocalY) {
float det = _a * _d - _b * _c;
float _x = worldX - _worldX, _y = worldY - _worldY;
outLocalX = (_x * _d - _y * _b) / det;
outLocalY = (_y * _a - _x * _c) / det;
float x = worldX - _worldX, y = worldY - _worldY;
outLocalX = (x * _d - y * _b) / det;
outLocalY = (y * _a - x * _c) / det;
}
void BonePose::localToWorld(float localX, float localY, float &outWorldX, float &outWorldY) {

View File

@ -116,7 +116,7 @@ SkeletonData *SkeletonBinary::readSkeletonDataFile(const String &path) {
String nameWithoutExtension(filename);
const char *lastDot = strrchr(nameWithoutExtension.buffer(), '.');
if (lastDot) {
int length = (int) (lastDot - nameWithoutExtension.buffer());
length = (int) (lastDot - nameWithoutExtension.buffer());
nameWithoutExtension = nameWithoutExtension.substring(0, length);
}
skeletonData->_name = nameWithoutExtension;
@ -464,7 +464,8 @@ SkeletonData *SkeletonBinary::readSkeletonData(const unsigned char *binary, cons
/* Linked meshes. */
Array<LinkedMesh *> &items = _linkedMeshes;
for (int i = 0, n = (int) items.size(); i < n; i++) {
n = (int) items.size();
for (int i = 0; i < n; i++) {
LinkedMesh *linkedMesh = items[i];
Skin *skin = skeletonData->_skins[linkedMesh->_skinIndex];
Attachment *parent = skin->getAttachment(linkedMesh->_slotIndex, linkedMesh->_parent);
@ -1248,7 +1249,7 @@ Animation *SkeletonBinary::readAnimation(DataInput &input, const String &name, S
if (end == 0) {
if (weighted) {
deform.setSize(deformLength, 0);
for (int i = 0; i < deformLength; ++i) deform[i] = 0;
for (int iiii = 0; iiii < deformLength; ++iiii) deform[iiii] = 0;
} else {
deform.clearAndAddAll(vertices);
}