You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Copy file name to clipboardExpand all lines: README.md
+11-9
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,10 @@
1
-
# TSC-PICO-8 - TypeScript for PICO-8
1
+
# TS-PICO-8 - TypeScript for PICO-8
2
2
3
3

4
4
5
5
Create [PICO-8](https://www.lexaloffle.com/pico-8.php) games in TypeScript!
6
6
7
-
TSC-PICO-8 contains all the function declarations (`.d.ts`) for the PICO-8 API
7
+
TS-PICO-8 contains all the function declarations (`.d.ts`) for the PICO-8 API
8
8
and will compile your TypeScript code to Lua and inject it into your PICO-8 cart.
9
9
10
10
Compression and mangling options are configurable to optimize for token usage, and
@@ -23,20 +23,22 @@ using a typed language with PICO-8.
23
23
24
24
### Prerequisites
25
25
26
-
1. Install a recent version of NodeJS
27
-
2. Clone this repository to your local machine
28
-
3. Install dependencies `npm install`
26
+
1. Install a recent version of PICO-8
27
+
2. Install a recent version of NodeJS
28
+
3. Clone this repository to your local machine
29
+
4. Install dependencies `npm install`
29
30
30
31
### Create a PICO-8 project
31
32
32
33
1. Run `bin/tspico8 init` to generate the default workspace `p8workspace`.
33
-
2. Optionally configure `p8workspace/tspico8.json` to specify compression, mangling, and pico-8 location.
34
+
2. Optionally configure `p8workspace/tspico8.json` to specify compression, mangling, and pico-8 location. Note: tspico8 will attempt to detect the pico-8 location automatically.
34
35
3. Run `bin/tspico8 run` to watch for changes inside of `p8workspace` and recompile/relaunch when detected.
35
36
36
37
### Configuration (tspico8.json)
37
38
38
39
```
39
40
{
41
+
// Set this if tspico8 can't find your pico-8 install automatically
40
42
"pico8": {
41
43
"executable": "path/to/pico8/executable/file"
42
44
},
@@ -74,9 +76,9 @@ Lua is accomplished as follows.
74
76
75
77
1. A file watcher (chokidar) watches `p8workspace` for any changes to `*.ts` or `spritesheet.png`.
76
78
2. When a change is detected, `tsc` is invoked and the resulting JavaScript dumps to `p8workspace/build/compiled.js`.
77
-
3.A second file watcher (chokidar) detecs a change to `compiled.js`and runs uglify with the params
78
-
provided in `tspico8.json` to produce a compressed JavaScript file `p8workspace/build/compressed.js`.
79
-
4. The compressed JavaScript file is then fed to a PICO-8 specific JavaScript to Lua compiler (jspicl-cli) that does something very close to a one to translation and assembles the final cart.
79
+
3.The `compiled.js`is fed into uglify with the params provided in `tspico8.json`
80
+
to produce a compressed JavaScript file `p8workspace/build/compressed.js`.
81
+
4. The compressed JavaScript file is then fed to a PICO-8 specific JavaScript to Lua compiler (jspicl-cli) that does something very close to a one-to-one translation and assembles the final cart.
80
82
81
83
The PICO-8 Lua interpreter is somewhat limited compared to modern Lua, so there are a lot of
82
84
scenarios where unexpected output from any stage of this process can break your cart.
0 commit comments