<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Graphics.UI.GLUT.Begin</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[ window.onload = function () {pageLoad();setSynopsis("mini_Graphics-UI-GLUT-Begin.html");}; //]]> </script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="src/Graphics-UI-GLUT-Begin.html">Source</a></li><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">GLUT-2.1.2.1: A binding for the OpenGL Utility Toolkit</p></div><div id="content"><div id="module-header"><table class="info"><tr><th>Portability</th><td>portable</td></tr><tr><th>Stability</th><td>stable</td></tr><tr><th>Maintainer</th><td>sven.panne@aedion.de</td></tr></table><p class="caption">Graphics.UI.GLUT.Begin</p></div><div id="table-of-contents"><p class="caption">Contents</p><ul><li><a href="#g:1">Handling events </a></li><li><a href="#g:2">Controlling the behaviour when windows are closed </a></li></ul></div><div id="description"><p class="caption">Description</p><div class="doc"><p>After a GLUT program has done initial setup such as creating windows and menus, GLUT programs enter the GLUT event processing loop by calling <code><a href="Graphics-UI-GLUT-Begin.html#v:mainLoop">mainLoop</a></code> or handle events iteratively with <code><a href="Graphics-UI-GLUT-Begin.html#v:mainLoopEvent">mainLoopEvent</a></code>. </p></div></div><div id="synopsis"><p id="control.syn" class="caption expander" onclick="toggleSection('syn')">Synopsis</p><ul id="section.syn" class="hide" onclick="toggleSection('syn')"><li class="src short"><a href="#v:mainLoop">mainLoop</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Unit.html#t:-40--41-">()</a></li><li class="src short"><a href="#v:mainLoopEvent">mainLoopEvent</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Unit.html#t:-40--41-">()</a></li><li class="src short"><a href="#v:leaveMainLoop">leaveMainLoop</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Unit.html#t:-40--41-">()</a></li><li class="src short"><span class="keyword">data</span> <a href="#t:ActionOnWindowClose">ActionOnWindowClose</a> <ul class="subs"><li>= <a href="#v:Exit">Exit</a> </li><li>| <a href="#v:MainLoopReturns">MainLoopReturns</a> </li><li>| <a href="#v:ContinueExectuion">ContinueExectuion</a> </li></ul></li><li class="src short"><a href="#v:actionOnWindowClose">actionOnWindowClose</a> :: <a href="/usr/share/doc/ghc/html/libraries/OpenGL-2.2.3.0/Graphics-Rendering-OpenGL-GL-StateVar.html#t:StateVar">StateVar</a> <a href="Graphics-UI-GLUT-Begin.html#t:ActionOnWindowClose">ActionOnWindowClose</a></li></ul></div><div id="interface"><h1 id="g:1">Handling events </h1><div class="top"><p class="src"><a name="v:mainLoop" class="def">mainLoop</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Unit.html#t:-40--41-">()</a><a href="src/Graphics-UI-GLUT-Begin.html#mainLoop" class="link">Source</a></p><div class="doc"><p>Enter the GLUT event processing loop; it will call as necessary any callbacks that have been registered. This routine should be called at most once in a GLUT program. </p></div></div><div class="top"><p class="src"><a name="v:mainLoopEvent" class="def">mainLoopEvent</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Unit.html#t:-40--41-">()</a><a href="src/Graphics-UI-GLUT-Begin.html#mainLoopEvent" class="link">Source</a></p><div class="doc"><p>(<em>freeglut only</em>) Process one iteration's worth of events in its event loop. This allows the application to control its own event loop and still use the GLUT package. </p></div></div><div class="top"><p class="src"><a name="v:leaveMainLoop" class="def">leaveMainLoop</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Unit.html#t:-40--41-">()</a><a href="src/Graphics-UI-GLUT-Begin.html#leaveMainLoop" class="link">Source</a></p><div class="doc"><p>(<em>freeglut only</em>) Stop the event loop. If <code><a href="Graphics-UI-GLUT-Begin.html#v:actionOnWindowClose">actionOnWindowClose</a></code> contains <code><a href="Graphics-UI-GLUT-Begin.html#v:Exit">Exit</a></code>, the application will exit; otherwise control will return to the function which called <code><a href="Graphics-UI-GLUT-Begin.html#v:mainLoop">mainLoop</a></code>. </p><p>If the application has two nested calls to <code><a href="Graphics-UI-GLUT-Begin.html#v:mainLoop">mainLoop</a></code> and calls <code><a href="Graphics-UI-GLUT-Begin.html#v:leaveMainLoop">leaveMainLoop</a></code>, the behaviour is undefined. It may leave only the inner nested loop or it may leave both loops. If the reader has a strong preference for one behaviour over the other he should contact the freeglut Programming Consortium and ask for the code to be fixed. </p></div></div><h1 id="g:2">Controlling the behaviour when windows are closed </h1><div class="top"><p class="src"><span class="keyword">data</span> <a name="t:ActionOnWindowClose" class="def">ActionOnWindowClose</a> <a href="src/Graphics-UI-GLUT-Begin.html#ActionOnWindowClose" class="link">Source</a></p><div class="doc"><p>The behaviour when the user closes a window. </p></div><div class="subs constructors"><p class="caption">Constructors</p><table><tr><td class="src"><a name="v:Exit" class="def">Exit</a></td><td class="doc"><p>Exit the whole program when any window is closed or <code><a href="Graphics-UI-GLUT-Begin.html#v:leaveMainLoop">leaveMainLoop</a></code> is called (default). </p></td></tr><tr><td class="src"><a name="v:MainLoopReturns" class="def">MainLoopReturns</a></td><td class="doc"><p>Return from mainLoop when any window is closed. </p></td></tr><tr><td class="src"><a name="v:ContinueExectuion" class="def">ContinueExectuion</a></td><td class="doc"><p>Return from mainLoop after the last window is closed. </p></td></tr></table></div><div class="subs instances"><p id="control.i:ActionOnWindowClose" class="caption collapser" onclick="toggleSection('i:ActionOnWindowClose')">Instances</p><div id="section.i:ActionOnWindowClose" class="show"><table><tr><td class="src"><a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Eq.html#t:Eq">Eq</a> <a href="Graphics-UI-GLUT-Begin.html#t:ActionOnWindowClose">ActionOnWindowClose</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Ord.html#t:Ord">Ord</a> <a href="Graphics-UI-GLUT-Begin.html#t:ActionOnWindowClose">ActionOnWindowClose</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Text-Show.html#t:Show">Show</a> <a href="Graphics-UI-GLUT-Begin.html#t:ActionOnWindowClose">ActionOnWindowClose</a></td><td class="doc empty"> </td></tr></table></div></div></div><div class="top"><p class="src"><a name="v:actionOnWindowClose" class="def">actionOnWindowClose</a> :: <a href="/usr/share/doc/ghc/html/libraries/OpenGL-2.2.3.0/Graphics-Rendering-OpenGL-GL-StateVar.html#t:StateVar">StateVar</a> <a href="Graphics-UI-GLUT-Begin.html#t:ActionOnWindowClose">ActionOnWindowClose</a><a href="src/Graphics-UI-GLUT-Begin.html#actionOnWindowClose" class="link">Source</a></p><div class="doc"><p>(<em>freeglut only</em>) Controls the behaviour when the user closes a window. </p></div></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.9.2</p></div></body></html>