-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | GLFW OpenGL context creation for GPipe
--   
--   GPipe-GLFW is a utility library to enable the use of GLFW as the
--   OpenGL window and context handler for GPipe. GPipe is a typesafe
--   functional API based on the conceptual model of OpenGL.
@package GPipe-GLFW
@version 1.4.1.1


-- | Miscellaneous wrapped calls to GLFW-b for application programmer use.
--   
--   Actions are in the GPipe <a>ContextT</a> monad when a window handle is
--   required, otherwise they are bare reexported IO actions which can be
--   lifted into the <a>ContextT</a> monad. The <tt>Window</tt> taken by
--   many of these functions is the window resource from GPipe.
module Graphics.GPipe.Context.GLFW.Misc
data Error :: *
Error'NotInitialized :: Error
Error'NoCurrentContext :: Error
Error'InvalidEnum :: Error
Error'InvalidValue :: Error
Error'OutOfMemory :: Error
Error'ApiUnavailable :: Error
Error'VersionUnavailable :: Error
Error'PlatformError :: Error
Error'FormatUnavailable :: Error


-- | Window manipulation functions covering much of the GLFW <b>Window
--   guide</b>: <a>http://www.glfw.org/docs/latest/window_guide.html</a>.
--   Notably absent are the window creation functions. These are handled
--   automatically by GPipe-GLFW.
--   
--   Actions are in the GPipe <a>ContextT</a> monad when a window handle is
--   required, otherwise they are bare reexported IO actions which can be
--   lifted into the <a>ContextT</a> monad. The <tt>Window</tt> taken by
--   many of these functions is the window resource from GPipe.
module Graphics.GPipe.Context.GLFW.Window
windowShouldClose :: MonadIO m => Window os c ds -> ContextT Handle os m (Maybe Bool)
setWindowShouldClose :: MonadIO m => Window os c ds -> Bool -> ContextT Handle os m (Maybe ())
setWindowCloseCallback :: MonadIO m => Window os c ds -> Maybe (IO ()) -> ContextT Handle os m (Maybe ())
getWindowSize :: MonadIO m => Window os c ds -> ContextT Handle os m (Maybe (Int, Int))

-- | Return the current size of the context frame buffer. This is needed to
--   set viewport size and to get the aspect ratio to calculate projection
--   matrices.
getFrameBufferSize :: (ContextHandler ctx, MonadIO m) => Window os c ds -> ContextT ctx os m V2 Int


-- | User input functions covering much of the GLFW <b>Input guide</b>:
--   <a>http://www.glfw.org/docs/latest/input_guide.html</a>.
--   
--   Actions are in the GPipe <a>ContextT</a> monad when a window handle is
--   required, otherwise they are bare reexported IO actions which can be
--   lifted into the <a>ContextT</a> monad. The <tt>Window</tt> taken by
--   many of these functions is the window resource from GPipe.
module Graphics.GPipe.Context.GLFW.Input
postEmptyEvent :: IO ()

-- | Register or unregister a callback to receive <a>KeyState</a> changes
--   to any <a>Key</a>.
setKeyCallback :: MonadIO m => Window os c ds -> Maybe (Key -> Int -> KeyState -> ModifierKeys -> IO ()) -> ContextT Handle os m (Maybe ())

-- | Poll for the <a>KeyState</a> of a <a>Key</a>.
getKey :: MonadIO m => Window os c ds -> Key -> ContextT Handle os m (Maybe KeyState)

-- | Polling a <a>Key</a> for <a>KeyState</a> may sometimes miss state
--   transitions. If you use cannot use a callback to receive
--   <a>KeyState</a> changes, use <a>getKey</a> in combination with GLFW's
--   sticky-keys feature:
--   <a>http://www.glfw.org/docs/latest/input_guide.html#input_key</a>.
setStickyKeysInputMode :: MonadIO m => Window os c ds -> StickyKeysInputMode -> ContextT Handle os m (Maybe ())
getStickyKeysInputMode :: MonadIO m => Window os c ds -> ContextT Handle os m (Maybe StickyKeysInputMode)

