Black Screen instead of Splash Screen sprite

Black Screen instead of Splash Screen sprite
0.0 0



I’m implementing an ios-like loading screen on android and I do it by showing at the very start a simple CCScene derived object with one sprite inside which in turn contains a full-screen image. Now doesnot matter what I do, I always see only black screen! This drives me crazy - I believe I just miss something trivial … Can you please look at my code?

This is how scene is constructed:

bool CABLoadScene::init() { if( CCScene::init() ) { layer = CCLayer::create(); addChild(layer); image = CCSprite::createWithSpriteFrameName("Framework::LoadScreen"); if (image) { image->retain(); layer->addChild(image); } return true; } }

And it’s started in applicationDidFinishLaunching() like this:

@ loadScene = CABLoadScene::create();

I’ve alredy checked that image is available, loadable, all objects are created properly. What do I miss?


I’ve made further investigation: the issue is not with displaying sprite, but with delayed/blocked execution.
At the very start I do following:

  • Init Director/View
  • Create SplashScene
  • Director~~>runWithScene
    <here start loading resources, takes 2-3 seconds>
    >~~ Create first normal scene, switch to it

So if I remove loading resources, then I immediately see the splash scene, then quickly replaced with first one. That means loading resources somehow either blocks the director or really consumes so much CPU so director is not executed (but this again, should not be the case as we have only one thread, right?).

Anyone familiar with such an issue?


You know why I love this forum? Because while I’m formulating my questions and waiting for replies from others, I inevitably find the solution by myself. :wink: In this case I simply failed to realize that cocos2d-x is single-threaded, that means ano other code has no chances to be executed until you are still inside execution of current method.

So now I run the Splash Scene, schedule a selector after 0.1 s which continues to load the resources. Problem solved.


Armie can you please paste some code. I am facing same issue in android