最后活跃于 1730503328

sierra's Avatar sierra 修订了这个 Gist 1730503327. 转到此修订

1 file changed, 4 insertions, 4 deletions

rgb400.nv

@@ -33,9 +33,6 @@
33 33 |--| Move the `x/y` coordinates.
34 34 |x-,x||x-||y-,y||y-|
35 35
36 - |--| Clear the previous color values before computing a new color.
37 - |@pixel-r||@pixel-g||@pixel-b|
38 -
39 36 |--| Main loop.
40 37 ||x:399,y:399
41 38 |f,eol,x|f,eol,f
@@ -45,4 +42,7 @@
45 42 |f,~eos,x|f,~eos
46 43 |f,~eos|y-,x:399,f
47 44 |f|eol?,f
48 - ||f
45 +
46 + |x||y|
47 +
48 + ||f

sierra's Avatar sierra 修订了这个 Gist 1730501991. 转到此修订

1 file changed, 48 insertions

rgb400.nv(文件已创建)

@@ -0,0 +1,48 @@
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 + |--| Clear the previous color values before computing a new color.
37 + |@pixel-r||@pixel-g||@pixel-b|
38 +
39 + |--| Main loop.
40 + ||x:399,y:399
41 + |f,eol,x|f,eol,f
42 + |f,eol|f,eos?, @display
43 + |f,~eol|pp,x-,f
44 + |f,eos|pp,x:399,y:399
45 + |f,~eos,x|f,~eos
46 + |f,~eos|y-,x:399,f
47 + |f|eol?,f
48 + ||f
上一页 下一页