Остання активність 1751731980

a library for the Myte playground that lets you easily create games

Версія 2dab98e9bd8c815f97adba3d1989e77718f217e6

game.nv Неформатований Playground
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(); }