In my (OpenGL ES 2.0 Android) game, I use 2 types of Sprite Sheets. In one type all sprites/frames are of equal size and in the other they are all different shapes and sizes.
It is the latter one to which this question pertains. Basically, I've created a sprite sheet and I currently use Paint.net to find the coordinates a particular frame sits at. I then have to work out the texture coordinates by dividing the pixel by the width (for X) or height (for Y) so, if my image is 2048 x 2048 and a particular frame is at 300, 500, I work it out like so:
300/2048 = 0.146484375 500/2048 = 0.244140625
So, my X (or S) is 0.146484375 and my Y (or T) is 0.244140625.
I use the same method to work out the width and height.
I then code this using a method like so:
setTexCoords(0.146484375f, 0.244140625f, 0.048828125f, 0.048828125f); //X, Y, Width, Height
When working with lots of sprites, this is a very tedious process.
The main problem however, is if I, at a later date, want to add sprites to the sheet and make it bigger to accommodate the extra sprites, I have to revisit every sprite and work out it's new texture coords based on the new bitmap size.
Is there any method I can use to make this process easier?
Even if it's just a program where I can hover the mouse over a bitmap and it tells me the texture coordinate (between 0-1). Even that would take a little of the work out of it.
Any suggestions welcomed.
I have read a similar question on here however, none of the answers really helped