Skip to content

Commit

Permalink
Bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
Alphalaneous committed Dec 27, 2024
1 parent 1dda2e0 commit bfa776f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
3 changes: 3 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 1.8.3
- Fix loading individual sprites from init

## 1.8.2
- Fix some layouting issues
- Fix duplicated node modifications for certain layers
Expand Down
2 changes: 1 addition & 1 deletion mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"android": "2.2074",
"mac": "2.2074"
},
"version": "v1.8.2",
"version": "v1.8.3",
"id": "alphalaneous.happy_textures",
"name": "Happy Textures :3",
"developer": "Alphalaneous",
Expand Down
6 changes: 3 additions & 3 deletions src/nodes/CCSprite.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@
class $modify(MyCCSprite, CCSprite) {

static void onModify(auto& self) {
(void) self.setHookPriority("cocos2d::CCSprite::createWithSpriteFrameName", Priority::VeryEarly);
(void) self.setHookPriority("cocos2d::CCSprite::initWithSpriteFrameName", Priority::VeryEarly);
}

static CCSprite* createWithSpriteFrameName(const char *pszSpriteFrameName) {
bool initWithSpriteFrameName(const char *pszSpriteFrameName) {
if (Utils::spriteExistsInPacks(pszSpriteFrameName)) {

CCSprite* spr = CCSprite::create(pszSpriteFrameName);
auto spriteFrame = CCSpriteFrame::createWithTexture(spr->getTexture(), spr->getTextureRect());
CCSpriteFrameCache::get()->addSpriteFrame(spriteFrame, pszSpriteFrameName);
}

return CCSprite::createWithSpriteFrameName(pszSpriteFrameName);
return CCSprite::initWithSpriteFrameName(pszSpriteFrameName);
}
};

0 comments on commit bfa776f

Please sign in to comment.