com.panic.b360
com.tpmcosoft.battleship
com.a-m.beats-bleeps-boogie
com.radstronomical.CasualBirder
com.uvula.crankin
com.crookedpark.demonquest85
com.samanthazero.echoicmemory
com.davemakes.execgolf
com.serenityforge.elevator
- For repeated expensive drawing options, such as drawing a rotated sprite or a large amount of text, it's a good idea to cache the result to an image once and draw that repeatedly instead.
- Audio formats in order of decode speed, fastest to slowest: 16-bit pcm wav, 8-bit pcm wav, adpcm, mp3.
- The Playdate's audio sample rate is 44100, but if you're experiencing lag when playing audio at that rate, you can try halving the rate to 22050.
- The Playdate has a weak CPU but a comparatively generous amount of memory. Favour memory-based optimisation techniques, such as lookup tables.
- Where possible, move branch statements outside of loops, even if it means duplicating the code for the loop. (probably applies to Lua too?)
- If you need to parse a binary file, use playdate->file->seek to jump to the parts you need and playdate->file->read to only read the data you want. Try to avoid memcpy-ing the whole file to memory in one go.
- If you're blitting to the frame buffer and need to ap
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- bezier curve drawing functions for playdate lua | |
| -- these are based on de Casteljau's algorithm | |
| -- this site has a nice interactive demo to compare both types of curve: https://pomax.github.io/bezierinfo/#flattening | |
| -- draws a curve starting at x1,y1, ending at x3,y3, with x2,y2 being a control point that "pulls" the curve towards it | |
| -- steps is the number of line segments to use, lower is better for performance, higher makes your curve look smoother | |
| -- the playdate is kinda slow, so it's recommended to find a relatively low step number that looks passable enough! | |
| function drawQuadraticBezier(x1, y1, x2, y2, x3, y3, steps) | |
| steps = steps or 8 | |
| local d = 1 / steps |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // adpcm.h | |
| #define CLAMP(n, l, h) \ | |
| if (n < l) n = l; \ | |
| if (n > h) n = h; | |
| #define min(a,b) (((a) < (b)) ? (a) : (b)) | |
| static const int8_t indexTable[8] = | |
| { -1, -1, -1, -1, 2, 4, 6, 8 }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| int width = 0; | |
| int height = 0; | |
| int stride = 0; | |
| int hasMask = 0; | |
| u8* bitmapBuffer; | |
| pd->graphics->getBitmapData(bitmap, &width, &height, &stride, &hasMask, &bitmapBuffer); | |
| // bitmap data is comprised of two maps for each channel, one after the other | |
| int mapSize = height * stride; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // note for typescript users: you will need to install node.js types into your project with `npm i -D @types/node` | |
| import { fileURLToPath } from 'url'; | |
| import path, { dirname } from 'path'; | |
| const __filename = fileURLToPath(import.meta.url); | |
| const __dirname = dirname(__filename); | |
| export default { | |
| // all the usual config goes here... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // usage example in your C entry file... | |
| #include "pd_api.h" | |
| #include "platform.h" | |
| PlaydateAPI *pd = NULL; | |
| int eventHandler(PlaydateAPI *playdate, PDSystemEvent event, uint32_t arg) | |
| { | |
| if (event == kEventInitLua) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # playdate-disk.py | |
| # Puts a USB-connected Playdate into disk mode | |
| # requires Python 3 and pyUSB (pip install pyusb) | |
| # python3 playdate-disk.py | |
| import usb.core | |
| import usb.util | |
| # Playdate USB vendor and product IDs | |
| PLAYDATE_VID = 0x1331; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'CoreLibs/object' | |
| import 'CoreLibs/graphics' | |
| -- Flipnote Studio (DSiWare version) animation parser | |
| -- Format reference: | |
| -- https://github.com/Flipnote-Collective/flipnote-studio-docs/wiki/PPM-format | |
| class("PpmParser").extends() | |
| local gfx <const> = playdate.graphics |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| あいうえおやゆよかきくけこきゃきゅきょさしすせそしゃしゅしょたちつてとちゃちゅちょなにぬねのにゃにゅにょはひふへほひゃひゅひょまみむめもみゃみゅみょやゆよらりるれろりゃりゅりょわゐゑをんがぎぐげごぎゃぎゅぎょざじずぜぞじゃじゅじょだぢづでどぢゃぢゅぢょばびぶべぼびゃびゅびょぱぴぷぺぽぴゃぴゅぴょ | |
| アイウエオャュョカキクケコキャキュキョサシスセソシャシュショタチツテトチャチュチョナニヌネノニャニュニョハヒフヘホヒャヒュヒョマミムメモミャミュミョヤユヨラリルレロリャリュリョワヰヱヲンガギグゲゴギャギュギョザジズゼゾジャジュジョダヂヅデドヂャヂュヂョバビブベボビャビュビョパピプペポピャピュピョ |