aboutsummaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorMartin Lehoux <martin@lehoux.net>2020-04-04 13:28:28 -0700
committerMartin Lehoux <martin@lehoux.net>2020-04-04 13:28:28 -0700
commit3276ff864a4048a05ad3f0b34953ce937be1500c (patch)
tree71ed492b63a133166ae221b2df16e79f9f5fd610 /main.go
feat - Save frame to file
Diffstat (limited to 'main.go')
-rw-r--r--main.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/main.go b/main.go
new file mode 100644
index 0000000..f8245a4
--- /dev/null
+++ b/main.go
@@ -0,0 +1,18 @@
+package main
+
+const HEIGHT = 100
+const WIDTH = 200
+
+func main() {
+ frame := Frame{}
+ for x := 0; x < HEIGHT; x++ {
+ for y := 0; y < WIDTH; y++ {
+ frame[HEIGHT-1-x][y] = Pixel{
+ r: 255 * y / WIDTH,
+ g: 255 * x / HEIGHT,
+ b: 255 * 0.2,
+ }
+ }
+ }
+ frame.Save("img.ppm")
+}