I am trying to get a texture tiling from a sprite sheet.
I can do just fine when I load the texture by itself.
m_bg = CCSprite::create("textures/load/load_bg.png", CCRectMake(0, 0, 1024, 512));
CCSize scale;
float bgScaleX = m_screenSize.width / m_bg->boundingBox().size.width;
float bgScaleY = m_screenSize.height / m_bg->boundingBox().size.height;
m_bg->setScaleX(bgScaleX);
m_bg->setScaleY(bgScaleY);
m_bg->setPosition(CCPoint(m_screenSize.width / 2.0f, m_screenSize.height / 2.0f));
addChild(m_bg, 0);
ccTexParams params = {GL_LINEAR,GL_LINEAR,GL_REPEAT,GL_REPEAT};
m_bg->getTexture()->setTexParameters(¶ms);
It tiles just as I want. But it appears I cannot do the same from a sprite sheet. Firstly, there isn’t even a function to create from a sprite frame and specify a rectangle.
If I manually set a rectangle after loading the texture via the createWithFrameName function, it gives weird results as if it’s grabbing more from the texture. Does anyone have a solution for this?