https://github.com/notcl4y14/lovepatch
A simple 9-patch library for LÖVE
https://github.com/notcl4y14/lovepatch
Last synced: 2 months ago
JSON representation
A simple 9-patch library for LÖVE
- Host: GitHub
- URL: https://github.com/notcl4y14/lovepatch
- Owner: notcl4y14
- Created: 2023-06-30T11:28:52.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2025-08-15T15:14:06.000Z (7 months ago)
- Last Synced: 2025-08-15T17:28:21.413Z (7 months ago)
- Language: Lua
- Homepage:
- Size: 1.23 MB
- Stars: 8
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-love2d - lovepatch - A simple 9-patch library for LÖVE. (UI)
README
# lovepatch
This a love2D library that creates and draws 9-patch images. https://en.wikipedia.org/wiki/9-slice_scaling. Thanks to darkfrei for helping with the code (or just even writing all by himself).
The example code is in the `main.lua` file.
# Demo

# API
```lua
-- Creates a new 9-patch object.
lovepatch.load(image|filename, edgeWidth, edgeHeight)
-- Creates a new 9-patch object with custom edges.
lovepatch.load(image|filename, left, right, top, bottom)
-- Draws a 9-patch object at the given position with the given size.
-- sx, sy - scale
lovepatch.draw(patch, x, y, width, height, sx = 1, sy = 1)
```