GithubHelp home page GithubHelp logo

ivansergeev / gfxp Goto Github PK

View Code? Open in Web Editor NEW
59.0 5.0 3.0 1.83 MB

GFXP is a useful lib & tool for working with patterns for Playdate console

Home Page: https://dev.crankit.app/tools/gfxp/

License: MIT License

Lua 100.00%
playdate gfxp pattern-lib lua panic gfxp-editor gfxp-lib patterns pattern

gfxp's Introduction

GFXP

GFXP is a small library with a collection of patterns for Panic Playdate console.

Online version: GFXP Editor

Playdate app: GFXP Viewer, developed by Foster Douglas.

For use in C SDK projects: C library, by Addison Schuhardt.

A GFXP helper class for use with PlaydateKit: Swift class, 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 <const> = 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 <const> = 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 <const> = 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 is a trademark of Panic

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.