Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ivansergeev/gfxp
GFXP is a useful lib & tool for working with patterns for Playdate console
https://github.com/ivansergeev/gfxp
gfxp gfxp-editor gfxp-lib lua panic pattern pattern-lib patterns playdate
Last synced: about 1 month ago
JSON representation
GFXP is a useful lib & tool for working with patterns for Playdate console
- Host: GitHub
- URL: https://github.com/ivansergeev/gfxp
- Owner: ivansergeev
- License: mit
- Created: 2020-05-27T13:32:58.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-11-10T00:30:35.000Z (10 months ago)
- Last Synced: 2024-04-16T13:55:52.276Z (5 months ago)
- Topics: gfxp, gfxp-editor, gfxp-lib, lua, panic, pattern, pattern-lib, patterns, playdate
- Language: Lua
- Homepage: https://dev.crankit.app/tools/gfxp/
- Size: 1.79 MB
- Stars: 58
- Watchers: 5
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: license.txt
Awesome Lists containing this project
- awesome-playdate - GFXP - A library with a collection of dithering patterns for the Playdate. An online version of the editor can be seen [here](https://ivansergeev.com/gfxp/). (Game Development / Programming Frameworks & Languages)
README
# GFXP
GFXP is a small library with a collection of patterns for Panic Playdate console.
Online version: [GFXP Editor](https://dev.crankit.app/tools/gfxp/)
Playdate app: [GFXP Viewer](https://crankit.app/app/1008/gfxp-viewer/), developed by Foster Douglas.
For use in C SDK projects: [C library](https://gist.github.com/aschuhardt/ade117b95bb3f2ca99a608224165d4d4), by Addison Schuhardt.
A GFXP helper class for use with PlaydateKit: [Swift class](https://gist.github.com/mgrider/22044c4f3b05116c8478f038062338c3), by Martin Grider.
### Types of patterns that are included in the GFXP lib
- Grayscale
- Dots
- Crosses
- Vertical Lines
- Horizontal Lines
- Diagonal Lines
- Waves
- Grid
- Bricks
- Rects
- Flakes
- Decor
- Noise
- Emojis
- Misc### Demo
Build project from `Source` folder and run `GFXP.pdx` on your Playdate console or in your Playdate Simulator.
### Using GFXP lib
Before you begin, import `gfxp.lua` from `Source/lib` folder into the source folder of your project.
```
import 'lib/gfxp'
```It is enough to do this once, for example in `main.lua`
### Use cases GFXP lib
The library includes 136 ready-made patterns (w/o inverted versions). To use any of them, all you need is to indicate its name.
In any file with your code:###### Option 1:
Declare a local variable
```
local gfxp = GFXP
```
then specify the name of the pattern
```
gfxp.set('gray')
```
or
```
gfxp.set('dot-1')
```
or the inverted version (with transformation), just add an `i` at the end, for example:
```
gfxp.set('dot-1i')
```
or a custom pattern table
```
gfxp.set({0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA})
```
or with mask
```
gfxp.set({0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 170, 85, 170, 85, 170, 85, 170, 85})
```Available transformation flags for named patterns:
`i` - Invert
`r` - Random
`t` - Transparency
###### Option 2: set only
Declare a local variable
```
local gfxp = GFXP.set
```
then specify the name of the pattern
```
gfxp('dot-1')
```
or a custom pattern table
```
gfxp({0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF})
```###### Option 3: lib only
Declare a local variable
```
local gfxpLib = GFXP.lib
```
then specify the name of the pattern
```
playdate.graphics.setPattern(gfxpLib.gray)
```
or
```
playdate.graphics.setPattern(gfxpLib['dot-1'])
```### License
The MIT License (MIT)
### Trademarks
[Playdate](https://play.date/) is a trademark of [Panic](https://panic.com/)