Tag Archives: simulator

Setting up your Mac to create a Playdate app

This guide is written on macOS Monterey (v12.3).

playdate simulator

Here are instructions on setting up & running the most barebones app possible on macOS. There are probably better ways to do this, but here’s one way that works for me.

  1. Download & install the SDK via https://play.date/dev/

  2. Update your ~/.zshrc file with the following line:

    export PLAYDATE_SDK_PATH=/Users/rex/Developer/PlaydateSDK

    Obviously you want to replace “rex” with your username.

  3. Create a new folder for your project (anywhere)
    mkdir playdate_hello_world
    cd playdate_hello_world

  4. Create a VS Code folder & settings file
    mkdir .vscode
    touch .vscode/settings.json


  5. Put the following into your new settings.json file. Make sure to replace the 2 instances of “rex” with your username

    {
    "Lua.runtime.version": "Lua 5.4",
    "Lua.diagnostics.disable": [
    "undefined-global",
    "lowercase-global"
    ],
    "Lua.diagnostics.globals": [
    "playdate",
    "import"
    ],
    "Lua.runtime.nonstandardSymbol": [
    "+=",
    "-=",
    "*=",
    "/="
    ],
    "Lua.workspace.library": [
    "/Users/rex/Developer/PlaydateSDK/CoreLibs"
    ],
    "Lua.workspace.preloadFileSize": 1000,
    "playdate.sdkPath": "/Users/rex/Developer/PlaydateSDK"
    }


    (Apologies for the formatting. WordPress & code doesn’t mix well). You can copy & paste above (and make sure to replace the 2 “rex”s)

  6. Create a simple file for your app
    mkdir source
    touch source/main.lua

    Copy the following into main.lua:

    import "CoreLibs/object"
    import "CoreLibs/graphics"
    import "CoreLibs/sprites"
    import "CoreLibs/timer"

    function playdate.update()
    print "Hello world"
    end


    Obviously this code does not do very much. It’s super, super basic, but it compiles & runs!

  7. Install the following VS Code extensions (sumneko.lua, jep-a.lua-plus, and Orta.playdate)

  8. Run your app on the Playdate Simulator with VS Code.

    Press Cmd + Shift + P and select & run [Run app in Playdate simulator]

  9. That’s it! Your app is now running on the Playdate sim. You can view print statements by using Window > Console.

For more comprehensive details, refer to the SDK documentation: https://sdk.play.date/1.10.0/

For the sample files discussed here, see repo: https://github.com/xta/playdate_hello_world

iOS Simulator

When previewing a site on my iPhone (1136 x 640), I wasn’t satisfied with using my iPhone 5 or a Chrome browser Window Resizer app.

Turns out it’s super simple to use the iOS Simulator with Xcode on OS X (version 10.8.5).

Select Xcode > Open Developer Tool > iOS Simulator

xcode

You’ll be presented with an iPhone to navigate within. Select Safari and you can use a site like localhost:3000 for development.

 
ios_sim