Skip to content

AlbertVeli/wasm_sdl2_test

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Test of WebAssembly + SDL2

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published