55 lines
1.2 KiB
Org Mode
55 lines
1.2 KiB
Org Mode
* Foreplay — toys to test the water
|
|
|
|
This is an exhibition of games and tools written in Sex, that are capable to run in the browser.
|
|
|
|
** Layout
|
|
|
|
The page is static, a toy is one folder, each toy keeps its own Emscripten runtime.
|
|
|
|
#+begin_src
|
|
index.html gallery shell
|
|
site.css
|
|
site.js menu, hash, frame, source
|
|
toys.json the menu
|
|
toys/<id>/
|
|
<id>.sex
|
|
index.html what the frame loads
|
|
<id>.js
|
|
<id>.wasm
|
|
#+end_src
|
|
|
|
~toys.json~ is a list:
|
|
|
|
#+begin_src json
|
|
[
|
|
{
|
|
"id": "triangle",
|
|
"title": "Triangle",
|
|
"blurb": "The basic thing in games.",
|
|
"source": "triangle.sex"
|
|
}
|
|
]
|
|
#+end_src
|
|
|
|
~id~ is the folder name and the hash (~#triangle~). ~source~ is the Sex
|
|
file the source button shows. Leave ~source~ out when a toy has nothing
|
|
to show.
|
|
|
|
Serve this directory with any static file server:
|
|
|
|
#+begin_src shell
|
|
python3 -m http.server
|
|
#+end_src
|
|
|
|
Opening ~index.html~ from disk will not load ~toys.json~.
|
|
|
|
** Adding a toy
|
|
|
|
1. Put the program at ~toys/<id>/<id>.sex~.
|
|
2. Compile it with ~sexc~, then Emscripten, and write ~index.html~,
|
|
~<id>.js~, and ~<id>.wasm~ into that same folder.
|
|
3. Add an entry to ~toys.json~.
|
|
|
|
The wasm and the generated page stay in the repo, so the gallery is only
|
|
files.
|