Guest User

Untitled

a guest
Apr 22nd, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. mSpriteChicken = new TextureGenerator();
  2. mSpriteChicken->setSize(888, 770); // mTextureWidth, mTextureHeight
  3. mSpriteChicken->setSpriteSize(148, 110); // mSpriteWidth, mSpriteHeight
  4. mSpriteChicken->setMaxFrames(42);
  5.  
  6. int TextureGenerator::getFrameIndex() {
  7.  
  8. return 1;
  9. }
  10.  
  11. const float tw = float(mSpriteWidth) / mTextureWidth;
  12. const float th = float(mSpriteHeight) / mTextureHeight;
  13. const int numPerRow = mTextureWidth / mSpriteWidth;
  14. const int numPerColumn = mTextureHeight / mSpriteHeight;
  15.  
  16. const float tx = (getFrameIndex() % numPerRow) * tw;
  17. const float ty = (getFrameIndex() / numPerRow + 1) * th;
Add Comment
Please, Sign In to add comment