IrvKalb / pygwidgets

A collection of user interface widgets in Python for use in programs using Pygame.
BSD 2-Clause "Simplified" License
14 stars 3 forks source link

SpriteSheetAnimation does not work with rectangular subimages (width is different from height) #4

Closed landochan closed 1 year ago

landochan commented 1 year ago

I noticed the issue in pygwidgets/pygwidgets.py on line 3195, 3196 x = col * height y = row * width I think it should be changed to this x = col * width y = row * height

IrvKalb commented 1 year ago

Hi Lando,

Thank you very much for writing.

It turns out that you are the second person to tell me about this bug within a week! The bug has been there for probably four years. I had noticed it because the images that I was working with in my sprite sheets were square, so the width and the height were the same.

The fix that you supplied is exactly correct. I have made the change in my code and uploaded a 1.0.4 version of pygwidgets to my GitHub repository. (Although I have not yet published it to PyPI for download.)

I am very close to shipping a new 1.1 version of pygwidgets with a few additional classes, including an AnimationCollection and a SpriteSheetAnimationCollection that work like my ImageCollection. That is, these allow you to specify a number of different animations and switch between them easily. Coming soon ...

Again, thanks for letting me know. I hope that you are enjoying the book.

Irv


From: Lando Chan @.> Sent: Monday, February 13, 2023 6:12 PM To: IrvKalb/pygwidgets @.> Cc: Subscribed @.***> Subject: [IrvKalb/pygwidgets] SpriteSheetAnimation does not work with rectangular subimages (width is different from height) (Issue #4)

I noticed the issue in pygwidgets/pygwidgets.py on line 3195, 3196 x = col height y = row width I think it should be changed to this x = col width y = row height

— Reply to this email directly, view it on GitHubhttps://github.com/IrvKalb/pygwidgets/issues/4, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ABXUYSQ2OWNRB2OE4KWXKT3WXLSZFANCNFSM6AAAAAAU27RO4Q. You are receiving this because you are subscribed to this thread.Message ID: @.***>

landochan commented 1 year ago

Thank you for the fix