Sam Claus
Sam Claus

Reputation: 1991

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?

Upvotes: 2

Views: 1082

Answers (1)

Vadim Macagon
Vadim Macagon

Reputation: 14847

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.

Upvotes: 3

Related Questions