48 lines
813 B
Markdown
48 lines
813 B
Markdown
Ayin
|
|
----
|
|
|
|
|
|
- Tiny, procedural, gamedev
|
|
- only user input is controller input
|
|
- Live code reload
|
|
- int, float, string, char, bool, key
|
|
- arrays and maps
|
|
- variables and functions
|
|
- if, loop, continue, break, return
|
|
- function call
|
|
- first class functions
|
|
|
|
```
|
|
let init = fn() {
|
|
return {
|
|
player: { position: { x: 10, y: 20 }, },
|
|
}
|
|
}
|
|
|
|
let update = fn(state, events) {
|
|
return state';
|
|
}
|
|
|
|
let draw = fn(frame, state) {
|
|
frame.clear(0,0,0);
|
|
}
|
|
|
|
let migrate = fn(state) {
|
|
return { player: { pos: state.player.position } },
|
|
}
|
|
```
|
|
|
|
- dynamic software updating could occur every frame
|
|
- user might be required to migrate the state (migrate function is hashed and only applied on updates when it is changed)
|
|
|
|
## Build instructions
|
|
|
|
### WASM
|
|
|
|
```
|
|
rustup target add wasm32-unknown-unknown
|
|
```
|
|
|
|
```
|
|
make wasm
|
|
```
|