Request new feature for draw function. - flip sprite

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
Mr. Strange
Party member
Posts: 101
Joined: Mon Aug 11, 2008 5:19 am

Request new feature for draw function. - flip sprite

Post by Mr. Strange »

Still loving the love here, but now I have a feature request.

I generally use a single texture sheet and pull subsprites off of it. I use square texture sheets exclusively, to map to the texture beffer of Sony consoles. Since the texture space is limited, I'm always trying to save unnecessary textures.

love has the ability to rotate and scale sprites and subsprites already, which is great. But I would also really appreciate the ability to flip a sprite around the vertical axis. (flipping left to right). Most textures and characters have L/R symmetry, which means this is very broadly applicable.

Currently there are multiple cases of the draw (and draws) function. (incidentally, why is the "rotate around a non-center point" function not available for regular sprites?) And adding yet another optional parameter, while easy enough, would be potentially a bit much.

I have two options here, either of which would be fine for me:
1 - provide a function which lets me create a new image object by flipping a defined picture. Something like: flipv(myImage)
2 - define negative angles in existing draw functions as a flip, plus rotation in the positive direction. This might offend some sensibilities, since you're essentially overloading a single value with two meanings, but I feel that the two meanings complement one another well.

Thoughts?
User avatar
rude
Administrator
Posts: 1052
Joined: Mon Feb 04, 2008 3:58 pm
Location: Oslo, Norway

Re: Request new feature for draw function. - flip sprite

Post by rude »

You should be able to flip images by using negative scaling, but for some forgotten reason, this is not implemented for subsprites.

In general, I feel that the sprite system needs a major update ... I don't think it's flexible enough. As always, suggestions towards this are welcome.
(incidentally, why is the "rotate around a non-center point" function not available for regular sprites?)
No good reason. Added to task list.

EDIT: Yes, I know this is a prime example of features that should be in the documentation. 8-)
surtic
Citizen
Posts: 74
Joined: Sat Jul 12, 2008 12:18 am

Re: Request new feature for draw function. - flip sprite

Post by surtic »

I thought rotating around a non-centre point was done using image:setCenter() and then rotating.

Or is the question "why do we have to call setCenter() on the image (stateful) and we don't have a function for that (stateless)"?
Attachments
rotate.love
(76.61 KiB) Downloaded 195 times
Mr. Strange
Party member
Posts: 101
Joined: Mon Aug 11, 2008 5:19 am

Re: Request new feature for draw function. - flip sprite

Post by Mr. Strange »

rude wrote:You should be able to flip images by using negative scaling, but for some forgotten reason, this is not implemented for subsprites.

In general, I feel that the sprite system needs a major update ... I don't think it's flexible enough. As always, suggestions towards this are welcome.
(incidentally, why is the "rotate around a non-center point" function not available for regular sprites?)
No good reason. Added to task list.

EDIT: Yes, I know this is a prime example of features that should be in the documentation. 8-)
Hmmm... that's a bit unintuiative - I would have guessed that negative scale numbers would be inverses (-10 would be 1/10, -0.1 would be 10) but since inverse scale numbers can just be entered manually, I suppose they are unnecessary and thus ripe for overloading.

Anyway, I look forward to the expanding functionality.

--Mr. Strange
u9_
Citizen
Posts: 54
Joined: Thu Oct 23, 2008 7:12 am

Re: Request new feature for draw function. - flip sprite

Post by u9_ »

(incidentally, why is the "rotate around a non-center point" function not available for regular sprites?)
No good reason. Added to task list.
[/quote]
I was going to suggest something like setHotSpot, but if there is a setCenter, that should be adequate. I don't think it is good for the API to have a billion ways of doing the same thing. I also don't think there would be any reason to set the center (of rotation) more then once for each sprite, making it a little redundant with yet another function... but i could be wrong?
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 130 guests