DrawNode* rect = DrawNode::create();
//rect->setAnchorPoint(Point(1,1));//这里个值没有用
rect->drawRect(Point(0,0),Point(100,100),color4F(255,255,100));//这里的默认anchorpoint值为0
//rect->drawRect(Point(300,300),Point(200,200),100));
//rect->setposition(Point(100,100));//设置其位置
this->addChild(rect,1);
//Sprite* sp1 = Sprite::create();
//sp1->setTexture("menu_background.jpg");
//Sprite* sp1 = Sprite::create("menu_background.jpg");
//auto bath = SpriteBatchNode::create("Hello.png");
//Sprite* sp1 = Sprite::createWithTexture(bath->getTexture());
//根据缓存pList中的sprite frame来创建,这种用的比较多
//SpriteBatchNode* node = SpriteBatchNode::create("Hello.png");
//Sprite* sp1 = Sprite::createWithTexture(node->getTexture());
Sprite* sp1 = Sprite::createWithSpriteFrame(SpriteFrame::create("Hello.png",Rect(0,480,320)));
sp1->setAnchorPoint(Point(0,0));
//sp1->setposition(Point(10,10));
sp1->setTag(100);
this->addChild(sp1,0);
schedule(schedule_selector(SpriteTest::callback),10);//调用时间
return true;
}
voID SpriteTest::callback(float dt) { Sprite* sp1 = (Sprite*)this->getChildByTag(100); sp1->setTexture("HelloWorld.png"); sp1->setposition(100,100); sp1->setRotation(-90);//这里的旋转没有时间设置而是直接到位的 }
总结以上是内存溢出为你收集整理的sprite全部内容,希望文章能够帮你解决sprite所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)