This is a NOOB question that I didn't see a reply for: I need a singleton for my game for global state, etc. Is there any reason to not subclass CCDirector to get one? It would seem to be the most integrated way to work with cocos2d.
okay to subclass CCDirector?
(4 posts) (2 voices)-
Posted 1 year ago #
-
Alternatively, I could create a category on CCDirector, but I can't create ivars on it, so that's not going to help.
Posted 1 year ago # -
If you want to store game data in a singleton I suggest creating another one, or, you can use the AppDelegate singleton.
Posted 1 year ago # -
Thanks for the answer. I am creating a new one. I was thinking that the issue of subclassing CCDirector would be that others would be calling it too, but mine would be running which would be confusing and potentially bad.
Posted 1 year ago #
Reply
You must log in to post.