summaryrefslogtreecommitdiff
path: root/objectio/tut6_4_4.icl
diff options
context:
space:
mode:
Diffstat (limited to 'objectio/tut6_4_4.icl')
-rw-r--r--objectio/tut6_4_4.icl34
1 files changed, 34 insertions, 0 deletions
diff --git a/objectio/tut6_4_4.icl b/objectio/tut6_4_4.icl
new file mode 100644
index 0000000..1e7f4d8
--- /dev/null
+++ b/objectio/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
+