-- | Register or unregister a callback to receive character input obeying
--   keyboard layouts and modifier effects.
setCharCallback :: MonadIO m => Window os c ds -> Maybe (Char -> IO ()) -> ContextT Handle os m (Maybe ())

-- | Register or unregister a callback to receive mouse location changes.
--   Callback receives <tt>x</tt> and <tt>y</tt> position measured in
--   screen-coordinates relative to the top left of the GLFW window.
setCursorPosCallback :: MonadIO m => Window os c ds -> Maybe (Double -> Double -> IO ()) -> ContextT Handle os m (Maybe ())

-- | Poll for the location of the mouse.
getCursorPos :: MonadIO m => Window os c ds -> ContextT Handle os m (Maybe (Double, Double))

-- | GLFW supports setting cursor mode to support mouselook and other
--   advanced uses of the mouse:
--   <a>http://www.glfw.org/docs/latest/input_guide.html#cursor_mode</a>.
setCursorInputMode :: MonadIO m => Window os c ds -> CursorInputMode -> ContextT Handle os m (Maybe ())
getCursorInputMode :: MonadIO m => Window os c ds -> ContextT Handle os m (Maybe CursorInputMode)

-- | Creates a new cursor.
createCursor :: Image -> Int -> Int -> IO Cursor

-- | Creates a cursor with a standard shape that can be set for a window
--   with setCursor.
createStandardCursor :: StandardCursorShape -> IO Cursor

-- | Destroys a cursor previously created with <a>createCursor</a>. Any
--   remaining cursors will be destroyed by <a>terminate</a>.
destroyCursor :: Cursor -> IO ()

-- | Set the cursor to be displayed over the window while
--   <a>CursorInputMode</a> is <tt>Normal</tt>.
setCursor :: MonadIO m => Window os c ds -> Cursor -> ContextT Handle os m (Maybe ())

-- | Register or unregister a callback to receive <a>CursorState</a>
--   changes when the cursor enters or exits the window.
setCursorEnterCallback :: MonadIO m => Window os c ds -> Maybe (CursorState -> IO ()) -> ContextT Handle os m (Maybe ())

-- | Register or unregister a callback to receive <a>MouseButtonState</a>
--   changes to a <a>MouseButton</a>.
setMouseButtonCallback :: MonadIO m => Window os c ds -> Maybe (MouseButton -> MouseButtonState -> ModifierKeys -> IO ()) -> ContextT Handle os m (Maybe ())

-- | Poll for the <a>MouseButtonState</a> of a <a>MouseButton</a>.
getMouseButton :: MonadIO m => Window os c ds -> MouseButton -> ContextT Handle os m (Maybe MouseButtonState)

-- | Polling a <a>MouseButton</a> for <a>MouseButtonState</a> may sometimes
--   miss state transitions. If you use cannot use a callback to receive
--   <a>MouseButtonState</a> changes, use <a>getMouseButton</a> in
--   combination with GLFW's sticky-mouse-buttons feature:
--   <a>http://www.glfw.org/docs/latest/input_guide.html#input_mouse_button</a>.
setStickyMouseButtonsInputMode :: MonadIO m => Window os c ds -> StickyMouseButtonsInputMode -> ContextT Handle os m (Maybe ())
getStickyMouseButtonsInputMode :: MonadIO m => Window os c ds -> ContextT Handle os m (Maybe StickyMouseButtonsInputMode)

-- | Register or unregister a callback to receive scroll offset changes.
setScrollCallback :: MonadIO m => Window os c ds -> Maybe (Double -> Double -> IO ()) -> ContextT Handle os m (Maybe ())
joystickPresent :: Joystick -> IO Bool
getJoystickAxes :: Joystick -> IO Maybe [Double]
getJoystickButtons :: Joystick -> IO Maybe [JoystickButtonState]
getJoystickName :: Joystick -> IO Maybe String
getTime :: IO Maybe Double
setTime :: Double -> IO ()

