rubymotion-community / Joybox

Cocos2D & Box2D Wrapper for Ruby Motion - Currently out of date an unmaintained :-(
MIT License
280 stars 37 forks source link

Cannot link member variables from CocosBuilder #52

Open codynguyen opened 11 years ago

codynguyen commented 11 years ago

Hi,

I'm working on a project with CocosBuilder integration. Code connection from a CCBI file to a ruby class is OK. The only problem is CCBReader cannot link variable from CCBI files to the ruby class: CCBReader: Couldn't find member variable: nodeCredit

The code that failed

class HomeLayer < Joybox::Core::Layer
  attr_accessor :nodeCredit

  # The below callback is OK
  def didLoadFromCCB
    load_audio
  end
end

I suspect the problem comes from how CCBReader retrieve Ivar from another class: Ivar ivar = class_getInstanceVariable([target class],[memberVarAssignmentName UTF8String]);. Below is the suspected code:

      if (memberVarAssignmentType)
        {
            id target = NULL;
            if (memberVarAssignmentType == kCCBTargetTypeDocumentRoot) target = actionManager.rootNode;
            else if (memberVarAssignmentType == kCCBTargetTypeOwner) target = owner;

            if (target)
            {
                Ivar ivar = class_getInstanceVariable([target class],[memberVarAssignmentName UTF8String]);
                NSLOG("class: %@", [target class]);
                if (ivar)
                {
                    object_setIvar(target,ivar,node);
                }
                else
                {
                    NSLog(@"CCBReader: Couldn't find member variable: %@", memberVarAssignmentName);
                }
            }
        }

Kindly help with this. Thanks!

NSCoder commented 11 years ago

Hey Cody,

We haven't test the CocosBuilder yet, but its a good time to do it. Give me some time I will check it out.

Best,

JK

codynguyen commented 11 years ago

Thanks JK, I really appreciate it :+1:

NSCoder commented 10 years ago

A quick update Cody!

We are working in support for CocosBuilder :)

codynguyen commented 10 years ago

Great! thanks for the update Juan.


Cody Nguyen Lead Web Consultant Vinova Pte. Ltd | vinova.sg (http://www.vinova.sg)

On Tuesday, November 12, 2013 at 11:06 AM, Juan Jose Karam wrote:

A quick update Cody! We are working in support for CocosBuilder :)

— Reply to this email directly or view it on GitHub (https://github.com/rubymotion/Joybox/issues/52#issuecomment-28266404).