summaryrefslogtreecommitdiff
path: root/objectio/drawingframe.icl
diff options
context:
space:
mode:
authorCamil Staps2015-08-10 15:01:58 +0200
committerCamil Staps2015-08-10 15:01:58 +0200
commitb5a6e04f98221308d5129af8f43615bc8aac59e5 (patch)
tree7dfdc53334c81cad29c02875f90eb57a880f9d02 /objectio/drawingframe.icl
parentCalculator (diff)
Drawingframe test (chap 5)
Diffstat (limited to 'objectio/drawingframe.icl')
-rw-r--r--objectio/drawingframe.icl28
1 files changed, 28 insertions, 0 deletions
diff --git a/objectio/drawingframe.icl b/objectio/drawingframe.icl
new file mode 100644
index 0000000..1f6c8db
--- /dev/null
+++ b/objectio/drawingframe.icl
@@ -0,0 +1,28 @@
+module drawingframe
+
+// ********************************************************************************
+// Clean tutorial example program.
+//
+// This program defines a framework in which one can test drawing functions.
+// The program relies on a function, example, of type *Picture -> *Picture.
+// ********************************************************************************
+
+import StdEnv, StdIO
+
+Start :: *World -> *World
+Start world = startIO SDI Void (snd o openWindow Void testwindow) [ProcessClose closeProcess] world
+
+testwindow = Window "Test Drawing" NilLS [
+ WindowViewSize size,
+ WindowClose (noLS closeProcess),
+ WindowLook True (\_ _->example),
+ WindowViewDomain {corner1=origin,corner2=maxdomain}
+ ]
+where
+ size = {w=200,h=50}
+ origin = {x=(-20),y=(-20)}
+ maxdomain = {x=origin.x+size.w,y=origin.y+size.h}
+
+// Here, example draws the string "Pop" at zero
+example = drawAt zero "Pop"
+