<legend id='dIQst'><style id='dIQst'><dir id='dIQst'><q id='dIQst'></q></dir></style></legend>

  1. <i id='dIQst'><tr id='dIQst'><dt id='dIQst'><q id='dIQst'><span id='dIQst'><b id='dIQst'><form id='dIQst'><ins id='dIQst'></ins><ul id='dIQst'></ul><sub id='dIQst'></sub></form><legend id='dIQst'></legend><bdo id='dIQst'><pre id='dIQst'><center id='dIQst'></center></pre></bdo></b><th id='dIQst'></th></span></q></dt></tr></i><div id='dIQst'><tfoot id='dIQst'></tfoot><dl id='dIQst'><fieldset id='dIQst'></fieldset></dl></div>

      <small id='dIQst'></small><noframes id='dIQst'>

      <tfoot id='dIQst'></tfoot>

        <bdo id='dIQst'></bdo><ul id='dIQst'></ul>

      CCLOG 不显示

      时间:2023-09-10

      • <tfoot id='m2lSU'></tfoot>

                <tbody id='m2lSU'></tbody>
            1. <legend id='m2lSU'><style id='m2lSU'><dir id='m2lSU'><q id='m2lSU'></q></dir></style></legend>
            2. <small id='m2lSU'></small><noframes id='m2lSU'>

                <bdo id='m2lSU'></bdo><ul id='m2lSU'></ul>

              • <i id='m2lSU'><tr id='m2lSU'><dt id='m2lSU'><q id='m2lSU'><span id='m2lSU'><b id='m2lSU'><form id='m2lSU'><ins id='m2lSU'></ins><ul id='m2lSU'></ul><sub id='m2lSU'></sub></form><legend id='m2lSU'></legend><bdo id='m2lSU'><pre id='m2lSU'><center id='m2lSU'></center></pre></bdo></b><th id='m2lSU'></th></span></q></dt></tr></i><div id='m2lSU'><tfoot id='m2lSU'></tfoot><dl id='m2lSU'><fieldset id='m2lSU'></fieldset></dl></div>
                本文介绍了CCLOG 不显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我已经编写了一个代码来使用 CCLog 来显示当释放一个移动它的鼠标关节时精灵的确切位置.下面是 Sprite.mm 类和 ccTouchesEnded 方法(在 HelloWorldLayer.mm 类中).CCLog 不显示该消息.

                I have written a code to display using CCLog the exact position of a sprite when a mousejoint moving it is released. Below is the Sprite.mm class and the ccTouchesEnded method (which is in the HelloWorldLayer.mm class). The CCLog is not displaying the message.

                Sprite.mm:

                -(id)addSprite:(CCLayer *)parentLayer
                                     inWorld:(b2World *)world
                {
                PhysicsSprite *aSprite = [PhysicsSprite spriteWithFile:@"spriteIm.png"];
                
                aSprite.tag = 1;
                [parentLayer addChild:aSprite];
                
                b2BodyDef spriteBodyDef;
                spriteBodyDef.userData = aSprite;
                spriteBodyDef.type = b2_dynamicBody;
                CGSize s = [CCDirector sharedDirector].winSize;
                spriteBodyDef.position = [Convert toMeters:ccp(s.width * 0.25,s.height-400)];
                b2FixtureDef fixtureDef;
                fixtureDef.density = 0.01;
                b2CircleShape circleShape;
                circleShape.m_radius = aSprite.contentSize.width/2 / PTM_RATIO;
                fixtureDef.shape = &circleShape;
                
                spriteBody = world->CreateBody( &spriteBodyDef );
                spriteFixture = spriteBody->CreateFixture( &fixtureDef );
                
                [aSprite setPhysicsBody:spriteBody];
                
                return aSprite;
                }
                

                ccTouchesEnded:

                ccTouchesEnded:

                - (void)ccTouchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
                {
                
                if (mouseJoint)
                {
                    for(b2Body *b = world->GetBodyList(); b; b=b->GetNext()) {
                        if (b->GetUserData() != NULL) {
                            CCSprite *mySprite = (CCSprite *)b->GetUserData();
                            if (mySprite.tag == 1) {
                                CGPoint spritePosition = mySprite.position;
                                CCLOG(@"the sprite position is x:%0.2f, y:%0.2f", spritePosition.x, spritePosition.y);
                            }
                        }
                    }        
                
                    world->DestroyJoint(mouseJoint);
                    mouseJoint = NULL;
                }
                }
                

                我感觉问题出在我访问标签的方式上,不太确定.请帮忙.

                I have a feeling that the issue is with the way I am accessing the tag, not really sure. Please help.

                推荐答案

                在我看来,可能会发生两件事.

                There can be two things happening, in my opinion.

                1. 没有到达 CCLOG.这可能是因为 sprite tag = 1 未设置或您要关注的对象未与 b2Body 链接.检查到达 CCLOG 的断点

                1. The CCLOG is not being reached. This could happen because either the sprite tag = 1 isnt set or the object you want to follow isnt linked with the b2Body. Check with a breakpoint that you reach the CCLOG

                将 CCLOG 替换为 NSLog.如果它工作,那么你有 COCOS2D_DEBUG 未定义,或为 0.验证你的构建设置.

                Replace CCLOG with NSLog. If it works, then you have COCOS2D_DEBUG not defined, or on 0. Verify your build settings.

                .

                \
                /*
                 * if COCOS2D_DEBUG is not defined, or if it is 0 then
                 *  all CCLOGXXX macros will be disabled
                 *
                 * if COCOS2D_DEBUG==1 then:
                 *      CCLOG() will be enabled
                 *      CCLOGERROR() will be enabled
                 *      CCLOGINFO() will be disabled
                 *
                 * if COCOS2D_DEBUG==2 or higher then:
                 *      CCLOG() will be enabled
                 *      CCLOGERROR() will be enabled
                 *      CCLOGINFO() will be enabled 
                 */
                #if !defined(COCOS2D_DEBUG) || COCOS2D_DEBUG == 0
                #define CCLOG(...) do {} while (0)
                #define CCLOGINFO(...) do {} while (0)
                #define CCLOGERROR(...) do {} while (0)
                
                #elif COCOS2D_DEBUG == 1
                #define CCLOG(...) NSLog(__VA_ARGS__)
                #define CCLOGERROR(...) NSLog(__VA_ARGS__)
                #define CCLOGINFO(...) do {} while (0)
                
                #elif COCOS2D_DEBUG > 1
                #define CCLOG(...) NSLog(__VA_ARGS__)
                #define CCLOGERROR(...) NSLog(__VA_ARGS__)
                #define CCLOGINFO(...) NSLog(__VA_ARGS__)
                #endif // COCOS2D_DEBUG
                

                这篇关于CCLOG 不显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:iOS UITableViewCells 行被回收并且标签不起作用 下一篇:Xcode 使用 FIXME、TODO、???,?

                相关文章

                  <tfoot id='iyRLR'></tfoot>
                      <bdo id='iyRLR'></bdo><ul id='iyRLR'></ul>

                  1. <i id='iyRLR'><tr id='iyRLR'><dt id='iyRLR'><q id='iyRLR'><span id='iyRLR'><b id='iyRLR'><form id='iyRLR'><ins id='iyRLR'></ins><ul id='iyRLR'></ul><sub id='iyRLR'></sub></form><legend id='iyRLR'></legend><bdo id='iyRLR'><pre id='iyRLR'><center id='iyRLR'></center></pre></bdo></b><th id='iyRLR'></th></span></q></dt></tr></i><div id='iyRLR'><tfoot id='iyRLR'></tfoot><dl id='iyRLR'><fieldset id='iyRLR'></fieldset></dl></div>
                    <legend id='iyRLR'><style id='iyRLR'><dir id='iyRLR'><q id='iyRLR'></q></dir></style></legend>

                  2. <small id='iyRLR'></small><noframes id='iyRLR'>