SOLVED: During migration the orientation in our android app manifest was set to landscape, which apparently caused the applicationResized code to be triggered before the app is fully initialized, which was causing some problems.
Hiya!
The furthest I got in migrating our project from Cocos2d-x 3.14 ~ 3.15, and I’m stuck on a really really weird issue on Android.
Currently whenever I run the app I crash when trying to access my Sprite *background
on the following line:
if (this->background == NULL) {
The variable is declared in my Gameboard.hpp file, yet it always gives me a SEGFAULT error.
If I create a local variable in the function and use that one instead, everything works perfectly fine. It just keeps breaking when I try to declare it in the header and access it through this->
void GameBoard::setupBackground() {
cocos2d::Size visibleSize = Director::getInstance()->getVisibleSize();
Vec2 origin = Director::getInstance()->getVisibleOrigin();
--> if (this->background == NULL) { <--
#if CC_TARGET_PLATFORM == CC_PLATFORM_IOS
this->background = Sprite::create("bg_fill.pvr.ccz");
if(!ResolutionUtils::getInstance()->isTablet()) this->background->setScale(0.65);
#else
this->background = Sprite::create("bg_fill.png");
#endif
this->background->setAnchorPoint(Vec2(0.5, 1));
this->addChild(background);
}
...
}