Web版吉里吉里SDL2はJavascriptを呼び出せます。 足りない機能をJavaScriptで書けたりします。
仕組みとしてはEmscriptenの仕組みを呼び出す吉里吉里プラグインであり、実装は「krkrsdl2/src/plugins/kremscripten.cpp」にあります。
これは@xyx0no646のチラシの裏です。内容は保証できません。
| /** | |
| * These snipets are licensed under CC0. | |
| * http://creativecommons.org/publicdomain/zero/1.0/deed.ja | |
| * | |
| * Rewrite to SDL_uikitview.m and LongPressGesture is associated to "Right-Click" | |
| */ | |
| - (instancetype)initWithFrame:(CGRect)frame | |
| { | |
| if ((self = [super initWithFrame:frame])) { |
| ; 注意:もっと良いバージョン(JavaScriptで実装されたWaveSoundBuffer)ができました。 | |
| ; 以下を参照してください。 | |
| ; https://gist.github.com/xyx0no646/71363ab2b47dcfdcc920afe0570abd8d | |
| ; | |
| ;[playse2]/[stopse2]/[playbgm2]/[stopbgm2] | |
| ; | |
| ;Web版吉里吉里SDL2で動作するplaybgm / playseタグもどき | |
| ;oggの再生と停止以外は対応しない | |
| ;Licence CC0 / author:@xyx0no646 | |
| ;ご自由にお使いください |
| ;Licence CC0 / author:@xyx0no646 | |
| ;ご自由にお使いください | |
| [iscript] | |
| // LinkEditLayerを誇張する。 | |
| // Emscriptenの場合は、ClickされたらJavaScriptのPromptを出す | |
| // それ以外はただのLinkEditLayer | |
| // 2021/8/26 更新 文字列のEvalを避け、windowコンテキストを持って来るようにする | |
| // キャンセル時の挙動を改善 |
| /** | |
| * JavaScriptで実装されたWaveSoundBuffer | |
| * | |
| * oggやwav,mp3の再生・停止、音量変更など基本的な機能は動作します。 | |
| * 一方でループチューナーなどいろいろなものが実装されていません。 | |
| * | |
| * 使い方: | |
| * (1) dataフォルダに「JSWaveSoundBuffer.tjs」と言う名前でこのファイルを保存する | |
| * (2) startup.tjsのスタブなどを書いている場所の下に以下の記述を行う | |
| ;Licence CC0 / author:@xyx0no646 | |
| ;ご自由にお使いください | |
| [iscript] | |
| // フルスクリーン対応 | |
| if (System.platformName === 'Emscripten') { | |
| KirikiriEmscriptenInterface.evalJS(" | |
| if(!window.__onfullschreenchanged) { | |
| document.addEventListener('fullscreenchange',window.__onfullschreenchanged = () => { | |
| window.dispatchEvent(new Event('resize')); |
| class SomeObject{ | |
| function SomeObject(){ | |
| this.setTimeout = KirikiriEmscriptenInterface.evalJS('(func,time)=>setTimeout(func,time)'); | |
| this.setTimeout(this.timeout incontextof this,1000); | |
| }; | |
| function timeout(){ | |
| Debug.message("timeout is called"); | |
| Debug.message(this); // Now It Works! | |
| Debug.message("this value is:" + this); | |
| } |
以下のリンクの「準備 ~ emscriptenのインストール」まで行う
https://writening.net/page?xQuiSB#i5
リポジトリからクローンする
| // Deno Ultra Simple Static Server | |
| // | |
| // Copy of this example: | |
| // https://servestjs.org/use-serve-static | |
| /* how to compile | |
| wget https://gist.githubusercontent.com/xyx0no646/a51d981c225cfc127a6b2dc3a8893588/raw/859e4aff4009f87dfaaf19951fb620c4cdb94611/deno_simple_static_server.jsdeno compile --allow-net --allow-read deno_simple_static_server.js | |
| mkdir public | |
| echo helloworld > ./public/index.html |