File tree Expand file tree Collapse file tree 4 files changed +19
-3
lines changed Expand file tree Collapse file tree 4 files changed +19
-3
lines changed Original file line number Diff line number Diff line change 3333 - name : Setup emsdk
3434 uses : mymindstorm/setup-emsdk@v14
3535 - name : Build Space Travel
36- run : emcc st.c -s USE_SDL=2 -o html/st.js
36+ run : make wasm
3737 - name : Upload artifact
3838 uses : actions/upload-pages-artifact@v3
3939 with :
Original file line number Diff line number Diff line change 22* .obj
33* .dll
44* .exe
5+ * .wasm
56/st
7+ /html /st.js
Original file line number Diff line number Diff line change 11INSTALL = install
22MKDIR = mkdir -p
3+ EMCC = emcc
34
45prefix = /usr/local
56bindir = $(prefix ) /bin
@@ -16,9 +17,17 @@ prefix=. # \
1617!endif
1718
1819LDLIBS = -lm -lSDL2
20+
1921all : st$(EXEEXT )
22+
23+ wasm : html/st.js
24+
25+ html/st.js : st.c
26+ $(EMCC ) -s USE_SDL=2 -o $@ st.c
27+
2028clean :
21- $(RM ) st$(EXEEXT )
29+ $(RM ) st$(EXEEXT ) html/st.js html/* .wasm
30+
2231install : st$(EXEEXT ) $(DESTDIR )$(bindir )
2332 $(INSTALL ) st$(EXEEXT ) " $( DESTDIR) $( bindir) "
2433
Original file line number Diff line number Diff line change 33This is a C port of Ken Thompson's
44[ Space Travel] ( https://en.wikipedia.org/wiki/Space_Travel_\( video_game\) ) ,
55ported from PDP-7 assembly. The original source files are in ` src/cmd/st*.s `
6- in the [ pdp7-unix] ( https://github.com/DoctorWkt/pdp7-unix ) repository.
6+ in the [ pdp7-unix] ( https://github.com/DoctorWkt/pdp7-unix ) repository. The game
7+ is available to [ play online] ( https://akr.am/st ) via WebAssembly.
78
89## Install
910
@@ -13,6 +14,10 @@ Run `make` to build `st`.
1314
1415Run ` make install ` to install to ` /usr/local/bin ` .
1516
17+ Run ` make wasm ` (requires [ Emscripten] ( https://emscripten.org ) ) to build a
18+ WebAssembly version of the game. To play it, launch a web server via
19+ ` python3 -m http.server -d html ` and go to http://localhost:8000 .
20+
1621## Controls
1722
1823| Key | Action |
You can’t perform that action at this time.
0 commit comments