pygame-ce
pygame-ce copied to clipboard
Add 9-patch to examples
After a short discussion with @Starbuck5 9-patch scaling is a recipe like process that doesn't involve algorithmic pixel manipulation so an example is probably good enough for it.
This is a good place to come every time you need your own 9-patch function and good to teach for GUI purposes. It's also existing in every other game engine so at least an example is needed.
I made the 9-patch code behave like a transform function would, adding comments and type hinting.
Attaching a preview of the example for ease of review
With my las commit I
- used pygame.Vector2.elementwise
- changed the while True
- added a real image on top of the rect