50 lines
800 B
Markdown
50 lines
800 B
Markdown
Ayin
|
|
----
|
|
|
|
|
|
- Tiny, procedural, gamedev
|
|
- only user input is controller input
|
|
- Live code reload
|
|
- int, float, string, char, bool
|
|
- arrays and objects
|
|
- variables and functions
|
|
- if, loop, break, return
|
|
- function calls
|
|
- first class functions
|
|
|
|
```
|
|
let setup = fn() {
|
|
return {
|
|
.player: { .position: { .x: 10, .y: 20 }, },
|
|
}
|
|
}
|
|
|
|
let update = fn(state, events) {
|
|
let new = 100
|
|
state.player.position.x = new
|
|
state
|
|
}
|
|
|
|
let draw = fn(frame, state) {
|
|
frame_clear(0,0,0)
|
|
}
|
|
|
|
let migrate = fn(state) {
|
|
state
|
|
}
|
|
```
|
|
|
|
- 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
|
|
```
|