From b5a6e04f98221308d5129af8f43615bc8aac59e5 Mon Sep 17 00:00:00 2001 From: Camil Staps Date: Mon, 10 Aug 2015 15:01:58 +0200 Subject: Drawingframe test (chap 5) --- objectio/drawingframe.icl | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 objectio/drawingframe.icl 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" + -- cgit v1.2.3