package glfw-ocaml
-
glfw-ocaml
Legend:
Library
Module
Module type
Parameter
Class
Class type
Library
Module
Module type
Parameter
Class
Class type
OCaml binding for GLFW 3.3
type key =
| Unknown
| Space
| Apostrophe
| Comma
| Minus
| Period
| Slash
| Num0
| Num1
| Num2
| Num3
| Num4
| Num5
| Num6
| Num7
| Num8
| Num9
| Semicolon
| Equal
| A
| B
| C
| D
| E
| F
| G
| H
| I
| J
| K
| L
| M
| N
| O
| P
| Q
| R
| S
| T
| U
| V
| W
| X
| Y
| Z
| LeftBracket
| Backslash
| RightBracket
| GraveAccent
| World1
| World2
| Escape
| Enter
| Tab
| Backspace
| Insert
| Delete
| Right
| Left
| Down
| Up
| PageUp
| PageDown
| Home
| End
| CapsLock
| ScrollLock
| NumLock
| PrintScreen
| Pause
| F1
| F2
| F3
| F4
| F5
| F6
| F7
| F8
| F9
| F10
| F11
| F12
| F13
| F14
| F15
| F16
| F17
| F18
| F19
| F20
| F21
| F22
| F23
| F24
| F25
| Kp0
| Kp1
| Kp2
| Kp3
| Kp4
| Kp5
| Kp6
| Kp7
| Kp8
| Kp9
| KpDecimal
| KpDivide
| KpMultiply
| KpSubtract
| KpAdd
| KpEnter
| KpEqual
| LeftShift
| LeftControl
| LeftAlt
| LeftSuper
| RightShift
| RightControl
| RightAlt
| RightSuper
| Menu
Keyboard keys.
Context robustness hint
Context release behavior hint
Context creation API hint
module A : sig ... end
Window hints and attributes. Use with windowHint, getWindowAttrib and setWindowAttrib like this:
include module type of A
Window hints and attributes. Use with windowHint, getWindowAttrib and setWindowAttrib like this:
windowHint ~hint:Resizable ~value:false windowHint ~hint:OpenGLProfile ~value:CoreProfile windowHint ~hint:RefreshRate ~value:(Some 60) windowHint ~hint:DepthBits ~value:None windowHint ~hint:X11ClassName ~value:"MyApplicationName"
getWindowAttrib ~attribute:Resizable : bool getWindowAttrib ~attribute:OpenGLProfile : opengl_profile getWindowAttrib ~attribute:Hovered : bool getWindowAttrib ~attribute:ContextRevision : int
setWindowAttrib ~attribute:Resizable ~value:true
This type is wrapped inside a module only for technical reasons related to backward-compatibility. That module is opened right after it is declared and it is intended that you use the constructor names unprefixed as shown in the previous examples. It will be removed together with the old modules in the future (probably on the next major version).
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
module type S = sig ... end
Deprecated window hints and attributes modules.
module WindowHint : S with type 'a t = ('a, [ `hint ]) window_attr
module WindowAttribute : S with type 'a t = ('a, [ `attr ]) window_attr
module WindowUpdateableAttribute :
S with type 'a t = ('a, [ `update ]) window_attr
type _ input_mode =
| Cursor : cursor_mode input_mode
| StickyKeys : bool input_mode
| StickyMouseButtons : bool input_mode
| LockKeyMods : bool input_mode
| RawMouseMotion : bool input_mode
Input modes. Use with setInputMode and getInputMode in a similar manner as with window hints.
module GammaRamp : sig ... end
GammaRamp module. Describes the gamma ramp for a monitor.
module Image : sig ... end
Image data for creating custom cursors and window icons.
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.
val initHint : hint:'a init_hint -> value:'a -> unit
val getMonitors : unit -> monitor list
val getPrimaryMonitor : unit -> monitor
val getMonitorPos : monitor:monitor -> int * int
val getMonitorWorkarea : monitor:monitor -> int * int * int * int
val getMonitorPhysicalSize : monitor:monitor -> int * int
val getMonitorContentScale : monitor:monitor -> float * float
val getMonitorName : monitor:monitor -> string
val setMonitorCallback :
f:(monitor -> connection_event -> unit) option ->
(monitor -> connection_event -> unit) option
val getVideoModes : monitor:monitor -> video_mode list
val getVideoMode : monitor:monitor -> video_mode
val setGamma : monitor:monitor -> gamma:float -> unit
val getGammaRamp : monitor:monitor -> GammaRamp.t
val setGammaRamp : monitor:monitor -> gamma_ramp:GammaRamp.t -> unit
val windowHint : hint:('a, [ `hint ]) window_attr -> value:'a -> unit
val destroyWindow : window:window -> unit
val windowShouldClose : window:window -> bool
val setWindowShouldClose : window:window -> b:bool -> unit
val setWindowTitle : window:window -> title:string -> unit
val getWindowPos : window:window -> int * int
val setWindowPos : window:window -> xpos:int -> ypos:int -> unit
val getWindowSize : window:window -> int * int
val setWindowSizeLimits :
window:window ->
minWidth:int option ->
minHeight:int option ->
maxWidth:int option ->
maxHeight:int option ->
unit
val setWindowAspectRatio : window:window -> numer:int -> denom:int -> unit
val setWindowSize : window:window -> width:int -> height:int -> unit
val getFramebufferSize : window:window -> int * int
val getWindowFrameSize : window:window -> int * int * int * int
val getWindowContentScale : window:window -> float * float
val getWindowOpacity : window:window -> float
val setWindowOpacity : window:window -> opacity:float -> unit
val iconifyWindow : window:window -> unit
val restoreWindow : window:window -> unit
val maximizeWindow : window:window -> unit
val showWindow : window:window -> unit
val hideWindow : window:window -> unit
val focusWindow : window:window -> unit
val requestWindowAttention : window:window -> unit
val getWindowAttrib :
window:window ->
attribute:('a, [ `attr ]) window_attr ->
'a
val setWindowAttrib :
window:window ->
attribute:('a, [ `update ]) window_attr ->
value:'a ->
unit
val getInputMode : window:window -> mode:'a input_mode -> 'a
val setInputMode : window:window -> mode:'a input_mode -> value:'a -> unit
val getKeyName : key:key -> scancode:int -> string option
val getKeyScancode : key:key -> int
val getMouseButton : window:window -> button:int -> bool
val getCursorPos : window:window -> float * float
val setCursorPos : window:window -> xpos:float -> ypos:float -> unit
val createStandardCursor : shape:cursor_shape -> cursor
val destroyCursor : cursor:cursor -> unit
val setKeyCallback :
window:window ->
f:(window -> key -> int -> key_action -> key_mod list -> unit) option ->
(window -> key -> int -> key_action -> key_mod list -> unit) option
val setCharModsCallback :
window:window ->
f:(window -> int -> key_mod list -> unit) option ->
(window -> int -> key_mod list -> unit) option
val getJoystickHats : joy:int -> hat_status list array
val setJoystickCallback :
f:(int -> connection_event -> unit) option ->
(int -> connection_event -> unit) option
val getGamepadState : joy:int -> gamepad_state
val makeContextCurrent : window:window option -> unit
val getCurrentContext : unit -> window option
val swapBuffers : window:window -> unit