Free-wheeling apps are intended to be self-contained. Any copy of them can be modified by anyone.
LBOL46MAMM2KPDYLL2ZVYKP2RG5Z3M7CU7IACAAV47MOAU6MI45QC
WNL5Z7EKPNBDZM6ACJOBL725XLQDQMDG6D276J257UJTROBFJH4QC
NTZFKMI3QXFEY35TGORPOLGCZTLTOQ7XL3HZP6PVKF4LXK5WNF2QC
FS2ITYYHBLFT66YUC3ENPFYI2HOYHOVEPQIN7NQR6KF5MEK4NKZAC
GKEF3WAPO3PU5DFROOJFS6LAJDFLFGX67IY46CR5VVZWRCYCAD2QC
5FWVELA5XU72JOLKVJMIIEFUIFPJQD2MEQQZVGLB3PMNVJPJT2PAC
FY7BSGYTKQRCNTH26OD6SJMQPXNBBQNTN26RPXXWKNIQ7IKPXKMQC
MD3W5IRAC6UQALQE4LJC52VQNDO3I3HXF3XE2XHDABXBYJBUVAXQC
D4FEFHQCSILZFQ5VLWNXAIRZNUMCDNGJSM4UJ6T6FDMMIWYRYILQC
ZTMRQZSWUL6FJRI4C4H37MR2IMV22DB6KRGEOUNYRWW5CTAVQFKAC
CZRMAMSBRVX26IXKHNPG6M3YSWMOZTM73X3XHAMBDSNETTFVRCUQC
PNBKVYZ4ANUAZNQN6KEWYNDF7552ROZPNAPRJE7Q6O7ZZJMJ3S3QC
UGYRO7TO3TQNWUX2GQL7ZPROUCR7WDOGYDTLZG2A6FHQ65YVCFMAC
# spokecone.love
A tool for manually and painstakingly creating debug experiences tailored to a
specific domain and program. Get on the road to learning to [reinvent wheels](https://handmade.network/jam)
for [bicyles of the mind](https://merveilles.town/@akkartik/108607458977376162).
([video demo; 30 seconds](https://handmade.network/snippet/1533))
Concretely, spokecone.love is an editor for Lua programs written in a certain
style amenable to debug by print. The programs are plain text, but with a
twist. Every line has an optional _fold_, a special character. Spokecone.love
renders such _bifold_ text to show just text before the fold (normal text)
by default. Text after the fold (debug prints) can be shown on demand. Evolve
your debug prints with your program while keeping programs looking clean and
short by default. The debug prints will still execute.
When you open a log generated from the debug prints, spokecone.love opens in
_tenon auger_ mode. Logs are rendered read-only, but can be rendered in
arbitrarily sophisticated graphical ways as client programs specify.
# pong.love
spokecone.love is a fork of [lines.love](http://akkartik.name/lines.html),
an editor for plain text where you can also seamlessly insert line drawings.
Designed above all to be easy to modify and give you early warning if your
modifications break something.
([Names inspired by modern wheelwrights working to keeping their craft alive.](https://www.youtube.com/watch?v=mOXT3dFFOPU))
An example repo that shows a simple game of Pong -- with all the tools needed
to read and modify its inner workings.
```
Run the editor on the example codebase:
```
love spokecone pong/main.splua
```
Check out the keyboard shortcuts below to see what you can do.
Close the editor when you're done. (It'll autosave.)
Build the example program. This requires an extra step:
```sh
cd pong
./build # unfortunately Unix only for now; PRs welcome
cd ..
Play a few games. It'll generate a file called `log` in the current directory.
Open `log` using spokecone:
```
love spokecone log
```
Try clicking on log lines to expand them or open the source code that
generated them.
## Invocation
To run from the terminal, [pass this directory to LÖVE](https://love2d.org/wiki/Getting_Started#Running_Games).
Arguments in _spoke cone_ (edit) mode:
* source file to edit
Arguments in _tenon auger_ (log browser) mode:
* log file to parse and browse read-only
* (optional) a source file containing lua definitions in namespace
`debug_log_render` that will be used to render log lines. For example:
```
debug_log_render = {}
function debug_log_render.state(obj, x,y, w)
assert(obj.name == 'state')
local h = 30
love.graphics.rectangle('line', x,y, w,h)
return h
end
```
When you want to read or modify the game, open up its editor by pressing
`ctrl+e`. (Check out more keyboard shortcuts below to see what you can do.)
Definitions return the height they need to render their argument. Tenon
auger will pass in a non-overlapping `y` to the next line.
* `a`/`z` to move the left-hand paddle
* `up`/`down` to move the right-hand paddle
* `space` to start a new game
Alternatively, turn it into a .love file you can double-click on:
```
$ zip -r /tmp/spokecone.love *.lua
```
## Keyboard shortcuts: reading source code for Pong
By default, it reads/writes the file `lines.txt` in your default
user/home directory (`https://love2d.org/wiki/love.filesystem.getUserDirectory`).
* `ctrl+e` to go back to playing Pong, using any changes you made
To open a different file, drop it on the app window.
* `ctrl+enter` to open the command palette and perform various commands
* `ctrl+g` to switch to a different file
* `ctrl+l` to toggle a second editor on the right for recent logs. Useful when
debugging.