最后活跃于 1730503328

rgb400.nv 原始文件 Playground
1|--| Are we at the end of a line?
2|eol?,x|x,~eol|eol?|eol
3
4|--| Are we at the end of the screen?
5|eos?,y|y,~eos|eos?|eos
6
7|--| Copy the pixel coordinates from `x/y` to `@pixel-x/@pixel-y`.
8|px=x,x|*x,@pixel-x,px=x
9|px=x|
10|py=y,y|*y,@pixel-y,py=y
11|py=y|
12
13|--| Compute some pixel colors based on the `x/y` coordinates.
14|--| r = x, g = y, b = x + y
15|pr=x,x|*x,@pixel-r,pr=x|pr=x|
16|pg=y,y|*y,@pixel-g,pg=y|pg=y|
17|pb=x+y,x|*x,@pixel-b,pb=x+y
18|pb=x+y,y|*y,@pixel-b,pb=x+y
19|pb=x+y|
20
21|--| Copy temporaries back to their respective variables.
22|*x|x|*y|y
23
24|--| Plot a pixel.
25|pp|px,py,pr,pg,pb,ps
26|px|px=x:399
27|py|py=y:399
28|pr|pr=x:399
29|pg|pg=y:399
30|pb|pb=x+y:399
31|ps|@set-pixel
32
33|--| Move the `x/y` coordinates.
34|x-,x||x-||y-,y||y-|
35
36|--| Main loop.
37||x:399,y:399
38|f,eol,x|f,eol,f
39|f,eol|f,eos?, @display
40|f,~eol|pp,x-,f
41|f,eos|pp,x:399,y:399
42|f,~eos,x|f,~eos
43|f,~eos|y-,x:399,f
44|f|eol?,f
45
46|x||y|
47
48||f
49