about summary refs log tree commit diff stats
path: root/tutorial/task12-solution.mu
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2021-10-27 10:11:11 -0700
committerKartik K. Agaram <vc@akkartik.com>2021-10-27 10:11:11 -0700
commit81037d7bd82b246e6eddda7171001ea1ce8414b1 (patch)
tree46ff9b3b119d9b5118620622a243cbfa74bfdb8b /tutorial/task12-solution.mu
parentb1a04c59b649ca308810db87bb26004e543ddbaf (diff)
downloadmu-81037d7bd82b246e6eddda7171001ea1ce8414b1.tar.gz
task: first graphics
Diffstat (limited to 'tutorial/task12-solution.mu')
-rw-r--r--tutorial/task12-solution.mu8
1 files changed, 8 insertions, 0 deletions
diff --git a/tutorial/task12-solution.mu b/tutorial/task12-solution.mu
new file mode 100644
index 00000000..caf7a935
--- /dev/null
+++ b/tutorial/task12-solution.mu
@@ -0,0 +1,8 @@
+# Here's one way to draw a rectangle from the top-left corner of screen.
+# Lots of other solutions are possible.
+fn main screen: (addr screen) {
+  draw-line screen, 1/x1     1/y1,     0x300/x2 1/y2,     3/color=green
+  draw-line screen, 1/x1     0x200/y1, 0x300/x2 0x200/y2, 3/color=green
+  draw-line screen, 1/x1     1/y1,     1/x2     0x200/y2, 3/color=green
+  draw-line screen, 0x300/x1 1/y1,     0x300/x2 0x200/y2, 3/color=green
+}