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


-- | A Haskell binding for GLFW
--   
--   A Haskell binding for GLFW, a window system independent toolkit for
--   writing OpenGL programs. For more information about the C library on
--   which this binding is based, please see <a>http://www.glfw.org</a>.
@package GLFW
@version 0.5.1.0


-- | Haskell Interface to GLFW (<a>http://www.glfw.org</a>). Supports GLFW
--   API version 2.7.5.
--   
--   GLFW thread functions are not supported by this module; use Haskell
--   thread instead.
module Graphics.UI.GLFW

-- | Version is represented by (major, minor, revision), used in gettable
--   variable <a>version</a>.
type Version = (Int, Int, Int)

-- | Bit depth of GL display buffers, used in <a>openWindow</a>.
data DisplayBits
DisplayRGBBits :: !Int -> !Int -> !Int -> DisplayBits
DisplayAlphaBits :: !Int -> DisplayBits
DisplayDepthBits :: !Int -> DisplayBits
DisplayStencilBits :: !Int -> DisplayBits

-- | Window or Fullscreen mode, used in <a>openWindow</a>.
data WindowMode
Window :: WindowMode
FullScreen :: WindowMode

-- | Video modes used in gettable variables <a>videoModes</a> and
--   <a>desktopMode</a>.
data VideoMode
VideoMode :: !Int -> !Int -> !Int -> !Int -> !Int -> VideoMode
videoWidth :: VideoMode -> !Int
videoHeight :: VideoMode -> !Int
videoRedBits :: VideoMode -> !Int
videoBlueBits :: VideoMode -> !Int
videoGreenBits :: VideoMode -> !Int

-- | Key or button state.
data KeyButtonState
Release :: KeyButtonState
Press :: KeyButtonState

-- | Key is represented by either a character key or a special key.
data Key
CharKey :: Char -> Key
SpecialKey :: SpecialKey -> Key

-- | Special key is a key not represented in the 32 - 127 printable ASCII
--   range.
data SpecialKey
UNKNOWN :: SpecialKey
ESC :: SpecialKey
F1 :: SpecialKey
F2 :: SpecialKey
F3 :: SpecialKey
F4 :: SpecialKey
F5 :: SpecialKey
F6 :: SpecialKey
F7 :: SpecialKey
F8 :: SpecialKey
F9 :: SpecialKey
F10 :: SpecialKey
F11 :: SpecialKey
F12 :: SpecialKey
F13 :: SpecialKey
F14 :: SpecialKey
F15 :: SpecialKey
F16 :: SpecialKey
F17 :: SpecialKey
F18 :: SpecialKey
F19 :: SpecialKey
F20 :: SpecialKey
F21 :: SpecialKey
F22 :: SpecialKey
F23 :: SpecialKey
F24 :: SpecialKey
F25 :: SpecialKey
UP :: SpecialKey
DOWN :: SpecialKey
LEFT :: SpecialKey
RIGHT :: SpecialKey
LSHIFT :: SpecialKey
RSHIFT :: SpecialKey
LCTRL :: SpecialKey
RCTRL :: SpecialKey
LALT :: SpecialKey
RALT :: SpecialKey
TAB :: SpecialKey
ENTER :: SpecialKey
BACKSPACE :: SpecialKey
INSERT :: SpecialKey
DEL :: SpecialKey
PAGEUP :: SpecialKey
PAGEDOWN :: SpecialKey
HOME :: SpecialKey
END :: SpecialKey
KP_0 :: SpecialKey
KP_1 :: SpecialKey
KP_2 :: SpecialKey
KP_3 :: SpecialKey
KP_4 :: SpecialKey
KP_5 :: SpecialKey
KP_6 :: SpecialKey
KP_7 :: SpecialKey
KP_8 :: SpecialKey
KP_9 :: SpecialKey
KP_DIVIDE :: SpecialKey
KP_MULTIPLY :: SpecialKey
KP_SUBTRACT :: SpecialKey
KP_ADD :: SpecialKey
KP_DECIMAL :: SpecialKey
KP_EQUAL :: SpecialKey
KP_ENTER :: SpecialKey

-- | Mouse button is represented by left, right, middle or a number from 0
--   to 7. <i>Differs from the C API.</i>
data MouseButton
ButtonLeft :: MouseButton
ButtonRight :: MouseButton
ButtonMiddle :: MouseButton
ButtonNo :: Int -> MouseButton

-- | Joystick is represent a number from 0 to 15. <i>Differs from the C
--   API.</i>
newtype Joystick
Joystick :: Int -> Joystick

-- | Joystick parameters
data JoystickParam

-- | Indicates whether the joystick is present.
Present :: JoystickParam

-- | Number of axes supported by the joystick.
Axes :: JoystickParam

-- | Number of buttons supported by the joystick.
Buttons :: JoystickParam

-- | Special features used in <a>enableSpecial</a> and
--   <a>disableSpecial</a>.
data SpecialFeature

-- | When enabled, the mouse cursor is visible and mouse coordinates are
--   relative to the upper left corner of the client area of the GLFW
--   window. The coordinates are limited to the client area of the window.
MouseCursor :: SpecialFeature

-- | When enabled, keys which are pressed will not be released until they
--   are physically released and checked with <a>getKey</a>.
StickyKey :: SpecialFeature

-- | When enabled, mouse buttons which are pressed will not be released
--   until they are physically released and checked with
--   <a>getMouseButton</a>.
StickyMouseButton :: SpecialFeature

-- | When enabled, pressing standard system key combinations, such as
--   ALT+TAB under Windows, will give the normal behavior.
SystemKey :: SpecialFeature

-- | When enabled, the key and character callback functions are called
--   repeatedly when a key is held down long enough (according to the
--   system key repeat configuration).
KeyRepeat :: SpecialFeature

-- | When enabled, <a>pollEvents</a> is automatically called each time
--   <a>swapBuffers</a> is called, immediately after the buffer swap
--   itself. Enabled by default.
AutoPollEvent :: SpecialFeature

-- | Texture flag used in <a>loadTexture2D</a> and
--   <a>loadMemoryTexture2D</a>.
data TextureFlag

-- | Do not rescale to the closest 2^m x 2^n resolution.
NoRescale :: TextureFlag

-- | Specifies that the origin of the loaded image should be in the upper
--   left corner (default is the lower left corner).
OriginUL :: TextureFlag

-- | Automatically build and upload all mipmap levels.
BuildMipMaps :: TextureFlag

-- | Treat single component images as alpha maps rather than luminance
--   maps.
AlphaMap :: TextureFlag

-- | Built-in bitmap font used in <a>renderString</a>.
data BitmapFont

-- | 8x16 fixed width font.
Fixed8x16 :: BitmapFont

-- | Callback type for <a>windowCloseCallback</a>. The callback should
--   return <a>True</a> to close the window, and <a>False</a> otherwise.
type WindowCloseCallback = IO Bool

-- | Callback type for <a>windowSizeCallback</a>.
type WindowSizeCallback = Size -> IO ()

-- | Callback type for <a>windowRefreshCallback</a>.
type WindowRefreshCallback = IO ()

-- | Callback type for <a>keyCallback</a>.
type KeyCallback = Key -> KeyButtonState -> IO ()

-- | Callback type for <a>charCallback</a>.
type CharCallback = Char -> KeyButtonState -> IO ()

-- | Callback type for <a>mouseButtonCallback</a>.
type MouseButtonCallback = MouseButton -> KeyButtonState -> IO ()

-- | Callback type for <a>mousePosCallback</a>.
type MousePosCallback = Position -> IO ()

-- | Callback type for <a>mouseWheelCallback</a>.
type MouseWheelCallback = Int -> IO ()

-- | Initialize GLFW library. Returns <a>True</a> if successful,
--   <a>False</a> otherwise. Must be called before any other GLFW
--   functions.
initialize :: IO Bool

-- | Terminate GLFW library after use. Before a program terminates, GLFW
--   has to be terminated in order to free up resources, etc.
terminate :: IO ()

-- | Returns the GLFW C library version numbers.
version :: GettableStateVar Version

-- | Open a window. Returns <a>True</a> if successful, <a>False</a>
--   otherwise. GLFW applications can only open one window.
--   
--   If width is zero and height is not, width will be calculated as width
--   = 4/3 height.
--   
--   If height is zero and width is not, height will be calculated as
--   height = 3/4 width.
--   
--   If both width and height are zero, width is set to 640 and height to
--   480.
--   
--   Display bits default to 0 if no value is specified, meaning that
--   particular buffer is not created.
--   
--   In fullscreen mode a resolution that best matches the given window
--   dimensions will be chosen.
--   
--   In fullscreen mode the mouse cursor is hidden by default. To change
--   the visibility of the mouse cursor, see, <a>enableSpecial</a> and
--   <a>disableSpecial</a>.
openWindow :: Size -> [DisplayBits] -> WindowMode -> IO Bool

-- | Close the open window and destroy the associated OpenGL context.
closeWindow :: IO ()

-- | Set the title of the opened window.
windowTitle :: SettableStateVar String

-- | Get or set the size of the opened window.
--   
--   The dimensions denote the size of the client area of the window (i.e.
--   excluding any window borders and decorations).
--   
--   If the window is in fullscreen mode when setting new dimensions, the
--   video mode will be changed to a resolution that closest matches the
--   given dimensions.
--   
--   The setter has no effect if the window is iconified.
--   
--   The OpenGL context is guaranteed to be preserved when the window is
--   resized.
windowSize :: StateVar Size

-- | Set the position of the opened window.
--   
--   The setter has no effect in fullscreen mode or if the window is
--   iconified.
--   
--   On multi-monitor systems, the behavior of the setter is ill-defined.
windowPos :: SettableStateVar Position

-- | Iconify the window.
iconifyWindow :: IO ()

-- | Restore the window after iconification.
restoreWindow :: IO ()

-- | Swap the back and front color buffers of the window. If
--   <a>AutoPollEvent</a> is enabled by <a>enableSpecial</a> (which is the
--   default), it also polls for new events before the swapping.
swapBuffers :: IO ()

-- | Set the minimum number of monitor retraces between each each buffer
--   swap performed by <a>swapBuffers</a>. If set to zero, buffer swaps
--   will not be synchronized to the vertical refresh of the monitor.
swapInterval :: SettableStateVar Int

-- | Get a list of detected <a>VideoMode</a>s, the max number of which is
--   limited to 256 for now.
videoModes :: GettableStateVar [VideoMode]

-- | Get the <a>VideoMode</a> of current desktop.
desktopMode :: GettableStateVar VideoMode

-- | Poll events, such as user input and window events. Upon calling this
--   function, all window states, keyboard states and mouse states are
--   updated. If any related callback functions are registered, these are
--   called during the call of <a>pollEvents</a>.
--   
--   <a>pollEvents</a> is called implicitly from <a>swapBuffers</a> if
--   <a>AutoPollEvent</a> is enabled (as it is by default).
pollEvents :: IO ()

-- | Wait for events, such as user input and window events. The calling
--   thread will be put to sleep until any event appears in the event
--   queue. When events are ready, the events will be processed just as
--   they are processed by <a>pollEvents</a>.
waitEvents :: IO ()

-- | Return a <a>KeyButtonState</a>, either <a>Release</a> or <a>Press</a>,
--   of the indicated key.
--   
--   A window must be opened for the function to have any effect, and
--   <a>pollEvents</a>, <a>waitEvents</a> or <a>swapBuffers</a> (with
--   <a>AutoPollEvent</a> enabled) must be called before any keyboard
--   events are recorded and reported by <a>getKey</a>.
getKey :: Enum a => a -> IO KeyButtonState

-- | Return a <a>KeyButtonState</a>, either <a>Release</a> or <a>Press</a>,
--   of the indicated mouse button.
--   
--   A window must be opened for the function to have any effect, and
--   <a>pollEvents</a>, <a>waitEvents</a> or <a>swapBuffers</a> (with
--   <a>AutoPollEvent</a> enabled) must be called before any mouse events
--   are recorded and reported by <a>getMouseButton</a>.
getMouseButton :: MouseButton -> IO KeyButtonState

-- | Set or get the mouse position.
--   
--   A window must be opened for the getter to have any effect, and
--   <a>pollEvents</a>, <a>waitEvents</a> or <a>swapBuffers</a> (with
--   <a>AutoPollEvent</a> enabled) must be called before any mouse
--   movements are recorded and reported by <a>mousePos</a>.
--   
--   When setting the mouse position, if the cursor is visible (not
--   disabled), the cursor will be moved to the specified position,
--   relative to the upper left corner of the window client area and with
--   the Y-axis down. If the cursor is hidden (disabled), only the mouse
--   position that is reported by the getter is changed.
mousePos :: StateVar Position

-- | Set or get the mouse wheel position.
--   
--   A window must be opened for the getter to have any effect, and
--   <a>pollEvents</a>, <a>waitEvents</a> or <a>swapBuffers</a> (with
--   <a>AutoPollEvent</a> enabled) must be called before any wheel
--   movements are recorded and reported by <a>mouseWheel</a>.
mouseWheel :: StateVar Int

-- | Get joystick parameters.
--   
--   The joystick information is updated every time the getter is queried.
--   
--   No window has to be opened for joystick information to be available.
joystickParam :: Joystick -> JoystickParam -> GettableStateVar CInt

-- | Get a certain number of axis positions for the given joystick. If the
--   number of positions requested is is greater than the number available,
--   the unavailable positions will be 0.
--   
--   The joystick state is updated every time the getter is queried.
--   
--   No window has to be opened for joystick input to be available.
joystickPos :: Joystick -> Int -> GettableStateVar [Float]

-- | Get joystick positions. The returned list contains the positions for
--   all available axes for the given joystick.
--   
--   The joystick state is updated every time the getter is queried.
--   
--   No window has to be opened for joystick input to be available.
joystickPos' :: Joystick -> GettableStateVar [Float]

-- | Get joystick button states. The returned list contains the states for
--   all available buttons for the given joystick.
--   
--   The joystick state is updated every time the getter is queried.
--   
--   No window has to be opened for joystick input to be available.
joystickButtons :: Joystick -> GettableStateVar [KeyButtonState]

-- | Set the function that will be called every time the window size
--   changes.
windowSizeCallback :: SettableStateVar WindowSizeCallback

-- | Set the function that will be called when the window is closed.
windowCloseCallback :: SettableStateVar WindowCloseCallback

-- | Set the function that will be called when the window client area needs
--   to be refreshed, which occurs when any part of the window client area
--   is damaged and needs to be repainted (for instance, if a part of the
--   window that was previously occluded by another window has become
--   visible).
windowRefreshCallback :: SettableStateVar WindowRefreshCallback

-- | Set the function that will be called when there is a key event, i.e.,
--   every time the state of a single key is changed. The reported keys are
--   unaffected by any modifiers (such as SHIFT or ALT).
keyCallback :: SettableStateVar KeyCallback

-- | Set the function that will be called when there is a character event,
--   i.e., every time a key that results in a printable Unicode character
--   is pressed or released. Characters are affected by modifiers (such as
--   SHIFT or ALT).
charCallback :: SettableStateVar CharCallback

-- | Set the function that will be called when there is a mouse button
--   event, i.e., every time a mouse button is pressed or released.
mouseButtonCallback :: SettableStateVar MouseButtonCallback

-- | Set the function that will be called when there is a mouse motion
--   event, i.e., every time they mouse is moved.
mousePosCallback :: SettableStateVar MousePosCallback

-- | Set the function that will be called when there is a mouse wheel
--   event, i.e., every time the mouse wheel is turned.
mouseWheelCallback :: SettableStateVar MouseWheelCallback

-- | Get or set the value of the high precision timer. The time is measured
--   in seconds as a double precision floating point number.
--   
--   Unless the timer has been set by the programmer, the time is measured
--   as the number of seconds that have passed since <a>initialize</a> was
--   called.
--   
--   The resolution of the timer depends on which system the program is
--   running on.
time :: StateVar Double

-- | Put the calling thread to sleep for the requested period of time in
--   seconds.
--   
--   The minimum amount of time it is possible to sleep is generally in the
--   range 1ms to 20ms.
sleep :: Double -> IO ()

-- | Return <a>True</a> if the extension is supported, <a>False</a>
--   otherwise.
extensionSupported :: String -> IO Bool

-- | Returns the version numbers for the currently used OpenGL
--   implementation.
glVersion :: GettableStateVar Version

-- | Read an image from a file specified by the given string and upload the
--   image to OpenGL texture memory.
--   
--   If BuildMipMaps flag is given, all mipmap levels for the loaded
--   texture are generated and uploaded to texture memory.
--   
--   Unless the OriginUL flag is given, the origin of the texture is the
--   lower left corner of the loaded image. If OriginUL is given, however,
--   the first pixel is the upper left corner.
--   
--   For single component images (i.e. gray scale), the texture is uploaded
--   as an alpha mask if the flag AlphaMap is set, otherwise it's uploaded
--   as a luminance texture.
--   
--   It only supports the Truevision Targa verson 1 file (.tga). Supported
--   pixel formats are: 8-bit gray scale, 8-bit paletted (24/32-bit color),
--   24-bit true color and 32-bit true color + alpha.
--   
--   Paletted images are translated into true color or true color + alpha
--   pixel formats.
--   
--   The read texture is always rescaled to the nearest larger 2^m x 2^n
--   resolution using bilinear interpolation if necessary.
loadTexture2D :: String -> [TextureFlag] -> IO Bool

-- | Read an image from the memory buffer (the given byte string) and
--   upload the image to OpenGL texture memory. The rest is similar to
--   <a>loadTexture2D</a>.
loadMemoryTexture2D :: String -> [TextureFlag] -> IO Bool

-- | Render a text string using the given <a>BitmapFont</a>. Text is
--   rendered through texture, and is only possible with alpha enabled.
renderString :: BitmapFont -> String -> IO ()

-- | Enable a <a>SpecialFeature</a>.
enableSpecial :: SpecialFeature -> IO ()

-- | Disable a <a>SpecialFeature</a>.
disableSpecial :: SpecialFeature -> IO ()

-- | We use type families to organize Window params that can be retrieved
--   using <a>getParam</a> of the <a>Param</a> class. The value of a param
--   <tt>a</tt> is of type <a>ParamVal</a> <tt>a</tt>, where
--   <a>ParamVal</a> is a type family defined as follows:
--   
--   <pre>
--   ParamVal Opened      = Bool
--   ParamVal Active      = Bool
--   ParamVal Iconified   = Bool
--   ParamVal Accelerated = Bool
--   ParamVal RedBits     = Int
--   ParamVal GreenBits   = Int
--   ParamVal BlueBits    = Int
--   ParamVal AlphaBits   = Int
--   ParamVal DepthBits   = Int
--   ParamVal StencilBits = Int
--   </pre>
--   
--   The following are both params and hints that can be set using
--   <a>openWindowHint</a> of the <a>Hint</a> class.
--   
--   <pre>
--   ParamVal RefreshRate         = Int
--   ParamVal AccumRedBits        = Int
--   ParamVal AccumGreenBits      = Int
--   ParamVal AccumBlueBits       = Int
--   ParamVal AccumAlphaBits      = Int
--   ParamVal AuxBuffers          = Int
--   ParamVal Stereo              = Bool
--   ParamVal NoResize            = Bool
--   ParamVal FSAASamples         = Int
--   ParamVal OpenGLVersionMajor  = Int
--   ParamVal OpenGLVersionMinor  = Int
--   ParamVal OpenGLForwardCompat = Bool
--   ParamVal OpenGLDebugContext  = Bool
--   ParamVal OpenGLProfile       = Profile
--   </pre>
class Param a
getParam :: Param a => a -> IO (ParamVal a)
class Param a => Hint a
openWindowHint :: Hint a => a -> ParamVal a -> IO ()
data Opened
Opened :: Opened
data Active
Active :: Active
data Iconified
Iconified :: Iconified
data Accelerated
Accelerated :: Accelerated
data RedBits
RedBits :: RedBits
data GreenBits
GreenBits :: GreenBits
data BlueBits
BlueBits :: BlueBits
data AlphaBits
AlphaBits :: AlphaBits
data DepthBits
DepthBits :: DepthBits
data StencilBits
StencilBits :: StencilBits
data RefreshRate
RefreshRate :: RefreshRate
data AccumRedBits
AccumRedBits :: AccumRedBits
data AccumGreenBits
AccumGreenBits :: AccumGreenBits
data AccumBlueBits
AccumBlueBits :: AccumBlueBits
data AccumAlphaBits
AccumAlphaBits :: AccumAlphaBits
data AuxBuffers
AuxBuffers :: AuxBuffers
data Stereo
Stereo :: Stereo
data NoResize
NoResize :: NoResize
data FSAASamples
FSAASamples :: FSAASamples
data OpenGLVersionMajor
OpenGLVersionMajor :: OpenGLVersionMajor
data OpenGLVersionMinor
OpenGLVersionMinor :: OpenGLVersionMinor
data OpenGLForwardCompat
OpenGLForwardCompat :: OpenGLForwardCompat
data OpenGLDebugContext
OpenGLDebugContext :: OpenGLDebugContext
data OpenGLProfile
OpenGLProfile :: OpenGLProfile

-- | OpenGL profiles, used in <a>openWindowHint</a> with
--   <a>OpenGLProfile</a>.
data Profile
DefaultProfile :: Profile
OpenGLCoreProfile :: Profile
OpenGLCompatProfile :: Profile
instance Eq DisplayBits
instance Show DisplayBits
instance Eq WindowMode
instance Show WindowMode
instance Eq Profile
instance Show Profile
instance Eq VideoMode
instance Show VideoMode
instance Eq KeyButtonState
instance Show KeyButtonState
instance Enum KeyButtonState
instance Eq SpecialKey
instance Ord SpecialKey
instance Show SpecialKey
instance Eq Key
instance Ord Key
instance Show Key
instance Eq MouseButton
instance Show MouseButton
instance Eq Joystick
instance Show Joystick
instance Eq JoystickParam
instance Show JoystickParam
instance Eq SpecialFeature
instance Show SpecialFeature
instance Eq TextureFlag
instance Show TextureFlag
instance Eq BitmapFont
instance Enum BitmapFont
instance Show BitmapFont
instance Param OpenGLProfile
instance Param OpenGLDebugContext
instance Param OpenGLForwardCompat
instance Param OpenGLVersionMinor
instance Param OpenGLVersionMajor
instance Param FSAASamples
instance Param NoResize
instance Param Stereo
instance Param AuxBuffers
instance Param AccumAlphaBits
instance Param AccumBlueBits
instance Param AccumGreenBits
instance Param AccumRedBits
instance Param RefreshRate
instance Param StencilBits
instance Param DepthBits
instance Param AlphaBits
instance Param BlueBits
instance Param GreenBits
instance Param RedBits
instance Param Accelerated
instance Param Iconified
instance Param Active
instance Param Opened
instance Hint OpenGLProfile
instance Hint OpenGLDebugContext
instance Hint OpenGLForwardCompat
instance Hint OpenGLVersionMinor
instance Hint OpenGLVersionMajor
instance Hint FSAASamples
instance Hint NoResize
instance Hint Stereo
instance Hint AuxBuffers
instance Hint AccumAlphaBits
instance Hint AccumBlueBits
instance Hint AccumGreenBits
instance Hint AccumRedBits
instance Hint RefreshRate
instance Enum TextureFlag
instance Enum SpecialFeature
instance Enum JoystickParam
instance Enum Joystick
instance Enum MouseButton
instance Enum SpecialKey
instance Enum Key
instance Enum Profile
instance Enum WindowMode
