-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | A binding for GLFW, An OpenGL Framework
--
-- A Haskell binding for GLFW OpenGL Framework, a window system
-- independent toolkit for writing OpenGL programs. For more information
-- about the C library on which this binding is based, please see:
-- http://glfw.sourceforge.net
@package GLFW
@version 0.3
-- | Interface to GLFW - An OpenGL Framework.
--
-- It provides an alternative to GLUT for OpenGL based Haskell programs,
-- and currently supports GLFW API version 2.6
-- http://glfw.sourceforge.net.
module Graphics.UI.GLFW
-- | Version is represented by (major, minor, revision), used in gettable
-- variable version.
type Version = (Int, Int, Int)
-- | Bit depth of GL display buffers, used in openWindow.
data DisplayBits
DisplayRGBBits :: !Int -> !Int -> !Int -> DisplayBits
DisplayAlphaBits :: !Int -> DisplayBits
DisplayDepthBits :: !Int -> DisplayBits
DisplayStencilBits :: !Int -> DisplayBits
-- | Window or Fullscreen mode, used in openWindow.
data WindowMode
Window :: WindowMode
FullScreen :: WindowMode
-- | Window hints, used in settable variable openWindowHint.
data WindowHint
RefreshRate :: WindowHint
AccumRedBits :: WindowHint
AccumGreenBits :: WindowHint
AccumBlueBits :: WindowHint
AccumAlphaButs :: WindowHint
AuxBuffers :: WindowHint
Stereo :: WindowHint
NoResize :: WindowHint
FSAASamples :: WindowHint
-- | Window parameters used in gettable variable windowParam.
data WindowParam
Opened :: WindowParam
Active :: WindowParam
Iconified :: WindowParam
Accelerated :: WindowParam
RedBits :: WindowParam
GreenBits :: WindowParam
BlueBits :: WindowParam
AlphaBits :: WindowParam
DepthBits :: WindowParam
StencilBits :: WindowParam
-- | Video modes used in gettable variables videoModes and
-- desktopMode.
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 (note the difference from the GLFW C library).
data MouseButton
ButtonLeft :: MouseButton
ButtonRight :: MouseButton
ButtonMiddle :: MouseButton
ButtonNo :: Int -> MouseButton
-- | Joystick is represent a number from 0 to 15 (note the difference from
-- the GLFW C library).
newtype Joystick
Joystick :: Int -> Joystick
-- | Joystick parameters
data JoystickParam
Present :: JoystickParam
Axes :: JoystickParam
Buttons :: JoystickParam
-- | Special features used in enableSpecial and
-- disableSpecial.
data SpecialFeature
MouseCursor :: SpecialFeature
StickyKey :: SpecialFeature
StickyMouseButton :: SpecialFeature
SystemKey :: SpecialFeature
KeyRepeat :: SpecialFeature
AutoPollEvent :: SpecialFeature
-- | Texture flag used in loadTexture2D and
-- loadMemoryTexture2D.
data TextureFlag
NoRescale :: TextureFlag
OriginUL :: TextureFlag
BuildMipMaps :: TextureFlag
AlphaMap :: TextureFlag
-- | Build-in bitmap font used in renderString.
data BitmapFont
-- | 8x16 fixed width font.
Fixed8x16 :: BitmapFont
-- | Callback type for windowCloseCallback.
type WindowCloseCallback = IO ()
-- | Callback type for windowSizeCallback.
type WindowSizeCallback = Size -> IO ()
-- | Callback type for windowRefreshCallback.
type WindowRefreshCallback = IO ()
-- | Callback type for keyCallback.
type KeyCallback = Key -> KeyButtonState -> IO ()
-- | Callback type for charCallback.
type CharCallback = Char -> KeyButtonState -> IO ()
-- | Callback type for mouseButtonCallback.
type MouseButtonCallback = MouseButton -> KeyButtonState -> IO ()
-- | Callback type for mousePosCallback.
type MousePosCallback = Position -> IO ()
-- | Callback type for mouseWheelCallback.
type MouseWheelCallback = Int -> IO ()
-- | Initialize GLFW library before use, returns True if successful or
-- False otherwise.
--
-- Before any GLFW functions can be used, GLFW must be initialized to
-- ensure proper functionality.
initialize :: IO Bool
-- | Get a list of deteced VideoModes, the max number of which is
-- limited to 256 for now.
videoModes :: GettableStateVar [VideoMode]
-- | Get the VideoMode of current desktop.
desktopMode :: GettableStateVar VideoMode
-- | Returns the supported GLFW C library version numbers.
version :: GettableStateVar Version
-- | Open the Window of the given size and other parameters, returns True
-- if successful or False otherwise.
--
-- GLFW applications can only open one Window, which is assumed to be the
-- default place where renderings take place.
openWindow :: Size -> [DisplayBits] -> WindowMode -> IO Bool
-- | Set the Window hints, i.e., additional Window properties, before
-- openWindow.
openWindowHint :: SettableStateVar (WindowHint, Int)
-- | Close the open Window and destroys 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.
windowSize :: StateVar Size
-- | Iconify the Window which can later by retored.
iconifyWindow :: IO ()
-- | Restore the Window after iconification.
restoreWindow :: IO ()
-- | Swap the back and front color buffers of the Window. If
-- AutoPollEvent is enabled by enableSpecial (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 swapBuffers. If set to zero, buffer swaps
-- will not be synchronized to the vertical refresh of the monitor.
swapInterval :: SettableStateVar Int
-- | Get the value of Window parameters.
windowParam :: WindowParam -> GettableStateVar Int
-- | Get joystick parameters.
joystickParam :: Joystick -> JoystickParam -> GettableStateVar Int
-- | 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 pollEvents.
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 pollEvents.
waitEvents :: IO ()
-- | Return a KeyButtonState, either Release or Press,
-- of the indicated key.
getKey :: (Enum a) => a -> IO KeyButtonState
-- | Return a KeyButtonState, either Release or Press,
-- of the indicated mouse button.
getMouseButton :: MouseButton -> IO KeyButtonState
-- | Set or get the mouse position.
mousePos :: StateVar Position
-- | Set or get the mouse wheel position.
mouseWheel :: StateVar Int
-- | Get joystick positions. The returned list contains the positions for
-- all available axes for the given joystick.
joystickPos :: Joystick -> GettableStateVar [Int]
-- | Get joystick button states. The returned list contains the states for
-- all available buttons for the given joystick.
joystickButtons :: Joystick -> GettableStateVar [KeyButtonState]
-- | Set the callback function that will be called every time the Window
-- size changes.
windowSizeCallback :: SettableStateVar WindowSizeCallback
-- | Set the callback function that will be called when the Window is
-- closed.
windowCloseCallback :: SettableStateVar WindowCloseCallback
-- | Set the callback 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 callback function that will be called when there is a key
-- event, i.e., everytime 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 callback function that will be called when there is a
-- character event, i.e., everytime 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 callback function that will be called when there is a mouse
-- button event, i.e., everytime a mouse button is pressed or released.
mouseButtonCallback :: SettableStateVar MouseButtonCallback
-- | Set the callback function that will be called when there is a mouse
-- motion event, i.e., everytime they mouse is moved.
mousePosCallback :: SettableStateVar MousePosCallback
-- | Set the callback function that will be called when there is a mouse
-- wheel event, i.e., everytime 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 floasting point number.
--
-- Unless the timer has been set by the programmer, the time is measured
-- as the number of seconds that have passed since initialize was
-- called.
time :: StateVar Double
-- | Put the calling thread to sleep for the requested period of time in
-- seconds.
--
-- The time is generally in the range 1ms to 20ms, depending on thread
-- scheduling time slot intervals etc.
sleep :: Double -> IO ()
-- | Return True if the extension is supported, otherwise False.
extensionSupported :: String -> IO Bool
-- | Enable a SpecialFeature.
enableSpecial :: SpecialFeature -> IO ()
-- | Disable a SpecialFeature.
disableSpecial :: SpecialFeature -> IO ()
-- | 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 tru 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
-- loadTexture2D.
loadMemoryTexture2D :: String -> [TextureFlag] -> IO Bool
-- | Render a text string using the given BitmapFont.
--
-- Text is rendered through texture, and is only possible with alpha
-- enabled.
renderString :: BitmapFont -> String -> IO ()
instance Eq BitmapFont
instance Enum BitmapFont
instance Show BitmapFont
instance Eq TextureFlag
instance Show TextureFlag
instance Eq SpecialFeature
instance Show SpecialFeature
instance Eq JoystickParam
instance Show JoystickParam
instance Eq Joystick
instance Show Joystick
instance Eq MouseButton
instance Show MouseButton
instance Eq SpecialKey
instance Show SpecialKey
instance Eq Key
instance Show Key
instance Eq KeyButtonState
instance Show KeyButtonState
instance Enum KeyButtonState
instance Eq VideoMode
instance Show VideoMode
instance Eq WindowParam
instance Show WindowParam
instance Eq WindowHint
instance Show WindowHint
instance Eq WindowMode
instance Show WindowMode
instance Eq DisplayBits
instance Show DisplayBits
instance Enum TextureFlag
instance Enum SpecialFeature
instance Enum JoystickParam
instance Enum Joystick
instance Enum MouseButton
instance Enum SpecialKey
instance Enum Key
instance Enum WindowParam
instance Enum WindowHint
instance Enum WindowMode