aboutsummaryrefslogtreecommitdiff
path: root/tut6_4_4.icl
diff options
context:
space:
mode:
authorCamil Staps2015-08-08 19:58:36 +0200
committerCamil Staps2015-08-08 19:58:36 +0200
commitd075b4831a10db83840c5e2fd11fb2b59722adfc (patch)
tree20f7d14c8318b7e09e982e8f2ca8b8722afb8348 /tut6_4_4.icl
ObjectIO tests
Diffstat (limited to 'tut6_4_4.icl')
-rw-r--r--tut6_4_4.icl34
1 files changed, 34 insertions, 0 deletions
diff --git a/tut6_4_4.icl b/tut6_4_4.icl
new file mode 100644
index 0000000..1e7f4d8
--- /dev/null
+++ b/tut6_4_4.icl
@@ -0,0 +1,34 @@
+module tut6_4_4
+
+// ********************************************************************************
+// Clean tutorial example program.
+//
+// This program creates a window that displays a user selected bitmap.
+// Make sure that this application has sufficient heap or extra memory.
+// ********************************************************************************
+
+import StdIO, StdEnv
+
+Start :: *World -> *World
+Start world
+ # (maybeFile,world) = selectInputFile world
+ | isNothing maybeFile
+ = world
+ # bitmapfile = fromJust maybeFile
+ # (maybeBitmap,world) = openBitmap bitmapfile world
+ | isNothing maybeBitmap
+ = world
+ | otherwise
+ # bitmap = fromJust maybeBitmap
+ bitmapsize = getBitmapSize bitmap
+ window = Window "Bitmap" NilLS
+ [ WindowViewSize bitmapsize
+ , WindowLook True (\_ _->drawAt zero bitmap)
+ , WindowClose (noLS closeProcess)
+ ]
+ = startIO SDI
+ Void
+ (snd o openWindow Void window)
+ [ProcessClose closeProcess]
+ world
+