Right, I added the -fobjc-gc flag. I'll check the docs and try to update the framework. Thanks! On Thu, Jan 13, 2011 at 10:51 PM, Laurent Sansonetti <lsansonetti@apple.com> wrote:
Hi Rolando, You shouldn't need to retain the objects as instance variables to keep them from premature garbage collection. In this case, I assume that the Cocos2D framework has been built with -fobjc-gc (otherwise you would get a link error at runtime), but that it's not fully compatible with the GC techniques yet. Passing the -fobjc-gc flag isn't enough sometimes, and one has to migrate the framework. Some documentation is available here: http://developer.apple.com/library/mac/#documentation/cocoa/Conceptual/Garba... Laurent On Jan 13, 2011, at 5:32 AM, Rolando Abarca wrote:
hi all,
I'm having some fun with Cocos2D[1] Mac Version and MacRuby. Some time ago I wrote ruby bindings for the iPhone version[2], but MacRuby makes those bindings unnecessary (at least for mac). So far everything works great! The only problem I'm having so far is in cases like this:
{{{ some_node = CCSprite.spriteWithFile("some_file.png") self.addChild(some_node) }}}
If I do the above, the object will get GCd by the ruby VM (I'm guessing), but the object should still live the Obj-C world (internally, each Cocos2D node keeps its children in an array, where they are retained in the addChild method). So far, I'm bypassing this by declaring each child an instance variable, but I'm pretty sure there must be another way... Any idea of how to overcome this problem? Btw: cocos2d works using the old retain/release memory management system, even in the Mac version.
Thanks!,
[1]: http://www.cocos2d-iphone.org [2]: https://github.com/funkaster/ShinyCocos -- Rolando Abarca M. Games For Food S.p.A. http://www.gamesforfood.com Phone: +1 (408) 345-5433 _______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
_______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
-- Rolando Abarca M. Games For Food S.p.A. http://www.gamesforfood.com Phone: +1 (408) 345-5433