SDL Animation when using large sprite sheets,
Members - Reputation: 101
Posted 05 December 2012 - 08:03 PM
From Looking at lazyfoo's site his animation tutorial looks like you have to set the position of each frame individually. My image has 64 frames of animation. I am looking for another way of cliping the sprites.
Crossbones+ - Reputation: 33412
Posted 05 December 2012 - 08:26 PM
rect.x = (column * SpriteWidth) rect.y = (row * SpriteHeight); rect.w = SpriteWidth; rect.h = SpriteHeight;
Several years ago, I created a single header file that wraps it all for you providing convenience functions.
That thread's formatting has deteriorated with time, but the download link still works. If you have any questions, just ask.
All glory be to the Man at the right hand... On David's throne the King will reign, and the Government will rest upon His shoulders. All the earth will see the salvation of God.
Of Stranger Flames - [indie turn-based rpg set in a para-historical French colony] | Indie RPG development journal | [Fly with me on Twitter]
Crossbones+ - Reputation: 4492
Posted 06 December 2012 - 07:43 AM
Instead of cutting sprites out of a sheet in a shader you can do it at load-time.
Edited by eppo, 06 December 2012 - 08:03 AM.