【发布时间】:2020-07-14 18:25:43
【问题描述】:
请有人帮我解决这个问题吗? 我有画布,插入 html 并在 C 中使用 WebAssembly 绘制,但是它似乎阻止了 HTML 表单输入字段 - 一旦加载并运行 wasm 模块,我就无法输入任何内容......
我在 C 中使用 emscripten_set_main_loop_arg() 代替 JS 中的 requestAnimationFrame():
const int simulate_infinite_loop = 1; // call the function repeatedly
const int fps = -1; // call the function as fast as the browser wants to render (typically 60fps)
emscripten_set_main_loop_arg(render, &cbp, fps, simulate_infinite_loop);
稍后,我将其插入到 HTML 中:
<script type='text/javascript'>
var Module = {};
fetch('app/aghdr.wasm')
.then(response =>
response.arrayBuffer()
).then(buffer => {
Module.canvas = document.getElementById("canvas");
Module.wasmBinary = buffer;
var script = document.createElement('script');
script.src = "app/aghdr.js";
script.onload = function() {
console.log("Emscripten boilerplate loaded.")
}
document.body.appendChild(script);
});
</script>
有谁知道,在 WASM 模块运行时确保正常的 HTML 表单 处理消息很热吗?
【问题讨论】:
标签: html c forms web webassembly