Como Transformar seus Jogos C/C++ para Web com Emscripten (SDL2)
seen from China

seen from Brazil
seen from India

seen from United States
seen from United States
seen from United States
seen from Germany
seen from France

seen from Italy
seen from China

seen from Poland
seen from United States
seen from China
seen from China

seen from France
seen from China
seen from China
seen from United States
seen from United States
seen from United States
Como Transformar seus Jogos C/C++ para Web com Emscripten (SDL2)

Anya is live and ready to show you everything. Watch her strip, dance, and perform exclusive shows just for you. Interact in real-time and make your fantasies come true.
Free to watch • No registration required • HD streaming
Atari Projects Online
Here some Atari "virtual machines" to run in your browser. Basic, Logo, Assembler, etc. Work in progress, just for fun... from Chile to the World 📷
雑にゲームを作る(4)
雑にゲームを作る(3)からの続き
結局前回Emscripten版がうまく動いてなかったのは、試行錯誤最中に間違えてSDL_Init()を呼ぶコードをコメントアウトしてしまっていたためだった。しょうもない…入れたら割と動いてくれるようになった。
Emscripten版とネイティブ版は割とソースコード共通でいけるんだけど、一部違うところがある。
OpenGLのバージョン。ネイティブ版は3.3 core profile, Emscripten版は3.0 ES profile。それに伴ってシェーダの一行目に書くバージョンも変わる。
メインループの回し方。emscripten_set_main_loop_arg()などの関数でコールバックとして呼ばれるようにしないといけない
ファイルの読み方。一旦そのままだと無理そうだなということで、フォントファイルを使った文字描画処理は外してある
いままでは、たとえばテトリスを実装して「やった~遊んでもらうぞ~」と思っても相手の人がWindows PCを持っていない場合動かせなかったのだけど、Emscriptenならブラウザ上で動くので、より遊んでもらいやすいということになる。雑に作ったゲームは雑に遊んでほしいので、配布方法も手軽であってほしい。たとえばitch.ioに埋め込むような用途も可能。
ちょっと話がそれるけど、ちょうど gs2というサービスが「売上高1000万以下なら無料」という大盤振る舞いをするというニュースが出てた。こういうバックエンドサービス使えばお手軽にクラウドセーブ機能を導入できていいんじゃないかなーと思った。ただEmscripten用C++は公式SDKの対象外な気がするので、移植大変なんじゃないかなー。ちょっと試してみたい。
http://gs2.hatenablog.com/entry/2020/06/10/092417
雑にゲームを作る(3)
雑にゲームを作る(2)から引き続き。今週末はEmscriptenビルドを試していた。
最初、CMakeでvcpkgを使いながらEmscriptenのビルドをする方法を確立するのに時間がかかった。どうもvcpkgのEmscripten対応はごく最近マージされた状態のようで、他に試している人があんまり見つからなかった。結局いろいろやってみて、 CMAKE_TOOLCHAIN_FILE変数をvcpkg.cmakeに、VCPKG_CHAINLOAD_TOOLCHAIN_FILE変数をEmscripten.cmakeに設定してビルドすればできた。
その後ビルドはできるものの動かないという状態が続いた。OpenGL,OpenGL ES,GLSL,WebGLそれぞれのバージョンがどう対応しているかがよくわからず、混乱のもととなった。結局OpenGL ES 3.0(GLSL ES 3.0)ならWebGL2で動きそうということでいろいろ試行錯誤したけどなかなか原因がわからず、最後に最小構成まで削った状態で試してみたところ動いたのでよかった。あとはどこが原因かをコード足しながら探せばよさそう。
最小構成のコードはこちらに置いておきます。https://gist.github.com/neguse/dc5d04ec65bec7d82d47f0a2a9745637
Shrinking WebAssembly And JavaScript Code Sizes in Emscripten
Emscripten is a compiler toolchain for asm.js and WebAssembly which helps you to run C and C++ on the net at near-native speed. Emscripten output sizes have decreased quite a bit just lately, particularly for smaller packages. For instance, heres a bit C code: #include EMSCRIPTEN_KEEPALIVEint add(int x, int y) { return x + y;} This is the good day world of pure computation: it exports a single…
View On WordPress

Anya is live and ready to show you everything. Watch her strip, dance, and perform exclusive shows just for you. Interact in real-time and make your fantasies come true.
Free to watch • No registration required • HD streaming
Our talk about Compiling C to Java Script in Mexico City
An Mbed In Your Browser
If you have dabbled in the world of ARM microcontrollers, you might be familiar with the Mbed platform, a software abstraction layer for a range of ARM-based small dev boards. If you don’t have an Mbed board but fancy giving it a go, you might imagine that you’d be out of luck, but [Jan Jongboom] could have an answer to your problem in the form of an Mbed simulation in your browser. We’re not high-end ARM microcontroller developers here at Hackaday so beyond observing that it brings the Mbed abstraction layer binaries to the browser through the magic of Emscripten …read more http://pje.fyi/Q6RCfN
[emscripten][WebAssembly]SHA256 implementation
C版SHA256コードをemscripten(wasmアウトプット)でJavaScriptで使えるようにしたもの。 nodejsのcryptoモジュールとの速度比較もしてある。
sha256mod.js: emscriptenモジュールをロードして、classとして提供するcommonsjsモジュール
sha256main.js: sha256sumと同じアウトプットとチェックができるコマンドラインコード
sha256.h, sha256extracted.c: emscriptenでコンパイルする対象
package.json: emccでのビルドスクリプトが入っている。npx実行も対応
付録
crypto-sha256.js: nodejsのcryptoモジュールでのコマンドライン実装(ハッシュ生成のみ)
sizeof.c: C構造体のメモリサイズとメンバーオフセットの値の確認用プログラム