Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected overlapping_sprites behavior #412

Closed
paulstraw opened this issue Aug 18, 2024 · 2 comments · Fixed by #413
Closed

Unexpected overlapping_sprites behavior #412

paulstraw opened this issue Aug 18, 2024 · 2 comments · Fixed by #413
Labels
api About Playdate API, bindings and all over that. bug Something isn't working

Comments

@paulstraw
Copy link

I'm running into some unexpected behavior with overlapping_sprites, and set up a minimal repro here: https://github.com/paulstraw/bzpd-overlapping-sprites/blob/main/src/lib.rs#L106-L108. Specifically:

  1. It panics if no sprites overlap (or if the sprite has no collide rect set).
  2. It leaks memory when other sprites do overlap.
@boozook boozook added bug Something isn't working api About Playdate API, bindings and all over that. labels Aug 19, 2024
@boozook boozook moved this to 🏗 In progress in Playdate Development Aug 19, 2024
@boozook
Copy link
Owner

boozook commented Aug 21, 2024

Yup. Thanks! According to documentation

The caller is responsible for freeing the returned array

we have to dealloc it, not just borrow.

So, also need to check and fix same for

  • checkCollisions
  • moveWithCollisions
  • querySpritesAtPoint
  • querySpritesInRect
  • querySpritesAlongLine
  • querySpriteInfoAlongLine
  • overlappingSprites
  • allOverlappingSprites

this is original function names in the c-api

@boozook boozook linked a pull request Aug 23, 2024 that will close this issue
@boozook
Copy link
Owner

boozook commented Aug 24, 2024

Fixed in #413

Screenshot 2024-08-24 at 22 28 08

@github-project-automation github-project-automation bot moved this from 🏗 In progress to Done in Playdate Development Aug 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api About Playdate API, bindings and all over that. bug Something isn't working
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants