A wrapper class to expose GDNative C++ functions to GDScript when compiling with Emscripten.
Copy the contents of
lib.cppto local version.Add the following function to your module class:
template <typename... Args>
emscripten::function wrapper(const String &func, Args &&...args) {
returnemscripten::function(func, std::forward<Args>(args)...);
}Add
<emscripten/bind.h>to your module.Call C++ functions from
main.gd.Compile project to WASM with Emscripten.