An open API service indexing awesome lists of open source software.

https://github.com/notpeter/playdate-qrcode

Fast QRCode Generation for the Playdate game console
https://github.com/notpeter/playdate-qrcode

Last synced: 12 months ago
JSON representation

Fast QRCode Generation for the Playdate game console

Awesome Lists containing this project

README

          

# playdate-qrcode

C-Accelerated Lua API to rapidly generate QRCode images 75-150x faster than Playdate QR SDK

## Example

```
./run.sh simulator
```

![Playdate Simulator generating a QR code in 2ms](qrcode-simulator.png)

See [Source/main.lua](Source/main.lua) for how this works.

## Usage (Lua)

1. Copy the `Makefile`, `src` dir and `library` dir into your Lua Playdate Project.
2. Generate a image with a QRcode:

```lua
local image = quick_qr.generate("https://panic.com")`
image:drawScaled(20, 20, 4, 4)
```

CMake also provided if you prefer that over GNU Makefile.

### Usage (C)

Adapt the code in [quick_qr.c](src/quick_qr.c) and [quick_qr.h](src/quick_qr.h) for your needs.

Include [qrcodegen.c](src/qrcodegen.c) / [qrcodegen.h](src/qrcodegen.h) in your project.

## Why?

The QRCode library [included in the PlaydateSDK](https://github.com/notpeter/playdate-luaqrcode)
is a fork [speedata/luaqrcode](https://github.com/speedata/luaqrcode)
written in Pure Lua, which is slow.

For example, creating a QR Code from "https://play.date/" (16 characters) takes 1050ms.

This C implementation is faster. Much faster:

Length | Lua | C | Speedup
------ | --------| ------| ---------
16 | 1050ms | 7ms | 150x
100 | 2267ms | 21ms | 100x
254 | 3934ms | 46ms | 85x
1323 | 16114ms | 214ms | 75x

## Giving Thanks

If you find this software useful::

1. [Sponsor me on GitHub](https://github.com/sponsors/notpeter/)
2. Purchase something from [notpeter.itch.io](https://notpeter.itch.io)
3. Send me free copies of your Playdate apps! (DM me on Twitter/BlueSky)

## 3rd Party Components

### [nayuki/QR-Code-generator/c](https://github.com/nayuki/QR-Code-generator/tree/master/c)
- files: [qrcodegen.c](src/qrcodegen.c), [qrcodegen.h](src/qrcodegen.h)
- author: [Project Nayuki](https://github.com/nayuki)
- license: MIT
- updated: 2022-02-02
- commit: [c147f7e328d1e5bdcf5aac76c7d7b90516c1058d](https://github.com/nayuki/QR-Code-generator/tree/c147f7e328d1e5bdcf5aac76c7d7b90516c1058d)
- changes: Add `#define assert` no-op.