Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mSpriteChicken = new TextureGenerator();
- mSpriteChicken->setSize(888, 770); // mTextureWidth, mTextureHeight
- mSpriteChicken->setSpriteSize(148, 110); // mSpriteWidth, mSpriteHeight
- mSpriteChicken->setMaxFrames(42);
- int TextureGenerator::getFrameIndex() {
- return 1;
- }
- const float tw = float(mSpriteWidth) / mTextureWidth;
- const float th = float(mSpriteHeight) / mTextureHeight;
- const int numPerRow = mTextureWidth / mSpriteWidth;
- const int numPerColumn = mTextureHeight / mSpriteHeight;
- const float tx = (getFrameIndex() % numPerRow) * tw;
- const float ty = (getFrameIndex() / numPerRow + 1) * th;
Add Comment
Please, Sign In to add comment