CCLOG not displaying

前端 未结 1 1203
醉话见心
醉话见心 2021-01-28 23:11

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 (

相关标签:
1条回答
  • 2021-01-28 23:57

    There can be two things happening, in my opinion.

    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

    2. 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
    
    0 讨论(0)
提交回复
热议问题