-- | Poll the system clipboard for a UTF-8 encoded string, if one can be
--   extracted.
getClipboardString :: MonadIO m => Window os c ds -> ContextT Handle os m (Maybe (Maybe String))

-- | Store a UTF-8 encoded string in the system clipboard.
setClipboardString :: MonadIO m => Window os c ds -> String -> ContextT Handle os m (Maybe ())

-- | Register or unregister a callback to receive file paths when files are
--   dropped onto the window.
setDropCallback :: MonadIO m => Window os c ds -> Maybe ([String] -> IO ()) -> ContextT Handle os m (Maybe ())
data Key :: *
Key'Unknown :: Key
Key'Space :: Key
Key'Apostrophe :: Key
Key'Comma :: Key
Key'Minus :: Key
Key'Period :: Key
Key'Slash :: Key
Key'0 :: Key
Key'1 :: Key
Key'2 :: Key
Key'3 :: Key
Key'4 :: Key
Key'5 :: Key
Key'6 :: Key
Key'7 :: Key
Key'8 :: Key
Key'9 :: Key
Key'Semicolon :: Key
Key'Equal :: Key
Key'A :: Key
Key'B :: Key
Key'C :: Key
Key'D :: Key
Key'E :: Key
Key'F :: Key
Key'G :: Key
Key'H :: Key
Key'I :: Key
Key'J :: Key
Key'K :: Key
Key'L :: Key
Key'M :: Key
Key'N :: Key
Key'O :: Key
Key'P :: Key
Key'Q :: Key
Key'R :: Key
Key'S :: Key
Key'T :: Key
Key'U :: Key
Key'V :: Key
Key'W :: Key
Key'X :: Key
Key'Y :: Key
Key'Z :: Key
Key'LeftBracket :: Key
Key'Backslash :: Key
Key'RightBracket :: Key
Key'GraveAccent :: Key
Key'World1 :: Key
Key'World2 :: Key
Key'Escape :: Key
Key'Enter :: Key
Key'Tab :: Key
Key'Backspace :: Key
Key'Insert :: Key
Key'Delete :: Key
Key'Right :: Key
Key'Left :: Key
Key'Down :: Key
Key'Up :: Key
Key'PageUp :: Key
Key'PageDown :: Key
Key'Home :: Key
Key'End :: Key
Key'CapsLock :: Key
Key'ScrollLock :: Key
Key'NumLock :: Key
Key'PrintScreen :: Key
Key'Pause :: Key
Key'F1 :: Key
Key'F2 :: Key
Key'F3 :: Key
Key'F4 :: Key
Key'F5 :: Key
Key'F6 :: Key
Key'F7 :: Key
Key'F8 :: Key
Key'F9 :: Key
Key'F10 :: Key
Key'F11 :: Key
Key'F12 :: Key
Key'F13 :: Key
Key'F14 :: Key
Key'F15 :: Key
Key'F16 :: Key
Key'F17 :: Key
Key'F18 :: Key
Key'F19 :: Key
Key'F20 :: Key
Key'F21 :: Key
Key'F22 :: Key
Key'F23 :: Key
Key'F24 :: Key
Key'F25 :: Key
Key'Pad0 :: Key
Key'Pad1 :: Key
Key'Pad2 :: Key
Key'Pad3 :: Key
Key'Pad4 :: Key
Key'Pad5 :: Key
Key'Pad6 :: Key
Key'Pad7 :: Key
Key'Pad8 :: Key
Key'Pad9 :: Key
Key'PadDecimal :: Key
Key'PadDivide :: Key
Key'PadMultiply :: Key
Key'PadSubtract :: Key
Key'PadAdd :: Key
Key'PadEnter :: Key
Key'PadEqual :: Key
Key'LeftShift :: Key
Key'LeftControl :: Key
Key'LeftAlt :: Key
Key'LeftSuper :: Key
Key'RightShift :: Key
Key'RightControl :: Key
Key'RightAlt :: Key
Key'RightSuper :: Key
Key'Menu :: Key
data KeyState :: *
KeyState'Pressed :: KeyState
KeyState'Released :: KeyState
KeyState'Repeating :: KeyState
data ModifierKeys :: *
ModifierKeys :: Bool -> Bool -> Bool -> Bool -> ModifierKeys
[modifierKeysShift] :: ModifierKeys -> Bool
[modifierKeysControl] :: ModifierKeys -> Bool
[modifierKeysAlt] :: ModifierKeys -> Bool
[modifierKeysSuper] :: ModifierKeys -> Bool
data StickyKeysInputMode :: *
StickyKeysInputMode'Enabled :: StickyKeysInputMode
StickyKeysInputMode'Disabled :: StickyKeysInputMode
data CursorInputMode :: *
CursorInputMode'Normal :: CursorInputMode
CursorInputMode'Hidden :: CursorInputMode
CursorInputMode'Disabled :: CursorInputMode
data StandardCursorShape :: *
StandardCursorShape'Arrow :: StandardCursorShape
StandardCursorShape'IBeam :: StandardCursorShape
StandardCursorShape'Crosshair :: StandardCursorShape
StandardCursorShape'Hand :: StandardCursorShape
StandardCursorShape'HResize :: StandardCursorShape
StandardCursorShape'VResize :: StandardCursorShape
data CursorState :: *
CursorState'InWindow :: CursorState
CursorState'NotInWindow :: CursorState
data StickyMouseButtonsInputMode :: *
StickyMouseButtonsInputMode'Enabled :: StickyMouseButtonsInputMode
StickyMouseButtonsInputMode'Disabled :: StickyMouseButtonsInputMode
data MouseButton :: *
MouseButton'1 :: MouseButton
MouseButton'2 :: MouseButton
MouseButton'3 :: MouseButton
MouseButton'4 :: MouseButton
MouseButton'5 :: MouseButton
MouseButton'6 :: MouseButton
MouseButton'7 :: MouseButton
MouseButton'8 :: MouseButton
data MouseButtonState :: *
MouseButtonState'Pressed :: MouseButtonState
MouseButtonState'Released :: MouseButtonState
data Joystick :: *
Joystick'1 :: Joystick
Joystick'2 :: Joystick
Joystick'3 :: Joystick
Joystick'4 :: Joystick
Joystick'5 :: Joystick
Joystick'6 :: Joystick
Joystick'7 :: Joystick
Joystick'8 :: Joystick
Joystick'9 :: Joystick
Joystick'10 :: Joystick
Joystick'11 :: Joystick
Joystick'12 :: Joystick
Joystick'13 :: Joystick
Joystick'14 :: Joystick
Joystick'15 :: Joystick
Joystick'16 :: Joystick
data JoystickButtonState :: *
JoystickButtonState'Pressed :: JoystickButtonState
JoystickButtonState'Released :: JoystickButtonState


