Package index
glfw-ocaml
Library glfw-ocaml
GLFW
Module
OCaml binding for GLFW 3.3
GLFW-OCaml version numbers.
Source val version_revision : int
Source exception NotInitialized of string
Exceptions raised by the various functions of this module.
If you ever get an InvalidEnum exception and are not using unsafe features that would be a bug in GLFW-OCaml. Please fill an issue on GitHub.
Source exception NoCurrentContext of string
Source exception InvalidEnum of string
Source exception InvalidValue of string
Source exception OutOfMemory of string
Source exception ApiUnavailable of string
Source exception VersionUnavailable of string
Source exception NoWindowContext of string
Source type key_action =
| Release
| Press
| Repeat
Source type key_mod =
| Shift
| Control
| Alt
| Super
Keyboard key and mouse button modifiers.
Maximum number of buttons handled for a mouse.
Values of common mouse buttons.
Source val joystick_max_count : int
Maximum number of joysticks connected.
Source type client_api =
| NoApi
| OpenGLApi
| OpenGLESApi
Source type context_robustness =
| NoRobustness
| NoResetNotification
| LoseContextOnReset
Source type opengl_profile =
| AnyProfile
| CoreProfile
| CompatProfile
Source type context_release_behavior =
| AnyReleaseBehavior
| ReleaseBehaviorFlush
| ReleaseBehaviorNone
Context release behavior hint
Source type context_creation_api =
| NativeContextApi
| EGLContextApi
| OSMesaContextApi
Context creation API hint
Window hints and attributes. Use with windowHint, getWindowAttrib and setWindowAttrib like this:
include module type of A
Source type ('a, _) window_attr =
| Focused : (bool, [< `hint | `attr ] ) window_attr
| Iconified : (bool, [< `attr ] ) window_attr
| Resizable : (bool, [< `hint | `attr | `update ] ) window_attr
| Visible : (bool, [< `hint | `attr ] ) window_attr
| Decorated : (bool, [< `hint | `attr | `update ] ) window_attr
| AutoIconify : (bool, [< `hint | `attr | `update ] ) window_attr
| Floating : (bool, [< `hint | `attr | `update ] ) window_attr
| Maximized : (bool, [< `hint | `attr ] ) window_attr
| CenterCursor : (bool, [< `hint ] ) window_attr
| TransparentFramebuffer : (bool, [< `hint | `attr ] ) window_attr
| Hovered : (bool, [< `attr ] ) window_attr
| FocusOnShow : (bool, [< `hint | `attr | `update ] ) window_attr
| RedBits : (int option , [< `hint ] ) window_attr
| GreenBits : (int option , [< `hint ] ) window_attr
| BlueBits : (int option , [< `hint ] ) window_attr
| AlphaBits : (int option , [< `hint ] ) window_attr
| DepthBits : (int option , [< `hint ] ) window_attr
| StencilBits : (int option , [< `hint ] ) window_attr
| AccumRedBits : (int option , [< `hint ] ) window_attr
| AccumGreenBits : (int option , [< `hint ] ) window_attr
| AccumBlueBits : (int option , [< `hint ] ) window_attr
| AccumAlphaBits : (int option , [< `hint ] ) window_attr
| AuxBuffers : (int option , [< `hint ] ) window_attr
| Stereo : (bool, [< `hint ] ) window_attr
| Samples : (int option , [< `hint ] ) window_attr
| SrgbCapable : (bool, [< `hint ] ) window_attr
| RefreshRate : (int option , [< `hint ] ) window_attr
| DoubleBuffer : (bool, [< `hint ] ) window_attr
| ClientApi : (client_api , [< `hint | `attr ] ) window_attr
| ContextVersionMajor : (int, [< `hint | `attr ] ) window_attr
| ContextVersionMinor : (int, [< `hint | `attr ] ) window_attr
| ContextRevision : (int, [< `attr ] ) window_attr
| ContextRobustness : (context_robustness , [< `hint | `attr ] ) window_attr
| OpenGLForwardCompat : (bool, [< `hint | `attr ] ) window_attr
| OpenGLDebugContext : (bool, [< `hint | `attr ] ) window_attr
| OpenGLProfile : (opengl_profile , [< `hint | `attr ] ) window_attr
| ContextReleaseBehavior : (context_release_behavior , [< `hint ] ) window_attr
| ContextNoError : (bool, [< `hint ] ) window_attr
| ContextCreationApi : (context_creation_api , [< `hint | `attr ] ) window_attr
| ScaleToMonitor : (bool, [< `hint ] ) window_attr
| CocoaRetinaFramebuffer : (bool, [< `hint ] ) window_attr
| CocoaFrameName : (string, [< `hint ] ) window_attr
| CocoaGraphicsSwitching : (bool, [< `hint ] ) window_attr
| X11ClassName : (string, [< `hint ] ) window_attr
| X11InstanceName : (string, [< `hint ] ) window_attr
Deprecated window hints and attributes modules.
Source type cursor_mode =
| Normal
| Hidden
| Disabled
Input modes. Use with setInputMode and getInputMode in a similar manner as with window hints.
Source type cursor_shape =
| ArrowCursor
| IBeamCursor
| CrosshairCursor
| HandCursor
| HResizeCursor
| VResizeCursor
Source type connection_event =
| Connected
| Disconnected
Joystick connection event.
Source type video_mode = {
width : int;
height : int;
red_bits : int;
green_bits : int;
blue_bits : int;
refresh_rate : int;
}
Video mode description as returned by getVideoMode(s).
GammaRamp module. Describes the gamma ramp for a monitor.
Image data for creating custom cursors and window icons.
Source type hat_status =
| HatUp
| HatRight
| HatDown
| HatLeft
Hat statuses as returned by getJoystickHats.
Source type gamepad_state = {
buttons : bool array ;
axes : float array ;
}
Gamepad state data as returned by getGamepadState.
Module functions. These are mostly identical to their original GLFW counterparts.
There are no bindings for the glfwSet,Get
*UserPointer functions because you would have to use unsafe features to set the correct type for your data. If you need to make user data accessible inside a callback you can instead capture it in a closure and use that closure as your callback function.
There is no binding for the glfwWindowHintString function. Simply pass your string to the windowHint function as you would for any other value type.
The window parameter of the set,get
ClipboardString functions has been deprecated and is no longer used. You may pass the unit value (or anything) as the window argument.
There is no binding for the glfwGetProcAddress function because it would basicaly require to write an entire OpenGL wrapper to make the functions returned by GLFW usable from OCaml. There are numerous OpenGL bindings available for OCaml that you can use instead.
The Vulkan related functions are not supported as of now but we might look into it at some point.
Source val terminate : unit -> unit
Source val getVersion : unit -> int * int * int
Source val getVersionString : unit -> string
Source val getMonitorWorkarea : monitor :monitor -> int * int * int * int
Source val getMonitorContentScale : monitor :monitor -> float * float
Source val defaultWindowHints : unit -> unit
Source val setWindowShouldClose : window :window -> b :bool -> unit
Source val setWindowTitle : window :window -> title :string -> unit
Source val setWindowPos : window :window -> xpos :int -> ypos :int -> unit
Source val setWindowSizeLimits :
window :window ->
minWidth :int option ->
minHeight :int option ->
maxWidth :int option ->
maxHeight :int option ->
unit
Source val setWindowAspectRatio : window :window -> numer :int -> denom :int -> unit
Source val setWindowSize : window :window -> width :int -> height :int -> unit
Source val getWindowFrameSize : window :window -> int * int * int * int
Source val getWindowContentScale : window :window -> float * float
Source val setWindowOpacity : window :window -> opacity :float -> unit
Source val setWindowMonitor :
window :window ->
monitor :monitor option ->
xpos :int ->
ypos :int ->
width :int ->
height :int ->
refreshRate :int option ->
unit
Source val setWindowPosCallback :
window :window ->
f :(window -> int -> int -> unit) option ->
(window -> int -> int -> unit) option
Source val setWindowSizeCallback :
window :window ->
f :(window -> int -> int -> unit) option ->
(window -> int -> int -> unit) option
Source val setWindowFocusCallback :
window :window ->
f :(window -> bool -> unit) option ->
(window -> bool -> unit) option
Source val setWindowIconifyCallback :
window :window ->
f :(window -> bool -> unit) option ->
(window -> bool -> unit) option
Source val setWindowMaximizeCallback :
window :window ->
f :(window -> bool -> unit) option ->
(window -> bool -> unit) option
Source val setFramebufferSizeCallback :
window :window ->
f :(window -> int -> int -> unit) option ->
(window -> int -> int -> unit) option
Source val setWindowContentScaleCallback :
window :window ->
f :(window -> float -> float -> unit) option ->
(window -> float -> float -> unit) option
Source val pollEvents : unit -> unit
Source val waitEvents : unit -> unit
Source val waitEventsTimeout : timeout :float -> unit
Source val postEmptyEvent : unit -> unit
Source val rawMouseMotionSupported : unit -> bool
Source val getKeyName : key :key -> scancode :int -> string option
Source val setCursorPos : window :window -> xpos :float -> ypos :float -> unit
Source val setCursorPosCallback :
window :window ->
f :(window -> float -> float -> unit) option ->
(window -> float -> float -> unit) option
Source val setCursorEnterCallback :
window :window ->
f :(window -> bool -> unit) option ->
(window -> bool -> unit) option
Source val setDropCallback :
window :window ->
f :(window -> string list -> unit) option ->
(window -> string list -> unit) option
Source val joystickPresent : joy :int -> bool
Source val getJoystickAxes : joy :int -> float array
Source val getJoystickName : joy :int -> string option
Source val getJoystickGUID : joy :int -> string option
Source val joystickIsGamepad : joy :int -> bool
Source val updateGamepadMappings : string :string -> unit
Source val getGamepadName : joy :int -> string option
Source val setClipboardString : window :_ -> string :string -> unit
Source val getClipboardString : window :_ -> string
Source val getTime : unit -> float
Source val setTime : time :float -> unit
Source val getTimerValue : unit -> int64
Source val getTimerFrequency : unit -> int64
Source val swapInterval : interval :int -> unit
Source val extensionSupported : extension :string -> bool