Sam Claus Sam Claus - 1 year ago 108
C++ Question

Hook up C++ code to an HTML canvas in an Electron app?

I'm current developing a MOBA as a hobby. The interface is made with Angular-Material, and I plan to move development into an Electron app at some point. I've planned to something like ASM JS in tandem with an HTML canvas for game rendering from the beginning. But now I'm wondering if I can use Node to hook up some internal C++ code to render to a canvas in my Electron app. Is this possible?

Answer Source

The Chromium API Electron is built on is not exposed to native Node addons, so I don't think you'll be able to directly render to the canvas from a native Node addon. But Electron does support Chromium's Pepper plugins, which should be capable of rendering GPU accelerated content, so that's probably your best bet. Unfortunately I've never managed to find any documentation that outlines the full capabilities of Pepper plugins, but at least there are some sample plugins you can look at.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download