Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/codecat/p9
Yet another 9patch library for Love2D.
https://github.com/codecat/p9
Last synced: 6 days ago
JSON representation
Yet another 9patch library for Love2D.
- Host: GitHub
- URL: https://github.com/codecat/p9
- Owner: codecat
- License: mit
- Created: 2024-01-28T21:59:50.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2024-01-28T22:01:33.000Z (11 months ago)
- Last Synced: 2024-01-28T23:20:43.719Z (11 months ago)
- Language: Lua
- Size: 61.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
- License: License.txt
Awesome Lists containing this project
README
# p9
Yet another 9patch library for Love2D. Similar to [patchy](https://github.com/excessive/patchy)
and [slicy](https://github.com/wqferr/slicy), but it's a lot smaller, uses a GLSL shader for
rendering, wraps the texture instead of simply stretching it, and is permissively licensed.![](img/screenshot.png)
## Usage
```lua
local p9 = require('p9')
local patch = p9.load('frame.9.png')function love.draw()
patch:draw(10, 10, 100, 100)local x, y, w, h = p:getContentWindow()
love.graphics.setScissor(x, y, w, h)
-- Do some drawing within the content region
love.graphics.setScissor()
end
```The `draw` method also returns the same values as `getContentWindow`.
## The format
The `.9.png` format is a regular image file, except the first/last rows/columns are intended as
metadata indicators.![](img/explainer.png)