cocos2d / cocos2d-objc

Cocos2d for iOS and OS X, built using Objective-C

Home Page:http://www.cocos2d-objc.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Multi-instance API discussion

s1ddok opened this issue · comments

We already have an implementation of multiple CCDirector instances in develop branch. There is stack type of situation.

While it seems to be a clever solution it might be confusing a little bit for newcomers that only want to have single Cocos2D instance to see something like

CCDirector pushDirector

CCDirector popDirector

That is why I guess we should discuss if there any other way to find a solution or at least syntax sugar for accessing the director.

I have a little bit of a thought on that. Right now every node having a reference to it's scene. Why not add director reference to the scene, so it can be accessed by:

node.scene.director

I think it can be useful sometimes, but that is of course debatable.

Stack of directors is a super bad idea, since we end up with global state again. scene.director is much much better. But look at SpriteKit, it hasn't SKDirector, all its functionality is moved to SKView. So should we have both CCDirector and CCView? Maybe they should be merged?