変愚蛮怒のメインリポジトリです
Revision | 25717ea3e630c6053a4db503332bddca8c719454 (tree) |
---|---|
Zeit | 2020-03-23 23:27:11 |
Autor | shimitei <shimitei@gmai...> |
Commiter | shimitei |
Web workerで動かす
表示はとりあえずconsoleへ
@@ -1,5 +1,6 @@ | ||
1 | 1 | /* File: main-wasm-term.c */ |
2 | 2 | |
3 | +#include <emscripten.h> | |
3 | 4 | #include "angband.h" |
4 | 5 | |
5 | 6 | /* |
@@ -70,6 +71,10 @@ static void Term_nuke_wasm(term* t) | ||
70 | 71 | static errr Term_text_wasm(int x, int y, int n, byte a, concptr s) |
71 | 72 | { |
72 | 73 | printf("%s", s); |
74 | + EM_ASM({ | |
75 | + var s = UTF8ToString($0); | |
76 | + console.log(s); | |
77 | + }, s); | |
73 | 78 | |
74 | 79 | /* Success */ |
75 | 80 | return (0); |
@@ -0,0 +1,11 @@ | ||
1 | +<html> | |
2 | +<script> | |
3 | +var worker = new Worker("hengband.js"); | |
4 | +worker.onerror = function (e) { | |
5 | + console.log(e); | |
6 | +} | |
7 | +worker.onmessage = function (e) { | |
8 | + console.log(e.data); | |
9 | +} | |
10 | +</script> | |
11 | +</html>> | |
\ No newline at end of file |