@toadkick good request.
We can design it as follows:
sprite( image, x, y )
sprite( image, x, y, w ) -- h is computed on aspect ratio
sprite( image, x, y, w, h )
sprite( image, x, y, s, t, tw, th )
sprite( image, x, y, s, t, tw, th, w ) -- as before
sprite( image, x, y, s, t, tw, th, w, h )
Or in the following way:
sprite( image, x, y )
sprite( image, x, y, w ) -- h is computed on aspect ratio
sprite( image, x, y, w, h )
sprite( image, x, y, w, h, s, t, tw, th )
The latter is good because it preserves the existing argument ordering in all cases. However the former has the advantage of not requiring you to have to type values for w
and h
when using explicit texture coordinates.
So it’s either: save on typing, or preserve API consistency. A hard decision.
Alternatively we could do an advanced sprite function that takes a table.
sprite( image, table )
Where table contains the following keys: x, y, w, h, s, t, tw, th
What are your thoughts?