cocos2dx 图片平铺

前端之家收集整理的这篇文章主要介绍了cocos2dx 图片平铺前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
Texture2D *texture = Director::getInstance() -> getTextureCache() -> addImage("Santa.png");
Texture2D::TexParams tp = {GL_LINEAR,GL_LINEAR,GL_REPEAT,GL_REPEAT};
texture -> setTexParameters(tp);
auto sprite = Sprite::createWithTexture(texture,Rect(0,visibleSize.width,visibleSize.height));
sprite->setPosition(Vec2(visibleSize.width/2 + origin.x,visibleSize.height/2 + origin.y));
this->addChild(sprite,0);
原文链接:https://www.f2er.com/cocos2dx/342968.html

猜你在找的Cocos2d-x相关文章