Null CCSprite issue and how do I apply m_pNotificationNode in CCDirector

Null CCSprite issue and how do I apply m_pNotificationNode in CCDirector
0.0 0


Here are some problems when I developed a cocos2dx game in my company a null ccsprite safely. In my project, sometimes, many sprites need to attach to a null sprite as a parent node which has no texture, layer could not satisfy my requirement, since some action could not be applied when using layer.
However, after 1.00, in the ccsprite constructor didn’t call init() any more, the error arouse since the member variables didn’t initialized
my suggestion is to add a new static function to build the null sprite, besides, move the constructor ccsprit to protected member variables to avoid developer calling it directly.

Another issue is about m_pNotificationNode in CCDirector.
the comment about this protected member variable in the source code in CCDirector said “This object will be visited after the scene. Useful to hook a notification node”
but it is a protected member within no any setter that I am not able to benefit from or apply it except I inherit the CCDisplayLinkDirector to set the value of it.
I think a public setter function and remove function need to be added to the CCDirector.

Thanks in advance. :slight_smile:

  1. Yes, it is removed in new version. Because the static method all invoke init(). And it is not safe to invoke init() in construction.
    If you need a null sprite, I think you can new a sprite, and call init() by yourself.

  2. Yes, it should add a public method to set m_pNotificationNode. #760 is created for it.
    Thank you.