{"id":2395,"date":"2022-05-08T19:59:06","date_gmt":"2022-05-08T23:59:06","guid":{"rendered":"https:\/\/www.rexfeng.com\/blog\/?p=2395"},"modified":"2022-05-08T20:07:05","modified_gmt":"2022-05-09T00:07:05","slug":"setting-up-your-mac-to-create-a-playdate-app","status":"publish","type":"post","link":"https:\/\/www.rexfeng.com\/blog\/2022\/05\/setting-up-your-mac-to-create-a-playdate-app\/","title":{"rendered":"Setting up your Mac to create a Playdate app"},"content":{"rendered":"\n<p><em>This guide is written on macOS Monterey (v12.3).<\/em><\/p>\n\n\n\n<p><img loading=\"lazy\" decoding=\"async\" width=\"400\" height=\"332\" class=\"wp-image-2401\" style=\"width: 400px;\" src=\"http:\/\/www.rexfeng.com\/blog\/wp-content\/uploads\/2022\/05\/pd.png\" alt=\"playdate simulator\" srcset=\"https:\/\/www.rexfeng.com\/blog\/wp-content\/uploads\/2022\/05\/pd.png 1060w, https:\/\/www.rexfeng.com\/blog\/wp-content\/uploads\/2022\/05\/pd-300x249.png 300w, https:\/\/www.rexfeng.com\/blog\/wp-content\/uploads\/2022\/05\/pd-540x448.png 540w, https:\/\/www.rexfeng.com\/blog\/wp-content\/uploads\/2022\/05\/pd-150x125.png 150w, https:\/\/www.rexfeng.com\/blog\/wp-content\/uploads\/2022\/05\/pd-768x638.png 768w, https:\/\/www.rexfeng.com\/blog\/wp-content\/uploads\/2022\/05\/pd-624x518.png 624w\" sizes=\"auto, (max-width: 400px) 100vw, 400px\" \/><br><br>Here are instructions on setting up &amp; running the most <strong>barebones<\/strong> app possible on macOS. There are probably better ways to do this, but here&#8217;s one way that works for me.<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>Download &amp; install the SDK via <a href=\"https:\/\/play.date\/dev\/\">https:\/\/play.date\/dev\/<\/a><br><br><\/li><li>Update your <code><strong>~\/.zshrc<\/strong><\/code> file with the following line: <br><br><strong><code>export PLAYDATE_SDK_PATH=\/Users\/rex\/Developer\/PlaydateSDK<\/code> <\/strong><br><br>Obviously you want to replace &#8220;rex&#8221; with your username.<br><br><\/li><li>Create a new folder for your project (anywhere)<br><strong><code>mkdir playdate_hello_world<\/code><br><code>cd playdate_hello_world<\/code><br><\/strong><br><\/li><li>Create a VS Code folder &amp; settings file<br><strong><code>mkdir .vscode<br>touch .vscode\/settings.json<\/code><br><\/strong><br><\/li><li>Put the following into your new settings.json file. Make sure to replace the 2 instances of &#8220;rex&#8221; with your username<br><br><code><strong>{<br>    \"Lua.runtime.version\": \"Lua 5.4\",<br><code>    <\/code>\"Lua.diagnostics.disable\": [<br><code>    <\/code>    \"undefined-global\",<br><code>    <code>    <\/code><\/code>\"lowercase-global\"<br><code>    <\/code>],<br><code>    <\/code>\"Lua.diagnostics.globals\": [<br><code>        <\/code>\"playdate\",<br><code>    <code>    <\/code><\/code>\"import\"<br><code>    <\/code>],<br><code>    <\/code>\"Lua.runtime.nonstandardSymbol\": [<br><code>    <\/code>\"+=\",<br><code>    <\/code>\"-=\",<br><code>    <\/code>\"*=\",<br><code>    <\/code>\"\/=\"<br><code>    <\/code>],<br><code>    <\/code>\"Lua.workspace.library\": [<br><code>    <\/code>    \"\/Users\/rex\/Developer\/PlaydateSDK\/CoreLibs\"<br><code>    <\/code>],<br><code>    <\/code>\"Lua.workspace.preloadFileSize\": 1000,<br><code>    <\/code>\"playdate.sdkPath\": \"\/Users\/rex\/Developer\/PlaydateSDK\"<br>}<\/strong><\/code><br><br>(Apologies for the formatting. WordPress &amp; code doesn&#8217;t mix well). You can copy &amp; paste above (and make sure to replace the 2 &#8220;rex&#8221;s)<br><br><\/li><li>Create a simple file for your app<br><code><strong>mkdir source<br>touch source\/main.lua<br><\/strong><\/code><br>Copy the following into main.lua:<br><br><strong><code>import \"CoreLibs\/object\"<br>import \"CoreLibs\/graphics\"<br>import \"CoreLibs\/sprites\"<br>import \"CoreLibs\/timer\"<br><br>function playdate.update()<br>    print \"Hello world\"<br>end<\/code><br><\/strong><br>Obviously this code does not do very much. It&#8217;s super, super basic, but it compiles &amp; runs!<br><br><\/li><li>Install the following VS Code extensions (sumneko.lua, jep-a.lua-plus, and Orta.playdate)<br><br><\/li><li>Run your app on the Playdate Simulator with VS Code.<br><br>Press Cmd + Shift + P and select &amp; run [Run app in Playdate simulator]<br><br><\/li><li>That&#8217;s it! Your app is now running on the Playdate sim. You can view print statements by using Window &gt; Console.<br><\/li><\/ol>\n\n\n\n<p>For more comprehensive details, refer to the SDK documentation: <a href=\"https:\/\/sdk.play.date\/1.10.0\/\">https:\/\/sdk.play.date\/1.10.0\/<\/a><br><br>For the sample files discussed here, see repo: <a href=\"https:\/\/github.com\/xta\/playdate_hello_world\">https:\/\/github.com\/xta\/playdate_hello_world<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This guide is written on macOS Monterey (v12.3). Here are instructions on setting up &amp; running the most barebones app possible on macOS. There are probably better ways to do this, but here&#8217;s one way that works for me. Download &amp; install the SDK via https:\/\/play.date\/dev\/ Update your ~\/.zshrc file with the following line: export [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[1117,1490,1192,1489,1085],"class_list":["post-2395","post","type-post","status-publish","format-standard","hentry","category-tech","tag-dev","tag-gamedev","tag-games-2","tag-playdate","tag-simulator"],"_links":{"self":[{"href":"https:\/\/www.rexfeng.com\/blog\/wp-json\/wp\/v2\/posts\/2395","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rexfeng.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rexfeng.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rexfeng.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rexfeng.com\/blog\/wp-json\/wp\/v2\/comments?post=2395"}],"version-history":[{"count":11,"href":"https:\/\/www.rexfeng.com\/blog\/wp-json\/wp\/v2\/posts\/2395\/revisions"}],"predecessor-version":[{"id":2408,"href":"https:\/\/www.rexfeng.com\/blog\/wp-json\/wp\/v2\/posts\/2395\/revisions\/2408"}],"wp:attachment":[{"href":"https:\/\/www.rexfeng.com\/blog\/wp-json\/wp\/v2\/media?parent=2395"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rexfeng.com\/blog\/wp-json\/wp\/v2\/categories?post=2395"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rexfeng.com\/blog\/wp-json\/wp\/v2\/tags?post=2395"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}