-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
starting work on assemblyscript example
- Loading branch information
Showing
10 changed files
with
138 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.DS_Store | ||
node_modules | ||
build | ||
*.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
This is an example null0 cart written in [assemblyscript](https://www.assemblyscript.org/). | ||
|
||
## TODO | ||
|
||
- look into [better build](https://github.com/notnullgames/null0-ideas/blob/main/projects/assemblyscript/tools/build.mjs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"targets": { | ||
"release": { | ||
"outFile": "build/main.wasm", | ||
"textFile": "build/main.wat", | ||
"sourceMap": true, | ||
"optimizeLevel": 3, | ||
"shrinkLevel": 0, | ||
"converge": false, | ||
"noAssert": false | ||
} | ||
}, | ||
"options": { | ||
"bindings": "esm" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// log a string | ||
@external("null0", "trace") | ||
declare function _null0_real_trace(text: ArrayBuffer): void | ||
|
||
// these are called by language | ||
// https://www.assemblyscript.org/concepts.html#special-imports | ||
// TODO: would WASI help with these? | ||
|
||
export function _null0_trace(message: String): void { | ||
_null0_real_trace(String.UTF8.encode(message, true)); | ||
} | ||
|
||
export function _null0_abort(message: String, fileName: String, line: u32, column: u32): void { | ||
_null0_real_trace(String.UTF8.encode("ABORT: " + message, true)); | ||
} | ||
|
||
export function _null0_seed(): f64 { | ||
return 1.0; | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"name": "@null0/example-as", | ||
"version": "0.0.0", | ||
"scripts": { | ||
"build": "asc src/index.ts --target release --use trace=_null0_trace --use abort=_null0_abort --use seed=_null0_seed --lib ./null0.ts && mkdir -p build/cart/assets && cp build/main.wasm build/cart && cp src/assets/* build/cart/assets && cd build/cart && zip -r ../example.null0 .", | ||
"start": "../../build/host/null0 ./build/example.null0", | ||
"prestart": "npm run build" | ||
}, | ||
"license": "MIT", | ||
"devDependencies": { | ||
"assemblyscript": "^0.27.29" | ||
}, | ||
"type": "module", | ||
"exports": { | ||
".": { | ||
"import": "./build/release.js", | ||
"types": "./build/release.d.ts" | ||
} | ||
} | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// called when the cart is loaded | ||
export function load(): void { | ||
trace("hello"); | ||
} | ||
|
||
// called on every frame | ||
export function update(): void { | ||
trace("update"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"extends": "assemblyscript/std/assembly.json", | ||
"include": [ | ||
"./**/*.ts" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters