加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

iphone – ccp&cpv – 功能差异和完整形式的可可

发布时间:2020-12-14 18:05:03 所属栏目:百科 来源:网络整理
导读:我的应用程序中有以下代码. 我是使用COCOS在iPhone中进行游戏开发的新手. Sprite *bg=[Sprite spriteWithFile:@"menu.png"]; [bg setPosition:ccp(240,160)]; [self addChild:bg z:0]; [self addChild:[GameLayer node] z:1];}return self; } @end@implement
我的应用程序中有以下代码.

我是使用COCOS在iPhone中进行游戏开发的新手.

Sprite *bg=[Sprite spriteWithFile:@"menu.png"];
    [bg setPosition:ccp(240,160)];
    [self addChild:bg z:0];
    [self addChild:[GameLayer node] z:1];
}
return self;

}

@end
@implementation GameLayer
-(id)init{
    if(self=[super init]){
        Label *test=[Label labelWithString:@"Hello World" fontName:@"Helvetica" fontSize:24];
        test.position=cpv(160,240);
        test.visible=YES;
        [self addChild:test];
    }
    return self;
}

ccp&的功能是什么? CPV?
(我认为这是为了设置图层的位置,但我不确定.所以我要求)

萨加尔

解决方法

从源代码:

从CGPointExtension.h起

#define ccp(__X__,__Y__) CGPointMake(__X__,__Y__)

从cpVect.h开始

#define cpVect CGPoint
static inline cpVect cpv(const cpFloat x,const cpFloat y)
{
        cpVect v = {x,y};
        return v;
}

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读