Allegro.cc - Online Community

Allegro.cc Forums » Allegro Development » Allegro 4.4.2 to JS using emscripten

This thread is locked; no one can reply to it. rss feed Print
Allegro 4.4.2 to JS using emscripten
eri0o_
Member #16,808
February 2018

Has someone managed to do it? Is there any step by step guide? Looking around I did found some resulting demos in JS that shows it's possible, but no one wrote anywhere how to do it. In some cases the person alluded they would write about it in the future, but I never found any text about it.

I tried by myself but wasn't successful.

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

ks
Member #1,086
March 2001

Incidental but may be of value: http://allegrojs.net/

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

gillius
Member #119
April 2000

Part of the reason I made https://github.com/gillius/jalleg (Java binding for Allegro) is that in addition to Java, there are many other languages that run in JVM, including multiple implementations of JS. I had JS specifically in mind as well due to its popularity now.

Since I came up with jalleg, GraalVM exists now, which offers a dramatically more compelling use case. Firstly, GraalVM allows compilation of Java to native code that can run without JRE installation on Linux amd64 instruction set. It also includes a JS implementation that supposedly meets or exceeds that of nodejs (V8) in terms of performance. GraalVM can natively JIT LLVM the same way that it handles JVM bytecode, which means even when not using native compilation mode, that it is possible to communicate between Java/JVM languages and LLVM-compiled C code with no FFI at all, allowing completely overhead-free interaction between Java and Allegro.

JAlleg is actually a JNA binding to Allegro, so by itself doesn't enable the native compilation or integration without FFI... However, GraalVM's performance as a direct JVM replacement exceeds Hotspot (default JVM) and still includes the high-performance JS implementation so even without any work you can still benefit to some speed increase and JS integration.

If someone can figure out how to compile Allegro to LLVM, then theoretically you can load Allegro like any other library into Java. I haven't figured out yet what the equivalent is for header files though which is the other half of jalleg (defining Java interfaces that define Allegro native calls).

Gillius
Gillius's Programming -- https://gillius.org/

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

Elias
Member #358
May 2000

For Allegro 5 running in a browser is more or less officially supported (using emscripten and the SDL2 port), the PR mentioned in that thread has since been merged:

https://www.allegro.cc/forums/thread/617023

--
"Either help out or stop whining" - Evert

Go to: