Skip to content

konsumer/web-zen-dev

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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:

  • /dev/dsp - sound (similar to OSS)
  • /dev/fb0 - 2D graphics (framebuffer)
  • /dev/input/* - input devices (keyboard, mouse, gamepad)

and maybe this:

  • /proc/bus/input/devices - get list of input devices

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.

About

Easily make games in WASI that use 2D graphics, sound, and input

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published