Saturday, November 2, 2013

Using Emscripten to compile C++ to JavaScript on Windows 8

Small victories.

Credit goes to this post from Joshua Granick for providing the guidance for doing this.

Joshua Granick's post pointed to where the brilliant mind behind Emscripten (Alon Zakai) put up a guide for Using Emscripten on Windows.

His post also pointed to his code for drawing an image in C++ and compiling it to JavaScript found as a gist here.

Successful compilation of the code in his gist produces the image that he posted here of a red triangle on a black background.

I don't know anything about the Simple DirectMedia Layer yet, but I was able to change the colors and size of the image and display it in the browser. Below is a screenshot of the JavaScript produced image.


This means that C++ code was turned to JavaScript that was then executed in a browser. Magnificent.

No comments:

Post a Comment