konsumer / web-zen-dev

Easily make games in WASI that use 2D graphics, sound, and input
http://konsumer.js.org/web-zen-dev/
2 stars 0 forks source link

This library allows you to easily make games in WASI that use 2D graphics, sound, and input. It's meant to be a light alternative to emscripten/SDL, but also allows languages otehr than C to target the web.

I wanted to be able to use my easywasi with zenfs to output graphics/sound and read input, over WASI fs.

It will run on web or anywhere else with js/canvas/audiocontext, like nodejs, via other libraries.

Also check out @zen-fs/devices. It's a typescript-focused soft-fork of the work here.

demos

devices

These are the devices I am implementing here:

and maybe this:

additionally, zenfs already provides these, if you use addDevices:true:

/dev/null
/dev/zero
/dev/full
/dev/random

usage

You can use it like this:

import { configure, fs } from '@zenfs/core'
import WebDevFS from 'web-zen-dev'

await configure({
  addDevices: true
})

const wd = new WebDevFS()
fs.mounts.get('/dev').createDevice('/fb0', framebuffer())
fs.mounts.get('/dev').createDevice('/dsp', await dsp())

You can see an example here.