game.nv
· 753 B · Text
Eredeti
Playground
| 'DOCUMENTATION' | ~~
this game library lets you create a canvas that you can
update every frame . you can start a game like so :
// '' start a 400 by 600 game
and you can create a game loop that updates like this :
/ '' game loop $dt
/ '' do something
'' do something else
'' next frame
|| '@include' (
lib/gas.nv
lib/platforms/browser_dom.nv
lib/platforms/browser_game.nv
)
| '' start a $x by $y game
| '@graphics' . canvas init canvas . set resolution $x $y
'DOM' ( <query canvas <style display = block margin = [1rem auto] > > )
'' game loop
| '' next frame
| '' @gas is now 50000
'@js' window.requestAnimationFrame(nextFrame);
|| '@js' const nextFrame = (dt) => { f("", "game", "loop", "" + dt); me.run(); }
1 | | 'DOCUMENTATION' | ~~ |
2 | this game library lets you create a canvas that you can |
3 | update every frame . you can start a game like so : |
4 | |
5 | // '' start a 400 by 600 game |
6 | |
7 | and you can create a game loop that updates like this : |
8 | |
9 | / '' game loop $dt |
10 | / '' do something |
11 | '' do something else |
12 | '' next frame |
13 | |
14 | |
15 | || '@include' ( |
16 | lib/gas.nv |
17 | lib/platforms/browser_dom.nv |
18 | lib/platforms/browser_game.nv |
19 | ) |
20 | |
21 | | '' start a $x by $y game |
22 | | '@graphics' . canvas init canvas . set resolution $x $y |
23 | 'DOM' ( <query canvas <style display = block margin = [1rem auto] > > ) |
24 | '' game loop |
25 | |
26 | | '' next frame |
27 | | '' @gas is now 50000 |
28 | '@js' window.requestAnimationFrame(nextFrame); |
29 | |
30 | || '@js' const nextFrame = (dt) => { f("", "game", "loop", "" + dt); me.run(); } |