-- | Non interactive applications only need to pass configuration defined
--   here into GPipe's <tt>runContextT</tt> and <tt>newWindow</tt>.
--   
--   Interactive applications will need
--   <a>Graphics.GPipe.Context.GLFW.Input</a>.
module Graphics.GPipe.Context.GLFW

-- | Opaque handle representing the initialized GLFW library.
--   
--   To get started quickly try <a>defaultHandleConfig</a> and
--   <a>defaultWindowConfig</a>.
--   
--   <pre>
--   import Graphics.GPipe
--   import qualified Graphics.GPipe.Context.GLFW as GLFW
--   
--   runContextT GLFW.defaultHandleConfig $ do
--       win &lt;- newWindow (WindowFormatColorDepth RGB8 Depth16) (GLFW.defaultWindowConfig "OpenGL Graphics")
--       -- Do GPipe things here
--   </pre>
data Handle

-- | Opaque handle representing a, possibly closed, internal
--   <a>Context</a>. You'll typically deal with GPipe's <tt>Window</tt>
--   instead of this one.
data GLFWWindow

-- | Default GLFW handle configuration.
--   
--   <ul>
--   <li>Print any errors that GLFW emits.</li>
--   <li>Automatically process GLFW events after every buffer swap.</li>
--   </ul>
defaultHandleConfig :: ContextHandlerParameters Handle

