Inspired by my previous C/DOM interaction project, wasm-canvas, and the Java/DOM interface included with the TeaVM project, this library aims to make proof-of-concept rendering and simple visualization highly accessible to a lower level language like C++.
This project provides a layer of abstraction for manipulating elements of the HTML DOM -- with a focus on the canvas element in particular -- from C++ compiled with Emscripten.
Ultimately, I'd like this C++ library to be as feature-complete as the one provided with TeaVM for Java. While possible, such a task would require a more involved approach on the C++ side to make up for the lack of elegant compiler trickery used for the Java implementation.
This is a header-only library. All headers can be found in the include/
directory.
You can include wasm-dom.hpp
for all available functionality,
#include "wasm-dom.hpp"
or include individual headers.
#include "wasm-dom/HTMLCanvasElement.hpp"
Compile your source code with Emscripten.
$ em++ -Wall main.cpp -o index.html
For more involved compilation examples, see the Makefiles for the projects linked below. They can be found within the test/
directory.
Canvas Rendering Function Tests
Basic Physics Simulation (warning: flashing visuals)