-创建点:
auto dot = DrawNode::create();
dot->drawDot(Vec2(0,0),10,Color4F(1.0,1.0,0,1.0));
创建矩阵:
auto rect = DrawNode::create();
rect->drawRect(Vec2(0,Vec2(rectSize.width,rectSize.height),1.0));
创建精灵:
auto img = Sprite::create("004.jpg");
auto imgSize = img->getContentSize(); --获取精灵尺寸
//加载纹理
auto imgTex = Director::getInstance()->getTextureCache-> addImage("..\\proj.win32\\res\\007.jpg");
auto imgSize = imgTex->getContentSize();
auto sprite = Sprite::createWithTexture(imgTex);
创建向量:
direction = Vec2(random(-1.0,1.0),random(-1.0,1.0));
direction.normalize(); --单位化
创建图层:
auto layer = Layer::create();
设置锚点:
layer->setAnchorPoint(Vec2(0.5,0.5));
创建并切换场景:
auto scene = Scene::create();
Director::getInstance()->replaceScene(scene);
设置状态是否可见:
rect->setVisible(false);
缩放:
rect->setscale(0.5);