-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | GLFW utility functions for use with monad-task. -- -- GLFW (http:hackage.haskell.orgpackageGLFW) is a Haskell -- binding to the GLFW C library for writing OpenGL programs. This -- package provides some utility functions for writing GLFW programs -- using the monad-task library -- (http:hackage.haskell.orgpackageGLFW-task). @package GLFW-task @version 0.1.0 -- | GLFW helper functions for use with a TaskT monad -- transformer (from monad-task package). module Graphics.UI.GLFW.Task -- | Event is a unified data type for all GLFW events. data Event KeyEvent :: Key -> KeyButtonState -> Event CharEvent :: Char -> KeyButtonState -> Event MouseButtonEvent :: MouseButton -> KeyButtonState -> Event MousePosEvent :: Position -> Event MouseWheelEvent :: Int -> Event WindowSizeEvent :: Size -> Event WindowCloseEvent :: Event WindowRefreshEvent :: Event -- | or returns the disjunction of a Boolean list. For the result to -- be False, the list must be finite; True, however, -- results from a True value at a finite index of a finite or -- infinite list. or :: [Bool] -> Bool onKey :: Event -> Maybe (Key, KeyButtonState) onChar :: Event -> Maybe (Char, KeyButtonState) onButton :: Event -> Maybe (MouseButton, KeyButtonState) onPos :: Event -> Maybe Position onWheel :: Event -> Maybe Int onSize :: Event -> Maybe Size onClose :: Event -> Maybe () onRefresh :: Event -> Maybe () isKey :: Enum a => a -> Key -> Maybe () isChar :: Char -> Char -> Maybe () isButton :: MouseButton -> (MouseButton, KeyButtonState) -> Maybe KeyButtonState isPress, isRelease :: (a, KeyButtonState) -> Maybe a -- | registerTaskCallbacks sets up all event callbacks, and -- returns a waitEvent equivalent function for task monad, which -- must be called repeatedly in order to pump events to other task -- co-routines. -- -- These task co-routines should use watch to select event of -- interest, and they should be forked prior to the waitEvent call. registerTaskCallbacks :: (MonadIO m, MonadTask Event m) => IO (m ()) instance Eq Event instance Show Event