wryl revised this gist 1 year ago. Go to revision
2 files changed, 74 insertions
common-main-loop.nv(file created)
| @@ -0,0 +1,16 @@ | |||
| 1 | + | |#|start exhaustive | |
| 2 | + | |#|constant, @resolution-x, 800 | |
| 3 | + | |#|constant, @resolution-y, 600 | |
| 4 | + | ||start | |
| 5 | + | |start| | |
| 6 | + | @resolution-x:800, | |
| 7 | + | @resolution-y:600, | |
| 8 | + | set the window resolution, | |
| 9 | + | main loop | |
| 10 | + | |set the window resolution| @set-resolution | |
| 11 | + | |main loop, @quit| | |
| 12 | + | |main loop| | |
| 13 | + | poll for input, | |
| 14 | + | main | |
| 15 | + | |poll for input| @poll-input | |
| 16 | + | |clear the screen| @clear-screen | |
triangle.nv(file created)
| @@ -0,0 +1,58 @@ | |||
| 1 | + | |#|constant, @line-x-1, 50 | |
| 2 | + | |#|constant, @line-y-1, 50 | |
| 3 | + | |#|constant, @line-x-2, 400 | |
| 4 | + | |#|constant, @line-y-2, 200 | |
| 5 | + | ||
| 6 | + | |#|constant, @line-x-1, 400 | |
| 7 | + | |#|constant, @line-y-1, 200 | |
| 8 | + | |#|constant, @line-x-2, 500 | |
| 9 | + | |#|constant, @line-y-2, 500 | |
| 10 | + | ||
| 11 | + | |#|constant, @line-x-1, 500 | |
| 12 | + | |#|constant, @line-y-1, 500 | |
| 13 | + | |#|constant, @line-x-2, 50 | |
| 14 | + | |#|constant, @line-y-2, 50 | |
| 15 | + | ||
| 16 | + | |#|constant, @line-r, 255 | |
| 17 | + | |#|constant, @line-g, 255 | |
| 18 | + | |#|constant, @line-b, 255 | |
| 19 | + | ||
| 20 | + | |main| | |
| 21 | + | clear the screen, | |
| 22 | + | draw side A, | |
| 23 | + | draw side B, | |
| 24 | + | draw side C, | |
| 25 | + | display, | |
| 26 | + | yield | |
| 27 | + | ||
| 28 | + | |draw a side|, | |
| 29 | + | @line-r:255, | |
| 30 | + | @line-g:255, | |
| 31 | + | @line-b:255, | |
| 32 | + | draw a line | |
| 33 | + | ||
| 34 | + | |draw a line| @draw-line | |
| 35 | + | ||
| 36 | + | |draw side A| | |
| 37 | + | @line-x-1:50, | |
| 38 | + | @line-y-1:50, | |
| 39 | + | @line-x-2:400, | |
| 40 | + | @line-y-2:200, | |
| 41 | + | draw a side | |
| 42 | + | ||
| 43 | + | |draw side B| | |
| 44 | + | @line-x-1:400, | |
| 45 | + | @line-y-1:200, | |
| 46 | + | @line-x-2:500, | |
| 47 | + | @line-y-2:500, | |
| 48 | + | draw a side | |
| 49 | + | ||
| 50 | + | |draw side C| | |
| 51 | + | @line-x-1:500, | |
| 52 | + | @line-y-1:500, | |
| 53 | + | @line-x-2:50, | |
| 54 | + | @line-y-2:50, | |
| 55 | + | draw a side | |
| 56 | + | ||
| 57 | + | |display| @display | |
| 58 | + | |yield| main loop | |
Newer
Older