josh-perry / peachy

A parser/renderer for Aseprite animations in LÖVE. :peach:
https://josh-perry.github.io/peachy/
MIT License
104 stars 15 forks source link

Provided frame width/height functionality #6

Closed kirhgoff closed 6 years ago

kirhgoff commented 6 years ago

For collision detection I need width and height of a sprite I just loaded. Of course I can hardcode them and store in separate variables, but why should I do it if it is already in the metadata? Added some simple functions to get quad viewport and width/height of a frame.

Was thinking should I add some asserts, but all the checks are already done in init method, so I think it is already checked, why to bother again.

Please let me know if any changes required. Thanks for the awesome library!

josh-perry commented 6 years ago

Hey thanks for the PR!

Is there a reason you need getViewport if we already have getWidth/getHeight?

kirhgoff commented 6 years ago

Frankly speaking, no, I used only getWidth and getHeight. But I thought someone could want to use quad's viewport instead of accessing json data. Anyway let me know if you want it to get removed, I dont need it myself.

josh-perry commented 6 years ago

I feel like frame.quad is easy enough to get to and unless there's a compelling reason to expose Quad's functions I'd rather not.

Yeah, go ahead and take getViewport out and I'm happy to merge it in 👍 Thanks again.

kirhgoff commented 6 years ago

You got it!

josh-perry commented 6 years ago

Perfect thanks!

kirhgoff commented 6 years ago

👍