Porting an existing code base to Emscripten is not always a simple task. There are several variables to take into account when evaluating whether a C, C++, or Rust application is amenable to conversion. For example, games that make use of several third-party libraries or even a few third-party libraries that are of considerable complexity may require a significant amount of effort. Emscripten provides the following commonly used libraries out of the box:
- asio: A network and low-level I/O programming library
- Bullet: A real-time collision detection and multi-physics simulation library
- Cocos2d: A suite of open source, cross-platform, game development tools
- FreeType: A library used to render fonts
- HarfBuzz: An OpenType text shaping engine
- libpng: The official PNG reference library
- Ogg: A multimedia container format
- SDL2: A library designed to provide low-level access to audio, a keyboard, a mouse, a joystick, and graphics hardware
- SDL2_image: An image file loading library
- SDL2_mixer: A sample multi-channel audio mixer library
- SDL2_net: A small sample cross-platform networking library
- SDL2_ttf: A sample library that allows you to use TrueType fonts in your SDL applications
- Vorbis: A general purpose audio and music encoding format
- zlib: A lossless data compression library
If the library isn't already ported, you will need to do it yourself. This would benefit the community, but requires a significant investment of time and resources. Our Tetris example only uses SDL2, which makes the porting process relatively simple.