pygame-ce icon indicating copy to clipboard operation
pygame-ce copied to clipboard

Add 9-patch to examples

Open damusss opened this issue 1 year ago • 1 comments

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.

damusss avatar Jul 11 '24 21:07 damusss

Attaching a preview of the example for ease of review image

damusss avatar Jul 12 '24 09:07 damusss

With my las commit I

  • used pygame.Vector2.elementwise
  • changed the while True
  • added a real image on top of the rect

damusss avatar Aug 27 '24 08:08 damusss