Awesomium Wrapper

Hi,

i wrote a C-wrapper for the C++ API of Awesomium. I made it a Google Code project. Based on that wrapper i wrote a JNA bridge so we can have nice things in Java as well.

You can find the code for it at here as part of libgdx. It’s totally self-contained though with only a dependency to JNA. The code is Apache 2 and the version of awesomiumc i use i license as Apache 2 as well :slight_smile: So the Java wrapper is totally free to use. The only caveat is that Awesomium itself is only free for non-commercial projects, indie licenses are 300$ atm.

So what is this all about? Here’s an image:

http://www.file-pasta.com/thumbnail/983/gdx-awesomium.png.png

This is an OpenGL Java application displaying the output of Awesomium on a simple quad. I also inject keyboard and mouse events into the Awesomium instance. As you can see it renders a Youtube video (it also plays audio of course). Awesomium is an off-screen web engine based on Chromium that is intended to be used for apps like games. We can use this in Java now as well. There’s a couple of restrictions though:

  • Windows only at the moment. Awesomium also supports MacOS but i don’t have a Mac to compile the c-wrapper on. Volunteers welcome.
  • 32-bit only at the moment. This is again a limitation of Awesomium itself, you’ll need a 32-bit VM to run any app using Awesomium. No idea whether that will change in the future.

I expose almost all the original Awesomium classes and interfaces except for the ResourceIntercepter stuff that allows you to inject your own resources. Interaction with the V8 Javascript engine is in the c-wrapper but not yet fully implemented in the Java wrapper. I’ll add that asap.

Here you can download a self-contained jar. It’s 20mb due to the shared lib of Awesomium being a huge mofo. My server is slow so give it some time. Once downloaded put it in its own folder as it will unpack a couple of things. Start it up (on a 32-bit VM) and browse away. I don’t pipe all keycodes to Awesomium yet, the same is true for the scrollwheel events. Other than that everything should work. Oh, you can also resize the window for profit…

The code for that little demo based on libgdx can be found at http://code.google.com/p/libgdx/source/browse/trunk/extensions/awesomium/gdx-awesomium-tests/src/com/badlogic/gdx/awesomium/GLTest.java?r=1251. Yes, it is not the most beautiful code ever but it does the job.

I plan on wrapping Berkelium as well as its BSD and available for all mainstream OS out there. Will take some time.

oh super cool stuff, webkit inside opengl java :slight_smile:

Should be really cool for stuff that ppl usually struggle with in OpenGL like GUI’s, playing video and in game web content.

Hi badlogic, I seem to recall contacting you a few months ago about this very thing! But you never replied :confused:

Cas :slight_smile:

Hi Cas,

i don’t remember you contacting me as i started that wrapper thing just 2 days ago. ???

ciao,
Mario

edit: oh just to clarify. I’m not part of the Awesomium project/Khrona. I just used their stuff and wrote a c-wrapper around their C++ API.

Ah that’d be it then :slight_smile: I contacted the Awesomium devs and asked if they might be interested in doing a Java port for the LWJGL project but they declined to reply. I think they thought I was some sort of fruitcake.

Cas :slight_smile:

Well, that’s not really far off it is?

I suppose not. I’m pretty keen on Awesomium but it’s got to play nice with LWJGL, and it’s got to work on i386, x64, Linux 32 and 64bit too, Mac OS PPC and Intel.

Cas :slight_smile:

Cool stuff! I’m more interested in Berkelium though.

Yes, i’m also more interested in Berkelium. I’ll see what i can do. Not a priority at the moment. But the API is similar and should be easily wrappable as well.