@easywasm/gl 0.0.1 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -3
- package/package.json +6 -4
- package/web/gl.js +1060 -0
- package/web/glfw.js +931 -0
- package/src/example.c +0 -58
- package/src/glfw3.h +0 -6577
package/README.md
CHANGED
|
@@ -6,10 +6,9 @@ It should make existing projects that use those libs easier to compile for wasm,
|
|
|
6
6
|
|
|
7
7
|
Think of it as a platform-layer. You have WASI, which covers a lot of "OS things" like filesystem, time, etc, and you have this covers all the basic stuff you need to make a game (window, graphics, input, sound.)
|
|
8
8
|
|
|
9
|
-
|
|
10
9
|
## basic usage
|
|
11
10
|
|
|
12
|
-
You can assume GLFW (and
|
|
11
|
+
You can assume GLFW (and most of OpenGL) is exposed, and then you can use it normally. You can see an example in [index.html](./web/index.html). The code is in [example.c](./src/example.c), and can be compiled as native or wasm.
|
|
13
12
|
|
|
14
13
|
- `npm start` - compile example for web - requires wasi-sdk
|
|
15
|
-
- `npm run example:mac` - compiles same example for native mac. This is what I have for testing. Might add more build commands, later
|
|
14
|
+
- `npm run example:mac` - compiles same example for native mac. This is what I have for testing. Might add more build commands, later
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@easywasm/gl",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"description": "Web host interface exposing GLFW 3.5 to WebAssembly modules compiled with wasi-sdk",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "web/index.js",
|
|
@@ -8,7 +8,9 @@
|
|
|
8
8
|
".": "./web/index.js"
|
|
9
9
|
},
|
|
10
10
|
"files": [
|
|
11
|
-
"
|
|
11
|
+
"./web/index.js",
|
|
12
|
+
"./web/gl.js",
|
|
13
|
+
"./web/glfw.js"
|
|
12
14
|
],
|
|
13
15
|
"keywords": [
|
|
14
16
|
"webassembly",
|
|
@@ -29,7 +31,7 @@
|
|
|
29
31
|
"scripts": {
|
|
30
32
|
"start": "npx -y live-server web",
|
|
31
33
|
"prestart": "npm run example:web",
|
|
32
|
-
"example:web": " /opt/wasi-sdk/bin/clang -DGLFW_INCLUDE_NONE -Wl,--allow-undefined
|
|
33
|
-
"example:mac": "clang $(pkg-config --cflags --libs glfw3) -isysroot $(xcrun --show-sdk-path) -framework OpenGL -framework Cocoa -framework IOKit -framework CoreVideo src/example.c -o example"
|
|
34
|
+
"example:web": " /opt/wasi-sdk/bin/clang -O3 -ffast-math -Wl,--export=update -DGLFW_INCLUDE_NONE -Wl,--allow-undefined src/example.c -o web/example.wasm",
|
|
35
|
+
"example:mac": "clang -O3 -ffast-math $(pkg-config --cflags --libs glfw3) -isysroot $(xcrun --show-sdk-path) -framework OpenGL -framework Cocoa -framework IOKit -framework CoreVideo src/example.c -o example"
|
|
34
36
|
}
|
|
35
37
|
}
|