Safe Haskell | None |
---|---|
Language | Haskell2010 |
Threading restrictions which apply to the C version of GLFW still apply when
writing GLFW-b
programs. See
GLFW thread safety documentation
(applies here).
Current context restructions which apply to the C version of GLFW still apply. See GLFW current context documentation (applies here).
GLFW-b
wraps callbacks and schedules them to be run after pollEvents
and
waitEvents
in the normal GHC runtime where they aren't subject to the usual
GLFW reentrancy restrictions. See
GLFW reentrancy documentation
(does not apply here).
- data Error
- setErrorCallback :: Maybe ErrorCallback -> IO ()
- type ErrorCallback = Error -> String -> IO ()
- data Version = Version {
- versionMajor :: Int
- versionMinor :: Int
- versionRevision :: Int
- init :: IO Bool
- terminate :: IO ()
- getVersion :: IO Version
- getVersionString :: IO (Maybe String)
- data Monitor
- data MonitorState
- data VideoMode = VideoMode {}
- data GammaRamp
- makeGammaRamp :: [Int] -> [Int] -> [Int] -> Maybe GammaRamp
- getMonitors :: IO (Maybe [Monitor])
- getPrimaryMonitor :: IO (Maybe Monitor)
- getMonitorPos :: Monitor -> IO (Int, Int)
- getMonitorPhysicalSize :: Monitor -> IO (Int, Int)
- getMonitorName :: Monitor -> IO (Maybe String)
- setMonitorCallback :: Maybe MonitorCallback -> IO ()
- type MonitorCallback = Monitor -> MonitorState -> IO ()
- getVideoModes :: Monitor -> IO (Maybe [VideoMode])
- getVideoMode :: Monitor -> IO (Maybe VideoMode)
- setGamma :: Monitor -> Double -> IO ()
- getGammaRamp :: Monitor -> IO (Maybe GammaRamp)
- setGammaRamp :: Monitor -> GammaRamp -> IO ()
- data Window
- data WindowHint
- = WindowHint'Resizable Bool
- | WindowHint'Visible Bool
- | WindowHint'Decorated Bool
- | WindowHint'RedBits Int
- | WindowHint'GreenBits Int
- | WindowHint'BlueBits Int
- | WindowHint'AlphaBits Int
- | WindowHint'DepthBits Int
- | WindowHint'StencilBits Int
- | WindowHint'AccumRedBits Int
- | WindowHint'AccumGreenBits Int
- | WindowHint'AccumBlueBits Int
- | WindowHint'AccumAlphaBits Int
- | WindowHint'AuxBuffers Int
- | WindowHint'Samples Int
- | WindowHint'RefreshRate Int
- | WindowHint'Stereo Bool
- | WindowHint'sRGBCapable Bool
- | WindowHint'ClientAPI ClientAPI
- | WindowHint'ContextVersionMajor Int
- | WindowHint'ContextVersionMinor Int
- | WindowHint'ContextRobustness ContextRobustness
- | WindowHint'OpenGLForwardCompat Bool
- | WindowHint'OpenGLDebugContext Bool
- | WindowHint'OpenGLProfile OpenGLProfile
- data FocusState
- data IconifyState
- data ContextRobustness
- data OpenGLProfile
- data ClientAPI
- defaultWindowHints :: IO ()
- windowHint :: WindowHint -> IO ()
- createWindow :: Int -> Int -> String -> Maybe Monitor -> Maybe Window -> IO (Maybe Window)
- destroyWindow :: Window -> IO ()
- windowShouldClose :: Window -> IO Bool
- setWindowShouldClose :: Window -> Bool -> IO ()
- setWindowTitle :: Window -> String -> IO ()
- getWindowPos :: Window -> IO (Int, Int)
- setWindowPos :: Window -> Int -> Int -> IO ()
- getWindowSize :: Window -> IO (Int, Int)
- setWindowSize :: Window -> Int -> Int -> IO ()
- getFramebufferSize :: Window -> IO (Int, Int)
- iconifyWindow :: Window -> IO ()
- restoreWindow :: Window -> IO ()
- showWindow :: Window -> IO ()
- hideWindow :: Window -> IO ()
- getWindowMonitor :: Window -> IO (Maybe Monitor)
- setCursorPos :: Window -> Double -> Double -> IO ()
- getWindowFocused :: Window -> IO FocusState
- getWindowIconified :: Window -> IO IconifyState
- getWindowResizable :: Window -> IO Bool
- getWindowDecorated :: Window -> IO Bool
- getWindowVisible :: Window -> IO Bool
- getWindowClientAPI :: Window -> IO ClientAPI
- getWindowContextVersionMajor :: Window -> IO Int
- getWindowContextVersionMinor :: Window -> IO Int
- getWindowContextVersionRevision :: Window -> IO Int
- getWindowContextRobustness :: Window -> IO ContextRobustness
- getWindowOpenGLForwardCompat :: Window -> IO Bool
- getWindowOpenGLDebugContext :: Window -> IO Bool
- getWindowOpenGLProfile :: Window -> IO OpenGLProfile
- setWindowPosCallback :: Window -> Maybe WindowPosCallback -> IO ()
- type WindowPosCallback = Window -> Int -> Int -> IO ()
- setWindowSizeCallback :: Window -> Maybe WindowSizeCallback -> IO ()
- type WindowSizeCallback = Window -> Int -> Int -> IO ()
- setWindowCloseCallback :: Window -> Maybe WindowCloseCallback -> IO ()
- type WindowCloseCallback = Window -> IO ()
- setWindowRefreshCallback :: Window -> Maybe WindowRefreshCallback -> IO ()
- type WindowRefreshCallback = Window -> IO ()
- setWindowFocusCallback :: Window -> Maybe WindowFocusCallback -> IO ()
- type WindowFocusCallback = Window -> FocusState -> IO ()
- setWindowIconifyCallback :: Window -> Maybe WindowIconifyCallback -> IO ()
- type WindowIconifyCallback = Window -> IconifyState -> IO ()
- setFramebufferSizeCallback :: Window -> Maybe FramebufferSizeCallback -> IO ()
- type FramebufferSizeCallback = Window -> Int -> Int -> IO ()
- pollEvents :: IO ()
- waitEvents :: IO ()
- postEmptyEvent :: IO ()
- data Key
- = Key'Unknown
- | Key'Space
- | Key'Apostrophe
- | Key'Comma
- | Key'Minus
- | Key'Period
- | Key'Slash
- | Key'0
- | Key'1
- | Key'2
- | Key'3
- | Key'4
- | Key'5
- | Key'6
- | Key'7
- | Key'8
- | Key'9
- | Key'Semicolon
- | Key'Equal
- | Key'A
- | Key'B
- | Key'C
- | Key'D
- | Key'E
- | Key'F
- | Key'G
- | Key'H
- | Key'I
- | Key'J
- | Key'K
- | Key'L
- | Key'M
- | Key'N
- | Key'O
- | Key'P
- | Key'Q
- | Key'R
- | Key'S
- | Key'T
- | Key'U
- | Key'V
- | Key'W
- | Key'X
- | Key'Y
- | Key'Z
- | Key'LeftBracket
- | Key'Backslash
- | Key'RightBracket
- | Key'GraveAccent
- | Key'World1
- | Key'World2
- | Key'Escape
- | Key'Enter
- | Key'Tab
- | Key'Backspace
- | Key'Insert
- | Key'Delete
- | Key'Right
- | Key'Left
- | Key'Down
- | Key'Up
- | Key'PageUp
- | Key'PageDown
- | Key'Home
- | Key'End
- | Key'CapsLock
- | Key'ScrollLock
- | Key'NumLock
- | Key'PrintScreen
- | Key'Pause
- | Key'F1
- | Key'F2
- | Key'F3
- | Key'F4
- | Key'F5
- | Key'F6
- | Key'F7
- | Key'F8
- | Key'F9
- | Key'F10
- | Key'F11
- | Key'F12
- | Key'F13
- | Key'F14
- | Key'F15
- | Key'F16
- | Key'F17
- | Key'F18
- | Key'F19
- | Key'F20
- | Key'F21
- | Key'F22
- | Key'F23
- | Key'F24
- | Key'F25
- | Key'Pad0
- | Key'Pad1
- | Key'Pad2
- | Key'Pad3
- | Key'Pad4
- | Key'Pad5
- | Key'Pad6
- | Key'Pad7
- | Key'Pad8
- | Key'Pad9
- | Key'PadDecimal
- | Key'PadDivide
- | Key'PadMultiply
- | Key'PadSubtract
- | Key'PadAdd
- | Key'PadEnter
- | Key'PadEqual
- | Key'LeftShift
- | Key'LeftControl
- | Key'LeftAlt
- | Key'LeftSuper
- | Key'RightShift
- | Key'RightControl
- | Key'RightAlt
- | Key'RightSuper
- | Key'Menu
- data KeyState
- data Joystick
- data JoystickButtonState
- data MouseButton
- data MouseButtonState
- data CursorState
- data CursorInputMode
- data StickyKeysInputMode
- data StickyMouseButtonsInputMode
- data ModifierKeys = ModifierKeys {}
- data Image = Image {
- imageWidth :: Int
- imageHeight :: Int
- imagePixels :: [CUChar]
- newtype Cursor = Cursor {}
- data StandardCursorShape
- getCursorInputMode :: Window -> IO CursorInputMode
- setCursorInputMode :: Window -> CursorInputMode -> IO ()
- getStickyKeysInputMode :: Window -> IO StickyKeysInputMode
- setStickyKeysInputMode :: Window -> StickyKeysInputMode -> IO ()
- getStickyMouseButtonsInputMode :: Window -> IO StickyMouseButtonsInputMode
- setStickyMouseButtonsInputMode :: Window -> StickyMouseButtonsInputMode -> IO ()
- getKey :: Window -> Key -> IO KeyState
- getMouseButton :: Window -> MouseButton -> IO MouseButtonState
- getCursorPos :: Window -> IO (Double, Double)
- setKeyCallback :: Window -> Maybe KeyCallback -> IO ()
- type KeyCallback = Window -> Key -> Int -> KeyState -> ModifierKeys -> IO ()
- setCharCallback :: Window -> Maybe CharCallback -> IO ()
- type CharCallback = Window -> Char -> IO ()
- setMouseButtonCallback :: Window -> Maybe MouseButtonCallback -> IO ()
- type MouseButtonCallback = Window -> MouseButton -> MouseButtonState -> ModifierKeys -> IO ()
- setCursorPosCallback :: Window -> Maybe CursorPosCallback -> IO ()
- type CursorPosCallback = Window -> Double -> Double -> IO ()
- setCursorEnterCallback :: Window -> Maybe CursorEnterCallback -> IO ()
- type CursorEnterCallback = Window -> CursorState -> IO ()
- createCursor :: Image -> Int -> Int -> IO Cursor
- createStandardCursor :: StandardCursorShape -> IO Cursor
- setCursor :: Window -> Cursor -> IO ()
- destroyCursor :: Cursor -> IO ()
- setScrollCallback :: Window -> Maybe ScrollCallback -> IO ()
- type ScrollCallback = Window -> Double -> Double -> IO ()
- setDropCallback :: Window -> Maybe DropCallback -> IO ()
- type DropCallback = Window -> [String] -> IO ()
- 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 ()
- makeContextCurrent :: Maybe Window -> IO ()
- getCurrentContext :: IO (Maybe Window)
- swapBuffers :: Window -> IO ()
- swapInterval :: Int -> IO ()
- extensionSupported :: String -> IO Bool
- getClipboardString :: Window -> IO (Maybe String)
- setClipboardString :: Window -> String -> IO ()
Error handling
An enum for one of the GLFW error codes.
setErrorCallback :: Maybe ErrorCallback -> IO () Source #
Can (and probably should) be used before GLFW initialization. See glfwSetErrorCallback
type ErrorCallback = Error -> String -> IO () Source #
The error code and also a human-readable error message.
Initialization and version information
The library version of the GLFW implementation in use. See Version Management
Version | |
|
Attempts to initialize the GLFW library. When the library is not initialized, the only
allowed functions to call are getVersion
, getVersionString
, setErrorCallback
,
init
, and terminate
. Returns if the initialization was successful or not.
See glfwInit
and Initialization and Termination
Cleans up GLFW and puts the library into an uninitialized state. Once you call this, you must initilize the library again. Warning: No window's context may be current in another thread when this is called. See glfwTerminate and Initialization and Termination
getVersion :: IO Version Source #
Gets the version of the GLFW library that's being used with the current program. See glfwGetVersion
getVersionString :: IO (Maybe String) Source #
Gets the compile-time version string of the GLFW library binary.
Gives extra info like platform and compile time options used, but you should not
attempt to parse this to get the GLFW version number. Use getVersion
instead.
See glfwGetVersionString
Monitor handling
Represents a physical monitor that's currently connected. See the Monitor Guide
data MonitorState Source #
Part of the MonitorCallback
, for when a monitor gets connected or disconnected.
Lets you adjust the gamma of a monitor. To ensure that only valid values are created, use makeGammaRamp
.
See Gamma Ramp.
makeGammaRamp :: [Int] -> [Int] -> [Int] -> Maybe GammaRamp Source #
Smart constructor for a GammaRamp
.
getMonitors :: IO (Maybe [Monitor]) Source #
Gets the list of available monitors, if possible. See glfwGetMonitors
getPrimaryMonitor :: IO (Maybe Monitor) Source #
Gets the primary monitor. See glfwGetPrimaryMonitor
getMonitorPos :: Monitor -> IO (Int, Int) Source #
Gets the position of the specified monitor within the coordinate space. See glfwGetMonitorPos
getMonitorPhysicalSize :: Monitor -> IO (Int, Int) Source #
The physical width and height of the monitor. See glfwGetMonitorPhysicalSize
getMonitorName :: Monitor -> IO (Maybe String) Source #
A human-readable name for the monitor specified. See getMonitorName
setMonitorCallback :: Maybe MonitorCallback -> IO () Source #
Sets a callback for when a monitor is connected or disconnected. See glfwSetMonitorCallback
type MonitorCallback = Monitor -> MonitorState -> IO () Source #
Fires when a monitor is connected or disconnected.
getVideoModes :: Monitor -> IO (Maybe [VideoMode]) Source #
Obtains the possible video modes of the monitor. See glfwGetVideoModes
getVideoMode :: Monitor -> IO (Maybe VideoMode) Source #
Gets the active video mode of the monitor. See glfwGetVideoMode
getGammaRamp :: Monitor -> IO (Maybe GammaRamp) Source #
Gets the gamma ramp in use with the monitor. See glfwGetGammaRamp
setGammaRamp :: Monitor -> GammaRamp -> IO () Source #
Assigns a gamma ramp to use with the given monitor. See glfwSetGammaRamp
Window handling
Reprisents a GLFW window value. See the Window Guide
data WindowHint Source #
Lets you set various window hints before creating a Window
.
See Window Hints,
particularly Supported and Default Values.
data FocusState Source #
For use with the focus callback.
data IconifyState Source #
For use with the iconify callback. (note: iconified means minimized)
data ContextRobustness Source #
The OpenGL robustness strategy.
ContextRobustness'NoRobustness | |
ContextRobustness'NoResetNotification | |
ContextRobustness'LoseContextOnReset |
data OpenGLProfile Source #
The OpenGL profile.
The type of OpenGL to create a context for.
defaultWindowHints :: IO () Source #
Sets all the window hints to default. See glfwDefaultWindowHints
windowHint :: WindowHint -> IO () Source #
Hints something to the GLFW windowing system. See glfwWindowHint
:: Int | Desired width for the window. |
-> Int | Desired height for the window. |
-> String | Desired title for the window. |
-> Maybe Monitor | Monitor to use in fullscreen mode. |
-> Maybe Window | Window for context object sharing, see here. |
-> IO (Maybe Window) |
Creates a new window. Note: If running in GHCI don't forget to `:set -fno-ghci-sandbox` or you may run into an assertion failure, segfault or other nasty crash. See glfwCreateWindow
destroyWindow :: Window -> IO () Source #
Cleans up a window and all associated resources See glfwDestroyWindow
windowShouldClose :: Window -> IO Bool Source #
If the window should close or not. See glfwWindowShouldClose
setWindowShouldClose :: Window -> Bool -> IO () Source #
Sets if the window should close or not. See glfwSetWindowShouldClose
setWindowTitle :: Window -> String -> IO () Source #
Sets the Title string of the window. See glfwSetWindowTitle
getWindowPos :: Window -> IO (Int, Int) Source #
Gets the window's position (in Screen Coordinates). See glfwGetWindowPos
setWindowPos :: Window -> Int -> Int -> IO () Source #
Sets the window's position (in Screen Coordinates). See glfwSetWindowPos
getWindowSize :: Window -> IO (Int, Int) Source #
Gets the size of the window (in Screen Coordinates). See glfwGetWindowSize
setWindowSize :: Window -> Int -> Int -> IO () Source #
Sets the size of the client area for the window (in Screen Coordinates). See glfwSetWindowSize
getFramebufferSize :: Window -> IO (Int, Int) Source #
The size of the framebuffer (in Pixels) See glfwGetFramebufferSize
iconifyWindow :: Window -> IO () Source #
Iconifies (minimizes) the window. See glfwIconifyWindow
restoreWindow :: Window -> IO () Source #
Restores the window from an iconified/minimized state. See glfwRestoreWindow
showWindow :: Window -> IO () Source #
Shows the window. See glfwShowWindow
hideWindow :: Window -> IO () Source #
Hides the window. See glfwHideWindow
getWindowMonitor :: Window -> IO (Maybe Monitor) Source #
Gets the monitor that this window is running on. See glfwGetWindowMonitor
setCursorPos :: Window -> Double -> Double -> IO () Source #
Sets the position of the cursor within the window. See glfwSetCursorPos
getWindowFocused :: Window -> IO FocusState Source #
If the window has focus or not. See glfwGetWindowAttrib
getWindowIconified :: Window -> IO IconifyState Source #
If the window is iconified (minimized) or not. See glfwGetWindowAttrib
getWindowResizable :: Window -> IO Bool Source #
If the window is resizable or not. See glfwGetWindowAttrib
getWindowDecorated :: Window -> IO Bool Source #
If the window is decorated or not. See glfwGetWindowAttrib
getWindowVisible :: Window -> IO Bool Source #
If the window is visible or not. See glfwGetWindowAttrib
getWindowClientAPI :: Window -> IO ClientAPI Source #
The client api for this window. See glfwGetWindowAttrib
getWindowContextVersionMajor :: Window -> IO Int Source #
The context's "major" version, x.0.0 See glfwGetWindowAttrib
getWindowContextVersionMinor :: Window -> IO Int Source #
The context's "minor" version, 0.y.0 See glfwGetWindowAttrib
getWindowContextVersionRevision :: Window -> IO Int Source #
The context's "revision" version, 0.0.z See glfwGetWindowAttrib
getWindowContextRobustness :: Window -> IO ContextRobustness Source #
The context robustness of this window. See glfwGetWindowAttrib
getWindowOpenGLForwardCompat :: Window -> IO Bool Source #
If this window is set for opengl to be forward compatible. See glfwGetWindowAttrib
getWindowOpenGLDebugContext :: Window -> IO Bool Source #
If the window has an opengl debug context See glfwGetWindowAttrib
getWindowOpenGLProfile :: Window -> IO OpenGLProfile Source #
Obtains the current opengl profile. See glfwGetWindowAttrib
setWindowPosCallback :: Window -> Maybe WindowPosCallback -> IO () Source #
Sets the callback to use when the window position changes. See glfwSetWindowPosCallback
type WindowPosCallback = Window -> Int -> Int -> IO () Source #
Fires when the window position changes.
setWindowSizeCallback :: Window -> Maybe WindowSizeCallback -> IO () Source #
Sets the callback to use when the window's size changes. See glfwSetWindowSizeCallback
type WindowSizeCallback = Window -> Int -> Int -> IO () Source #
Fires when the window is resized (in Screen Coordinates, which might not map 1:1 with pixels).
setWindowCloseCallback :: Window -> Maybe WindowCloseCallback -> IO () Source #
Sets the callback to use when the user attempts to close the window. See glfwSetWindowCloseCallback
type WindowCloseCallback = Window -> IO () Source #
Fires when the user is attempting to close the window
setWindowRefreshCallback :: Window -> Maybe WindowRefreshCallback -> IO () Source #
Sets the callback to use when the window's data is partly dead and it should refresh. See glfwSetWindowRefreshCallback
type WindowRefreshCallback = Window -> IO () Source #
Fires when the contents of the window are damaged and they must be refreshed.
setWindowFocusCallback :: Window -> Maybe WindowFocusCallback -> IO () Source #
Sets the callback to use when the window gains or loses focus. See glfwSetWindowFocusCallback
type WindowFocusCallback = Window -> FocusState -> IO () Source #
Fires when the window gains or loses input focus.
setWindowIconifyCallback :: Window -> Maybe WindowIconifyCallback -> IO () Source #
Sets the callback to use when the window is iconified or not (aka, minimized or not). See glfwSetWindowIconifyCallback
type WindowIconifyCallback = Window -> IconifyState -> IO () Source #
Fires when the window is iconified (minimized) or not.
setFramebufferSizeCallback :: Window -> Maybe FramebufferSizeCallback -> IO () Source #
Sets the callback to use when the framebuffer's size changes. See glfwSetFramebufferSizeCallback
type FramebufferSizeCallback = Window -> Int -> Int -> IO () Source #
Fires when the size of the framebuffer for the window changes (in Pixels).
pollEvents :: IO () Source #
Checks for any pending events, processes them, and then immediately returns. This is most useful for continual rendering, such as games. See the Event Processing Guide
waitEvents :: IO () Source #
Waits until at least one event is in the queue then processes the queue and returns. Requires at least one window to be active for it to sleep. This saves a lot of CPU, and is better if you're doing only periodic rendering, such as with an editor program. See the Event Processing Guide
postEmptyEvent :: IO () Source #
Creates an empty event within the event queue. Can be called from any
thread, so you can use this to wake up the main thread that's using
waitEvents
from a secondary thread.
See the Event Processing Guide
Input handling
Part of the Keyboard Input system.
The state of an individual key when getKey
is called.
For use with the Joystick Input system.
data JoystickButtonState Source #
If a given joystick button is pressed or not when getJoystickButtons
is called.
data MouseButton Source #
Part of the Mouse Input system.
data MouseButtonState Source #
If the mouse button is pressed or not when getMouseButton
is called.
data CursorState Source #
If the mouse's cursor is in the window or not.
data CursorInputMode Source #
Allows for special forms of mouse input. See Cursor Modes
data StickyKeysInputMode Source #
When sticky keys is enabled, once a key is pressed it will remain pressed
at least until the state is polled with getKey
. After that, if the key has
been released it will switch back to released. This helps prevent problems
with low-resolution polling missing key pressed. Note that use of the
callbacks to avoid this problem the the recommended route, and this is just
for a fallback.
data StickyMouseButtonsInputMode Source #
This is the mouse version of StickyKeysInputMode.
data ModifierKeys Source #
Modifier keys that were pressed as part of another keypress event.
GLFW image data, for setting up custom mouse cursor appearnaces.
Image | |
|
Reprisents a GLFW cursor.
data StandardCursorShape Source #
Lets you use one of the standard cursor appearnaces that the local system theme provides for. See Standard Cursor Creation.
StandardCursorShape'Arrow | |
StandardCursorShape'IBeam | |
StandardCursorShape'Crosshair | |
StandardCursorShape'Hand | |
StandardCursorShape'HResize | |
StandardCursorShape'VResize |
getCursorInputMode :: Window -> IO CursorInputMode Source #
Gets the current cursor input mode. See glfwSetInputMode
setCursorInputMode :: Window -> CursorInputMode -> IO () Source #
Set the cursor input mode. See glfwSetInputMode
getStickyKeysInputMode :: Window -> IO StickyKeysInputMode Source #
Gets the current sticky keys mode. See glfwSetInputMode
setStickyKeysInputMode :: Window -> StickyKeysInputMode -> IO () Source #
Sets if sticky keys should be used or not. See glfwSetInputMode
getStickyMouseButtonsInputMode :: Window -> IO StickyMouseButtonsInputMode Source #
Gets if sticky mouse buttons are on or not. See glfwSetInputMode
setStickyMouseButtonsInputMode :: Window -> StickyMouseButtonsInputMode -> IO () Source #
Sets if sticky mouse buttons should be used or not. See glfwSetInputMode
getKey :: Window -> Key -> IO KeyState Source #
Gets the state of the specified key. If Stickey Keys isn't enabled then it's possible for keyboard polling to miss individual key presses. Use the callback to avoid this. See glfwGetKey
getMouseButton :: Window -> MouseButton -> IO MouseButtonState Source #
Gets the state of a single specified mouse button. If sticky mouse button mode isn't enabled it's possible for mouse polling to miss individual mouse events. Use the call back to avoid this. See glfwGetMouseButton
getCursorPos :: Window -> IO (Double, Double) Source #
Returns the position, in screen coodinates, relative to the upper left.
If the CursorInputMode
is "disabled", then results are unbounded by the window size.
See glfwGetCursorPos
setKeyCallback :: Window -> Maybe KeyCallback -> IO () Source #
Assigns the given callback to use for all keyboard presses and repeats. See glfwSetKeyCallback
type KeyCallback = Window -> Key -> Int -> KeyState -> ModifierKeys -> IO () Source #
Fires for each press or repeat of keyboard keys (regardless of if it has textual meaning or not, eg Shift)
setCharCallback :: Window -> Maybe CharCallback -> IO () Source #
Sets the callback to use when the user types a character See glfwSetCharCallback
type CharCallback = Window -> Char -> IO () Source #
Fires when a complete character codepoint is typed by the user, Shift then b
generates B.
setMouseButtonCallback :: Window -> Maybe MouseButtonCallback -> IO () Source #
Assigns the callback to run whenver a mouse button is clicked. See glfwSetMouseButtonCallback
type MouseButtonCallback = Window -> MouseButton -> MouseButtonState -> ModifierKeys -> IO () Source #
Fires whenever a mouse button is clicked.
setCursorPosCallback :: Window -> Maybe CursorPosCallback -> IO () Source #
Assigns the callback to run whenver the cursor position changes. See glfwSetCursorPosCallback
type CursorPosCallback = Window -> Double -> Double -> IO () Source #
Fires every time the cursor position changes. Sub-pixel accuracy is used, when available.
setCursorEnterCallback :: Window -> Maybe CursorEnterCallback -> IO () Source #
Sets the callback for when the cursor enters or leaves the client area. See Cursor Enter/Leave Events
type CursorEnterCallback = Window -> CursorState -> IO () Source #
Fires when the cursor enters or exits the client area of the window.
:: Image | The desired cursor image. |
-> Int | The desired x-coordinate, in pixels, of the cursor hotspot. |
-> Int | The desired y-coordinate, in pixels, of the cursor hotspot. |
-> IO Cursor |
Creates a new cursor.
createStandardCursor :: StandardCursorShape -> IO Cursor Source #
Creates a cursor with a standard shape that can be set for a window with setCursor.
setCursor :: Window -> Cursor -> IO () Source #
Sets the cursor image to be used when the cursor is over the client area of the specified window. The set cursor will only be visible when the cursor mode of the window is GLFW_CURSOR_NORMAL.
destroyCursor :: Cursor -> IO () Source #
Destroys a cursor previously created with createCursor
. Any remaining
cursors will be destroyed by terminate
.
setScrollCallback :: Window -> Maybe ScrollCallback -> IO () Source #
Sets the callback to run when the user scrolls with the mouse wheel or a touch gesture. See Scroll Input
type ScrollCallback = Window -> Double -> Double -> IO () Source #
Fires when the user scrolls the mouse wheel or via touch gesture.
setDropCallback :: Window -> Maybe DropCallback -> IO () Source #
Sets the file drop callback of the specified window, which is called when one or more dragged files are dropped on the window.
type DropCallback Source #
A callback that allows for drag and drop support.
joystickPresent :: Joystick -> IO Bool Source #
Tests if the joystick is present at all See glfwJoystickPresent
getJoystickAxes :: Joystick -> IO (Maybe [Double]) Source #
Returns the values of all axes of the specified joystick, normalized to between -1.0 and 1.0 See glfwGetJoystickAxes
getJoystickButtons :: Joystick -> IO (Maybe [JoystickButtonState]) Source #
Returns a list of all joystick button states for the specified joystick. See glfwGetJoystickButtons
getJoystickName :: Joystick -> IO (Maybe String) Source #
A human-readable name for a Joystick. Not guranteed to be unique. See glfwGetJoystickName
Time
getTime :: IO (Maybe Double) Source #
Returns the time (in seconds) of the GLFW timer.
This is the amount of time since GLFW was initialized, unless setTime
was used.
The exact resolution is system dependent.
See glfwGetTime
setTime :: Double -> IO () Source #
Sets the GLFW timer to the specified value, which is measured in seconds, and must be positive. The value must also be less than ~584 years in seconds (18446744073.0). After this the timer begins to count upward at the normal rate. See glfwSetTime
Context
makeContextCurrent :: Maybe Window -> IO () Source #
Makes the context of the specified window the current one for the calling thread. A context can only be made current on a single thread at a time, and each thread can have only a single current context at a time. See glfwMakeContextCurrent
getCurrentContext :: IO (Maybe Window) Source #
Obtains which window owns the current context of the calling thread. See glfwGetCurrentContext
swapBuffers :: Window -> IO () Source #
Swaps the front and back buffers of the window. See glfwSwapBuffers
swapInterval :: Int -> IO () Source #
Sets the number of screen updates that the GPU should wait after swapBuffers
before actually swapping the buffers.
Generates Error'NoCurrentContext
if no context is current.
See glfwSwapInterval
extensionSupported :: String -> IO Bool Source #
If the current OpenGL or OpenGL ES context supports the extension specified.
Generates Error'NoCurrentContext
if no context is current.
See glfwExtensionSupported
Clipboard
getClipboardString :: Window -> IO (Maybe String) Source #
Obtains the contents of the system keyboard, if possible.
Generates Error'FormatUnavailable
if the system clipboard is empty or if it's not a UTF-8 string.
See glfwGetClipboardString
setClipboardString :: Window -> String -> IO () Source #
The window that will own the clipboard contents, and also the clipboard string. See glfwSetClipboardString