thetarnav / odin-wasm

Odin + WASM = πŸ’™

Home Page:https://thetarnav.github.io/odin-wasm/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Odin WASM

For using Odin and WASM together.

demo gif

What is this?

1. A library of WASM bindings

A library of wasm bindings from Odin/vendor/wasm implemented using modern JavaScript with ES modules and JSDoc.

The implementation is mostly the same as the original, here are the differences:

  • ESM - it was written to be used in a modern JS environment, assuming that the user will use a bundler like Webpack or Rollup to bundle the code, and tree-shake the unused parts.
  • JSDoc - the original bindings are not documented, so I added JSDoc to the bindings to make it easier to use them.
  • Improvements to getting window position and size

2. Odin + WASM example

thetarnav.github.io/odin-wasm

In example/ you can find an example of how to use Odin and WASM together. Mainly focused on WebGL as I'm going through the WebGL Fundamentals tutorial.

3. A template repo

Feel free to use this repo as a template for your own projects.

There are some convenience scripts in main.js for building and running the example. And a github action for building and deploying the example to github pages.

Development

Dependencies

OLS

Add js_wasm32 target to ols.json if you want to use OLS:

{
    "checker_args": "-target:js_wasm32 -vet-unused -vet-shadowing -vet-style -vet-semicolon",
	"enable_format": false
}

Scripts

Take look at package.json for all the available scripts.

(You need to run npm i beforehand)

The most important ones are:

  • npm run dev - starts the server and watches for changes
  • npm run build - builds the example to dist/
  • npm run preview - starts a server to preview the built example

About

Odin + WASM = πŸ’™

https://thetarnav.github.io/odin-wasm/

License:MIT License


Languages

Language:Odin 52.8%Language:JavaScript 44.1%Language:GLSL 2.2%Language:HTML 0.6%Language:CSS 0.4%