window.wasmMemory.buffer not memory.buffermacOS Catalina, "gyp: No Xcode or CLT version" message? $ [sudo] xcode-select — reset via https://medium.com/p/f76739eef9ad/responses/show
make (for the purposes of prepending lint ignore comment directive): https://stackoverflow.com/questions/10587615/unix-command-to-prepend-text-to-a-file or https://stackoverflow.com/questions/40477948/prepend-a-text-to-a-file-in-makefileAfter running it states:
Next steps:
- To conveniently access emsdk tools from the command line,
consider adding the following directories to your PATH:
/Users/nathan/Downloads/emscripten/emsdk
/Users/nathan/Downloads/emscripten/emsdk/node/14.18.2_64bit/bin
/Users/nathan/Downloads/emscripten/emsdk/upstream/emscripten
- This can be done for the current shell by running:
source "/Users/nathan/Downloads/emscripten/emsdk/emsdk_env.sh"
- Configure emsdk in your shell startup scripts by running:
echo 'source "/Users/nathan/Downloads/emscripten/emsdk/emsdk_env.sh"' >> $HOME/.zprofile
You are hesitant because you think it slowed down the launching of your shell before.
Seems to be two ways: one is a macro from C:
EM_ASM( ShipPosition($0, $1), ship_x, ship_y );
This probably executes in a global context, so the JavaScript function would have to be attached to the window.
The other method is more work but "cleaner" using
a callback.
Given a JS Function CallJS, declare it as extern in C:
extern void CallJS(int iVal);
You define the instantianWasm thusly:
Module.instantiateWasm = function(imports, successCallback) {
// javascript you want to be able to call from C
// for each, in c, you need
// extern void <function name>(…);
window.asmLibraryArg.CallJS = () => {
console.log('hello from CallJs')
}
const info = {
env: window.asmLibraryArg,
wasi_snapshot_preview1: window.asmLibraryArg
}
let thisInstance = null
function receiveInstance(instance, module) {
thisInstance = instance
// exports = instance.exports
// Module.asm = exports
// removeRunDependency('wasm-instantiate')
}
// addRunDependency('wasm-instantiate')
function receiveInstantiatedSource(output) {
receiveInstance(output.instance)
}
function instantiateArrayBuffer(receiver) {
return window
.getBinaryPromise()
.then(function(binary) {
return WebAssembly.instantiate(binary, info)
})
.then(receiver, function(reason) {
window.err('failed to asynchronously prepare wasm: ' + reason)
window.abort(reason)
})
}
function instantiateAsync() {
if (
!window.wasmBinary &&
typeof WebAssembly.instantiateStreaming === 'function' &&
!window.isDataURI(window.wasmBinaryFile) &&
!window.isFileURI(window.wasmBinaryFile) &&
typeof window.fetch === 'function'
) {
window
.fetch(window.wasmBinaryFile, { credentials: 'same-origin' })
.then(function(response) {
const result = WebAssembly.instantiateStreaming(response, info)
return result.then(receiveInstantiatedSource, function(reason) {
window.err('wasm streaming compile failed: ' + reason)
window.err('falling back to ArrayBuffer instantiation')
instantiateArrayBuffer(receiveInstantiatedSource)
})
})
} else {
return instantiateArrayBuffer(receiveInstantiatedSource)
}
}
instantiateAsync().then(() => {
successCallback(thisInstance)
})
// return exports
return {}
}
Unknown: passing argument to the JS function, receiving results, available to Web Worker?
We want the user to be able to add their own media (sounds and images). Ultimately, we will need to be able to store them in a shared place like s3, but for now we will focus on the local experience. For the local experience, we will use not localStorage (with, evidently, a max of 5mb and only capable of storing strings) but indexedDB. IndexedDB is more complex.
Some information on storage limits, mostly relating to Firefox - 50% of available space.
Chrome storage limits, as linked to above Minimum of 1% of available or 1GB. Worth noting that on mobile devices these are pretty small (8gb capacity = as little as 80MB available).
Both of these browsers will aggressively delete databases if quotas are exceeded, which can happen outside of the browser (suddenly there's less disk space, so the database gets killed).
Someone's old code for syncing dexie to dropbox: https://gist.github.com/cfilipov/48338f23ce92047807585f750af04bc0
Via: https://github.com/dfahlander/Dexie.js/issues/545
As suggested by https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API
Note: what about migrating these databases on code changes? Do any of these libraries support that?
Pretty sure dexie is best choice.
Font for brand: M PLUS Rounded 1c
Couldn't get c to work with C++ until: https://developers.google.com/web/updates/2018/08/embind at the bottom, using the --bind option/syntax at the bottom of that page.
https://marcoselvatici.github.io/WASM_tutorial/ - not sure how old, but stuff about heap v stack, ptrs, reading files
https://codepen.io/Lewitje/pen/MVommB
https://groups.google.com/g/emscripten-discuss/c/NONijDAFuTE?pli=1https://stackoverflow.com/questions/60920177/emscripten-sdl2-origin-of-canvas-appears-to-move-when-canvas-is-resized
https://github.com/i8degrees/nomlib/blob/dev/src/graphics/fonts/TrueTypeFont.cpp
http://lazyfoo.net/SDL_tutorials/lesson30/index.php
https://www.apple.com/education/k12/learning-from-home/
https://stackoverflow.com/questions/59465413/convert-blob-url-to-file-object-with-axios
Shared Memory? https://lucasfcosta.com/2017/04/30/JavaScript-From-Workers-to-Shared-Memory.html
https://groups.google.com/g/emscripten-discuss/c/CMfYljLWMvY
Get an Image and convert to blob with axios?
tiny games you can play on phone
The Oldschool PC Font Pack v2.0
Luau https://roblox.github.io/luau/
https://news.ycombinator.com/item?id=24059432
JHelmsAt 6 hours ago –
In case anyone is interested: Roblox (who is making Luau) is hiring. We've been growing fast, and are looking for strong C++, systems, and application engineers. As a highly vertically integrate gaming platform, we've got a lot of hard problems to solve - from programming language design (see OP!) to debugger tooling.
You can email me at my username plus roblox.com.
https://www.planimeter.org/grid-sdk/https://github.com/Planimeter/grid-sdk/blob/master/class.luahttps://github.com/Planimeter/grid-sdk
Song Maker: https://musiclab.chromeexperiments.com/Song-Maker/song/5787245861666816
Game maker on top of pixi.js? https://ctjs.rocks
Js mod Player https://keithclark.github.io/ZzFXM/