Playdate compatibility
Core8Bit does not create a playdate table. Games opt in with playdate = c8b, after which playdate.graphics, playdate.sound, playdate.timer, playdate.datastore, playdate.file, playdate.geometry, playdate.keyboard, playdate.easingFunctions and the top-level functions resolve to the Core8Bit implementations documented on the other pages. Every entry there carries a Playdate status: Same as Playdate, Partial (with a note), Core8Bit-only or Compatibility stub.
Main differences
- Colors are RGB565 integers.
kColorBlack = 0x0000,kColorWhite = 0xFFFF,kColorClear = -1; Playdate 1-bit art still works because black/white map to these values, andsetBackgroundColor(0/1/2)is remapped. - Screen is 480x272 (Playdate: 400x240).
- Assets must be converted: images to STI/STJ, image tables to STA, audio to STS (see
AssetFormatSpecifications.md)..pdi/.pdt/.pdafiles are not loaded. - Buttons: extra X, Y, Menu, Select; no crank (crank functions are stubs) and no accelerometer.
- Update loop:
playdate.updateisc8b.update. Sprites redraw the full frame eachgfx.sprite.update(); dirty-rect APIs are stubs. - Timers advance a fixed 41.67 ms per
updateTimers()call (see AUDIT.md). - Writing files:
playdate.file.openwith write modes fails; usec8b.file.writeStringorplaydate.datastore.write. - Collision types are numbered 1..4 (
kCollisionTypeSlide= 1). - CoreLibs:
import "CoreLibs/..."is mapped byclass.lua: graphics, sprites, easing, timer and object return SDK tables; animation, animator, crank, keyboard, frameTimer, ui and nineslice are accepted no-ops;CoreLibs/soundreturns an empty table. Note thatframeTimeris not implemented.
Contents
The playdate table
playdate
playdate = c8b
Convention, not an SDK symbol: Playdate-style games assign playdate = c8b at the top of main.lua. The SDK protects the names playdate and pd from the game-switch global cleanup.
- Availability: Console (BIOS) and emulator
- Playdate: Same as Playdate
- Defined in:
Core8bit/SDCard/System/sdk/class.lua:643,Core8bit/SDCard/System/sdk/sandbox.lua:26
playdate = c8b
local pd = playdate
local gfx = pd.graphics
Status by page
| Page | Same | Partial | Core8Bit-only | Stub |
|---|---|---|---|---|
| graphics | 59 | 18 | 83 | 5 |
| sprites | 31 | 17 | 87 | 6 |
| images-tilemaps | 31 | 35 | 114 | 0 |
| input | 8 | 2 | 55 | 9 |
| sound | 51 | 4 | 19 | 9 |
| music | 0 | 0 | 115 | 0 |
| files | 16 | 14 | 15 | 0 |
| time | 49 | 4 | 9 | 0 |
| network | 0 | 0 | 51 | 0 |
| system | 32 | 9 | 71 | 11 |
| json | 4 | 2 | 26 | 0 |
| math-utilities | 17 | 2 | 10 | 0 |
| playdate-compatibility | 1 | 0 | 0 | 0 |
Playdate APIs not available
These Playdate SDK names were checked against the inventory and are not provided (calling them raises an error):
playdate.graphics.image:drawIgnoringOffsetplaydate.graphics.image:sampleplaydate.graphics.image:rotatedImageplaydate.graphics.image:scaledImageplaydate.graphics.image:copyplaydate.graphics.image:invertedImageplaydate.graphics.image:blurredImageplaydate.graphics.image:setInvertedplaydate.graphics.image:blendWithImageplaydate.graphics.image:drawSampledplaydate.graphics.image:drawBlurredplaydate.graphics.image:loadplaydate.graphics.sprite:setUpdatesEnabledplaydate.graphics.sprite:updatesEnabledplaydate.graphics.sprite:setAnimatorplaydate.graphics.sprite:removeAnimatorplaydate.graphics.sprite:setTilemapplaydate.graphics.sprite:copyplaydate.graphics.sprite:getCollideRectplaydate.graphics.sprite:setRedrawsOnImageChangeplaydate.graphics.sprite:getGroupMaskplaydate.graphics.sprite:setStencilImageplaydate.graphics.sprite:alphaCollisionplaydate.graphics.sprite.querySpritesAtPointplaydate.graphics.sprite.querySpritesInRectplaydate.graphics.sprite.querySpritesAlongLineplaydate.graphics.sprite.allOverlappingSpritesplaydate.graphics.sprite.setBackgroundDrawingCallbackplaydate.graphics.sprite.getAllSpritesplaydate.graphics.sprite.performOnAllSpritesplaydate.graphics.sprite.redrawBackgroundplaydate.graphics.sprite.addDirtyRectplaydate.graphics.sprite.setClipRectsInRangeplaydate.graphics.imagetable:drawImageplaydate.graphics.imagetable:setImageplaydate.graphics.font.newFamilyplaydate.graphics.getTextSizeForMaxWidthplaydate.graphics.drawLocalizedTextplaydate.graphics.getLocalizedTextplaydate.graphics.drawArcplaydate.graphics.drawSineWaveplaydate.graphics.setPatternplaydate.graphics.perlinplaydate.graphics.perlinArrayplaydate.graphics.getDisplayImageplaydate.graphics.getWorkingImageplaydate.graphics.setScreenClipRectplaydate.graphics.setStencilImageplaydate.graphics.setStencilPatternplaydate.graphics.clearStencilplaydate.graphics.checkAlphaCollisionplaydate.graphics.animation.blinkerplaydate.graphics.videoplaydate.graphics.setFontTrackingplaydate.graphics.getFontTrackingplaydate.graphics.setFontFamilyplaydate.graphics.setLineCapStyleplaydate.graphics.imageWithTextplaydate.graphics.getSystemFontplaydate.sound.sequenceplaydate.sound.trackplaydate.sound.instrumentplaydate.sound.channelplaydate.sound.micinputplaydate.sound.lfoplaydate.sound.envelopeplaydate.sound.bitcrusherplaydate.sound.twopolefilterplaydate.sound.delaylineplaydate.sound.overdriveplaydate.sound.ringmodplaydate.sound.onepolefilterplaydate.sound.playingSourcesplaydate.sound.getHeadphoneStateplaydate.sound.setOutputsActiveplaydate.sound.controlsignalplaydate.getCrankTicksplaydate.getCrankPositionplaydate.inputHandlersplaydate.startAccelerometerplaydate.stopAccelerometerplaydate.readAccelerometerplaydate.accelerometerIsRunningplaydate.datastore.writeImageplaydate.datastore.readImageplaydate.file.modtimeplaydate.file.runplaydate.file.loadplaydate.getStatsplaydate.setCollectsGarbageplaydate.waitplaydate.stopplaydate.startplaydate.restartplaydate.getPowerStatusplaydate.getBatteryPercentageplaydate.getBatteryVoltageplaydate.isSimulatorplaydate.display.setScaleplaydate.display.getScaleplaydate.display.setInvertedplaydate.display.setMosaicplaydate.display.setFlippedplaydate.display.setOffsetplaydate.display.getRectplaydate.display.flushplaydate.display.loadImageplaydate.frameTimerplaydate.ui.gridviewplaydate.pathfinderplaydate.geometry.vector2Dplaydate.geometry.lineSegmentplaydate.geometry.polygonplaydate.geometry.affineTransformplaydate.geometry.arcplaydate.geometry.sizeplaydate.metadataplaydate.getSystemLanguageplaydate.apiVersionplaydate.argv