lordmauve / wasabi2d

Cutting-edge 2D game framework for Python
https://wasabi2d.readthedocs.io/
GNU Lesser General Public License v3.0
156 stars 24 forks source link

Nine-patch primitive #23

Open lordmauve opened 4 years ago

lordmauve commented 4 years ago

A very useful primitive in games and UIs is a "nine-patch", which is a rectangle styled with a non-repeating texture.

See for example:

The vertex/UV creation could be implemented entirely in a geometry shader, but this would require a rewrite of the Transformable class to pass pos/angle/scale as attributes rather than building a matrix. The planned ability to group primitives would also have a bearing.

Therefore the simplest way is to stick with the existing CPU-side transformations and optimise later.