Skip to content

Latest commit

 

History

History
37 lines (26 loc) · 1.49 KB

README.md

File metadata and controls

37 lines (26 loc) · 1.49 KB

Small test of WebAssembly with SDL2

A ball is bouncing around the canvas while background music is played. A sound effect played when the ball hits a wall.

Checkout the Demo.

Requirements

Build

  • Checkout project: git clone --recursive https://github.com/AlbertVeli/wasm_sdl2_test
  • cd wasm_sdl2_test
  • make

Test locally on port 8080

  • python -m SimpleHTTPServer 8080
  • or emrun --no_browser --port 8080 . (add --emrun to linker flags to run this way)
  • Visit http://localhost:8080/

Resources

Notes

  • I only got file loading to work together with emscripten by adding --preload-file to CFLAGS. This in turn only works with the _RW versions of the load files. Like Mix_LoadWAV_RW(SDL_RWFromFile("assets/bounce.ogg", "rb"), 1);.
  • To preload all files in the assets directory --preload-file assets is added to CFLAGS (in Makefile).
  • Ogg vorbis support is added automatically to SDL_mixer by adding -s USE_OGG=1 -s USE_VORBIS=1 to CFLAGS.

License

~~=) All Rights Reversed - No Rights Reserved (=~~

Boomtime, the 41st day of Confusion in the YOLD 3184

Albert Veli