-- | Default window configuration for a small window on any monitor with
--   the given title.
defaultWindowConfig :: String -> WindowConfig

-- | Implementation specific context handler parameters, eg error handling
--   and event processing policies

-- | Configuration for a new GLFW window and associated OpenGL context.
data WindowConfig
WindowConfig :: Int -> Int -> String -> Maybe Monitor -> [WindowHint] -> Maybe Int -> WindowConfig
[configWidth] :: WindowConfig -> Int
[configHeight] :: WindowConfig -> Int
[configTitle] :: WindowConfig -> String
[configMonitor] :: WindowConfig -> Maybe Monitor
[configHints] :: WindowConfig -> [WindowHint]
[configSwapInterval] :: WindowConfig -> Maybe Int

-- | Type to describe the waiting or polling style of event processing
--   supported by GLFW.
--   
--   <ul>
--   <li>Recommended reading: <i>Event Processing</i> section of the GLFW
--   <i>Input Guide</i> at
--   <a>http://www.glfw.org/docs/latest/input_guide.html#events</a>.</li>
--   </ul>
data EventPolicy
Poll :: EventPolicy
Wait :: EventPolicy

-- | IO exception thrown when GLFW library initialization fails.
data InitException
InitException :: InitException

-- | IO Exception thrown when GLFW window creation fails.
data CreateWindowException
CreateWindowException :: String -> CreateWindowException
CreateSharedWindowException :: String -> CreateWindowException

-- | IO Exception thrown when attempting to create a new window using GLFW
--   hints which GPipe manages.
data UnsafeWindowHintsException
UnsafeWindowHintsException :: [WindowHint] -> UnsafeWindowHintsException

-- | Process GLFW and GPipe events according to the given
--   <a>EventPolicy</a> in a loop.
--   
--   <b>Use case:</b> Call <a>mainloop</a> in multithreaded applications
--   which do GPipe rendering off of the main thread, but which do not
--   otherwise need additional control over the main thread. For less
--   complex applications use automatic event processing configured via
--   <a>HandleConfig</a>.
--   
--   <ul>
--   <li>Must be called on the main thread.</li>
--   <li>The loop will run until <tt>windowShouldClose</tt> is true for the
--   all <tt>Window</tt>s created by the same <tt>ContextHandler</tt>, or
--   all the <tt>Window</tt>s have been deleted.</li>
--   <li>To indicate a window should close use
--   <tt>setWindowShouldClose</tt> in
--   <a>Graphics.GPipe.Context.GLFW.Wrapped</a>.</li>
--   </ul>
mainloop :: MonadIO m => Window os c ds -> EventPolicy -> ContextT Handle os m (Maybe ())

-- | Process GLFW and GPipe events according to the given
--   <a>EventPolicy</a>.
--   
--   <b>Use case:</b> Call <a>mainstep</a> as part of a custom engine loop
--   in multithreaded applications which do GPipe rendering off of the main
--   thread. Use <a>mainloop</a> for less complex applications.
--   
--   <ul>
--   <li>Must be called on the main thread.</li>
--   <li>Can be called with <i>any</i> window you've created and not yet
--   deleted.</li>
--   <li>If GPipe can't find the window you passed in, returns
--   <a>Nothing</a>.</li>
--   </ul>
mainstep :: MonadIO m => Window os c ds -> EventPolicy -> ContextT Handle os m (Maybe ())
