图片绘制

时间: 2023-08-02 admin IT培训

图片绘制

图片绘制

一般使用CCSprite

四步骤:

1、初始化

2、检测

3、设置坐标点

4、加入当前图层       

代码:

        // Add add a splash screen, show the cocos2d splash image.CCSprite* pSprite = CCSprite::create("test.png");CC_BREAK_IF(! pSprite);// Place the sprite on the center of the screenpSprite->setPosition(ccp(size.width/2, size.height/2));// Add the sprite to HelloWorld layer as a child layer.this->addChild(pSprite, 0);