Files always begin with a 50-byte header.
Offset | Type | Details |
---|---|---|
0 | char[8] | Magic ident "ANISHARE" |
8 | uint8 | Version number (currently 0) |
{ | |
"information_for_contributors": [ | |
"This file is based on https://github.com/shikijs/textmate-grammars-themes/blob/main/packages/tm-grammars/grammars/lua.json", | |
"With changes made to support Playdate-specific Lua additions such as extra table methods and assignment operators" | |
], | |
"version": "1", | |
"name": "Lua", | |
"scopeName": "source.lua", | |
"patterns": [ | |
{ |
export const dist = (x1: number, y1: number, x2: number, y2: number) => Math.sqrt(Math.pow((x1 - x2), 2) + Math.pow((y1 - y2), 2)); | |
export class LineSegment { | |
x0: number = 0; | |
y0: number = 0; | |
x1: number = 0; | |
y1: number = 0; | |
constructor (x0: number, y0: number, x1: number, y1: number) { | |
this.x0 = x0; |
local CRC32_LUT = nil | |
local function crc32_init() | |
if not CRC32_LUT then | |
CRC32_LUT = table.create(255, 0) | |
local rem | |
for i = 0, 255 do | |
rem = i | |
for j = 1, 8 do | |
if (rem & 1 == 1) then |
Prism.languages.lua = { | |
'comment': /^#!.+|--(?:\[(=*)\[[\s\S]*?\]\1\]|.*)/m, | |
// \z may be used to skip the following space | |
'string': { | |
pattern: /(["'])(?:(?!\1)[^\\\r\n]|\\z(?:\r\n|\s)|\\(?:\r\n|[^z]))*\1|\[(=*)\[[\s\S]*?\]\2\]/, | |
greedy: true | |
}, | |
'number': /\b0x[a-f\d]+(?:\.[a-f\d]*)?(?:p[+-]?\d+)?\b|\b\d+(?:\.\B|(?:\.\d*)?(?:e[+-]?\d+)?\b)|\B\.\d+(?:e[+-]?\d+)?\b/i, | |
'keyword': /\b(?:and|break|do|else|elseif|end|false|for|function|goto|if|in|local|nil|not|or|repeat|return|then|true|until|while)\b/, | |
'function': /(?!\d)\w+(?=\s*(?:[({]))/, |
import { unzlibSync } from 'fflate'; | |
function assert(condition: boolean, errMsg: string = 'Assert failed'): asserts condition { | |
if (!condition) { | |
console.trace(errMsg); | |
throw new Error(errMsg); | |
} | |
} | |
function readChars(data: DataView, ptr: number, size?: number) { |
// run in node.js, version 16.0 or later | |
// assumes sound effects will be in a folder called 'pda', located next to the script (replace all instances of './pda' to change this) | |
const fs = require('fs'); | |
function assert(condition, errMsg = 'Assert failed') { | |
if (!condition) { | |
console.trace(errMsg); | |
throw new Error(errMsg); | |
} |
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
-- 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 |