Skip to content

Commit

Permalink
fix rescaling algo
Browse files Browse the repository at this point in the history
  • Loading branch information
RayDeeUx committed Dec 11, 2024
1 parent f26320b commit 63f778e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/EndLevelLayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,8 @@ class $modify(MyEndLevelLayer, EndLevelLayer) {
const float contentHeight = newSprite->getContentHeight();
if (contentHeight < 36.5f) newSprite->setScale(36.5f / contentHeight);
else if (contentHeight > 50.f) newSprite->setScaleY(50.f / contentHeight);
const float contentWidth = newSprite->getContentWidth() * newSprite->getScaleX();
if (contentWidth > 400.f) newSprite->setScaleX(400.f / contentWidth);
const float contentWidth = newSprite->getContentWidth();
if (contentWidth * newSprite->getScaleX() > 400.f) newSprite->setScaleX(400.f / contentWidth);
}
} else if (manager->chosenMode == "Oxygene One" && !manager->sharedReplacementLabel.empty()) {
CCLabelBMFont* newLabel = CCLabelBMFont::create(manager->sharedReplacementLabel.c_str(), "levelCompleteFont.fnt"_spr);
Expand Down
4 changes: 2 additions & 2 deletions src/PlayLayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ class $modify(MyPlayLayer, PlayLayer) {
const float contentHeight = newSprite->getContentHeight();
if (contentHeight < 36.5f) newSprite->setScale(36.5f / contentHeight);
else if (contentHeight > 150.f) newSprite->setScaleY(150.f / contentHeight);
const float contentWidth = newSprite->getContentWidth() * newSprite->getScaleX();
if (contentWidth > 400.f) newSprite->setScaleX(400.f / contentWidth);
const float contentWidth = newSprite->getContentWidth();
if (contentWidth * newSprite->getScaleX() > 400.f) newSprite->setScaleX(400.f / contentWidth);
}
lctReplaced = true;
}
Expand Down

0 comments on commit 63f778e

Please sign in to comment.